UNPKG

@decentralized-identity/ion-cli

Version:

A Command Line Interface (CLI) to make working with the ION network and using ION DIDs easy peasy lemon squeezy.

39 lines (38 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const command_1 = require("@oclif/command"); const Output_1 = require("../../Output"); const { cli } = require('cli-ux'); class Public extends command_1.Command { async run() { const { args, flags } = this.parse(Public); // Create the key pair for the new DID cli.action.start('Returning public key JWK'); const privateJwk = JSON.parse(args.jwk); const { d } = privateJwk, publicJwk = tslib_1.__rest(privateJwk, ["d"]); const publicKeyJson = Output_1.default.toJson(Object.assign({}, publicJwk), flags.escape); cli.action.stop(); this.log(publicKeyJson); this.exit(); } } exports.default = Public; Public.description = 'Returns the public key JWK.'; Public.examples = [ '$ ion key:public {ESCAPED JSON STRING}', '$ ion key:public {ESCAPED JSON STRING} --escape', ]; Public.flags = { help: command_1.flags.help({ char: 'h' }), // Flag for specifying the JSON string output should be escaped. escape: command_1.flags.boolean({ description: 'specifies that the output JSON string should be escaped. Use this when using the output as input to another command.' }), }; Public.args = [ { name: 'jwk', required: true, description: 'an escaped JSON string containing the private key jwk.', strict: false, }, ];