Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async run() {
const res = this.parse(ShowMetadata)
const metadata = IdentityMetadataWrapper.fromFile(res.args.file)
console.info(`Metadata at ${res.args.file} contains the following claims: \n`)
displayMetadata(metadata)
}
}
export const modifyMetadata = async (
filePath: string,
operation: (metadata: IdentityMetadataWrapper) => Promise
) => {
const metadata = IdentityMetadataWrapper.fromFile(filePath)
await operation(metadata)
writeFileSync(filePath, metadata.toString())
}
protected readMetadata = () => {
const { args } = this.parse(this.self)
const filePath = args.file
try {
cli.action.start(`Read Metadata from ${filePath}`)
const data = IdentityMetadataWrapper.fromFile(filePath)
cli.action.stop()
return data
} catch (error) {
cli.action.stop(`Error: ${error}`)
throw error
}
}