@twin.org/identity-cli 0.0.1 → 0.0.2-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +63 -26
- package/dist/esm/index.mjs +63 -26
- package/dist/locales/en.json +110 -104
- package/dist/types/commands/proofCreate.d.ts +3 -0
- package/dist/types/commands/serviceAdd.d.ts +2 -0
- package/dist/types/commands/serviceRemove.d.ts +2 -0
- package/dist/types/commands/verifiableCredentialCreate.d.ts +2 -0
- package/dist/types/commands/verifiableCredentialRevoke.d.ts +2 -0
- package/dist/types/commands/verifiableCredentialUnrevoke.d.ts +2 -0
- package/dist/types/commands/verificationMethodAdd.d.ts +3 -0
- package/dist/types/commands/verificationMethodRemove.d.ts +2 -0
- package/docs/changelog.md +164 -0
- package/docs/reference/functions/actionCommandServiceRemove.md +6 -0
- package/docs/reference/functions/actionCommandVerifiableCredentialRevoke.md +6 -0
- package/docs/reference/functions/actionCommandVerifiableCredentialUnrevoke.md +6 -0
- package/docs/reference/functions/actionCommandVerificationMethodRemove.md +6 -0
- package/docs/reference/variables/IdentityConnectorTypes.md +1 -1
- package/docs/reference/variables/IdentityResolverConnectorTypes.md +1 -1
- package/locales/en.json +55 -13
- package/package.json +35 -20
package/dist/cjs/index.cjs
CHANGED
|
@@ -184,7 +184,7 @@ async function actionCommandIdentityCreate(opts) {
|
|
|
184
184
|
if (opts.connector === IdentityConnectorTypes.Iota) {
|
|
185
185
|
const didUrn = core.Urn.fromValidString(document.id);
|
|
186
186
|
const didParts = didUrn.parts();
|
|
187
|
-
const objectId = didParts[
|
|
187
|
+
const objectId = didParts[didParts.length - 1];
|
|
188
188
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`);
|
|
189
189
|
}
|
|
190
190
|
cliCore.CLIDisplay.break();
|
|
@@ -264,7 +264,7 @@ async function actionCommandIdentityResolve(opts) {
|
|
|
264
264
|
if (opts.connector === IdentityConnectorTypes.Iota) {
|
|
265
265
|
const didUrn = core.Urn.fromValidString(document.id);
|
|
266
266
|
const didParts = didUrn.parts();
|
|
267
|
-
const objectId = didParts[
|
|
267
|
+
const objectId = didParts[didParts.length - 1];
|
|
268
268
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`);
|
|
269
269
|
}
|
|
270
270
|
cliCore.CLIDisplay.break();
|
|
@@ -285,7 +285,8 @@ function buildCommandProofCreate() {
|
|
|
285
285
|
.description(core.I18n.formatMessage("commands.proof-create.description"))
|
|
286
286
|
.requiredOption(core.I18n.formatMessage("commands.proof-create.options.id.param"), core.I18n.formatMessage("commands.proof-create.options.id.description"))
|
|
287
287
|
.requiredOption(core.I18n.formatMessage("commands.proof-create.options.private-key.param"), core.I18n.formatMessage("commands.proof-create.options.private-key.description"))
|
|
288
|
-
.requiredOption(core.I18n.formatMessage("commands.proof-create.options.document-filename.param"), core.I18n.formatMessage("commands.proof-create.options.document-filename.description"))
|
|
288
|
+
.requiredOption(core.I18n.formatMessage("commands.proof-create.options.document-filename.param"), core.I18n.formatMessage("commands.proof-create.options.document-filename.description"))
|
|
289
|
+
.option(core.I18n.formatMessage("commands.proof-create.options.addressIndex.param"), core.I18n.formatMessage("commands.proof-create.options.addressIndex.description"), "0");
|
|
289
290
|
cliCore.CLIOptions.output(command, {
|
|
290
291
|
noConsole: true,
|
|
291
292
|
json: true,
|
|
@@ -307,6 +308,8 @@ function buildCommandProofCreate() {
|
|
|
307
308
|
* @param opts The options for the command.
|
|
308
309
|
* @param opts.id The id of the verification method to use for the credential.
|
|
309
310
|
* @param opts.privateKey The private key for the verification method.
|
|
311
|
+
* @param opts.documentFilename The filename of the document to create the proof for.
|
|
312
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
310
313
|
* @param opts.data The data to create the proof for.
|
|
311
314
|
* @param opts.connector The connector to perform the operations with.
|
|
312
315
|
* @param opts.node The node URL.
|
|
@@ -315,6 +318,7 @@ function buildCommandProofCreate() {
|
|
|
315
318
|
async function actionCommandProofCreate(opts) {
|
|
316
319
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
317
320
|
const privateKey = cliCore.CLIParam.hexBase64("private-key", opts.privateKey);
|
|
321
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
318
322
|
const documentFilename = path.resolve(cliCore.CLIParam.stringValue("document-filename", opts.documentFilename));
|
|
319
323
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
320
324
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
@@ -322,6 +326,7 @@ async function actionCommandProofCreate(opts) {
|
|
|
322
326
|
: undefined;
|
|
323
327
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.proof-create.labels.verificationMethodId"), id);
|
|
324
328
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.proof-create.labels.documentFilename"), documentFilename);
|
|
329
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.proof-create.labels.addressIndex"), addressIndex);
|
|
325
330
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
326
331
|
if (core.Is.stringValue(network)) {
|
|
327
332
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -334,7 +339,7 @@ async function actionCommandProofCreate(opts) {
|
|
|
334
339
|
await vaultConnector.addKey(`${localIdentity}/${vmParts.fragment}`, vaultModels.VaultKeyType.Ed25519, privateKey, new Uint8Array());
|
|
335
340
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, network }, opts.connector);
|
|
336
341
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
337
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network }, opts.connector);
|
|
342
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex }, opts.connector);
|
|
338
343
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.proof-create.progress.creatingProof"));
|
|
339
344
|
cliCore.CLIDisplay.break();
|
|
340
345
|
cliCore.CLIDisplay.spinnerStart();
|
|
@@ -457,7 +462,8 @@ function buildCommandServiceAdd() {
|
|
|
457
462
|
.requiredOption(core.I18n.formatMessage("commands.service-add.options.did.param"), core.I18n.formatMessage("commands.service-add.options.did.description"))
|
|
458
463
|
.requiredOption(core.I18n.formatMessage("commands.service-add.options.id.param"), core.I18n.formatMessage("commands.service-add.options.id.description"))
|
|
459
464
|
.requiredOption(core.I18n.formatMessage("commands.service-add.options.type.param"), core.I18n.formatMessage("commands.service-add.options.type.description"))
|
|
460
|
-
.requiredOption(core.I18n.formatMessage("commands.service-add.options.endpoint.param"), core.I18n.formatMessage("commands.service-add.options.endpoint.description"))
|
|
465
|
+
.requiredOption(core.I18n.formatMessage("commands.service-add.options.endpoint.param"), core.I18n.formatMessage("commands.service-add.options.endpoint.description"))
|
|
466
|
+
.option(core.I18n.formatMessage("commands.service-add.options.addressIndex.param"), core.I18n.formatMessage("commands.service-add.options.addressIndex.description"), "0");
|
|
461
467
|
cliCore.CLIOptions.output(command, {
|
|
462
468
|
noConsole: true,
|
|
463
469
|
json: true,
|
|
@@ -483,6 +489,7 @@ function buildCommandServiceAdd() {
|
|
|
483
489
|
* @param opts.id The id of the service to add.
|
|
484
490
|
* @param opts.type The type of the service to add.
|
|
485
491
|
* @param opts.endpoint The service endpoint.
|
|
492
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
486
493
|
* @param opts.connector The connector to perform the operations with.
|
|
487
494
|
* @param opts.node The node URL.
|
|
488
495
|
* @param opts.explorer The explorer URL.
|
|
@@ -493,6 +500,7 @@ async function actionCommandServiceAdd(opts) {
|
|
|
493
500
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
494
501
|
const type = cliCore.CLIParam.stringValue("type", opts.type);
|
|
495
502
|
const endpoint = cliCore.CLIParam.url("endpoint", opts.endpoint);
|
|
503
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
496
504
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
497
505
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
498
506
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
@@ -502,6 +510,7 @@ async function actionCommandServiceAdd(opts) {
|
|
|
502
510
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.service-add.labels.serviceId"), id);
|
|
503
511
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.service-add.labels.serviceType"), type);
|
|
504
512
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.service-add.labels.serviceEndpoint"), endpoint);
|
|
513
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.service-add.labels.addressIndex"), addressIndex);
|
|
505
514
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
506
515
|
if (core.Is.stringValue(network)) {
|
|
507
516
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -515,7 +524,7 @@ async function actionCommandServiceAdd(opts) {
|
|
|
515
524
|
await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
|
|
516
525
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, vaultSeedId, network }, opts.connector);
|
|
517
526
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
518
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
|
|
527
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex, vaultSeedId }, opts.connector);
|
|
519
528
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.service-add.progress.addingService"));
|
|
520
529
|
cliCore.CLIDisplay.break();
|
|
521
530
|
cliCore.CLIDisplay.spinnerStart();
|
|
@@ -534,7 +543,7 @@ async function actionCommandServiceAdd(opts) {
|
|
|
534
543
|
if (opts.connector === IdentityConnectorTypes.Iota) {
|
|
535
544
|
const didUrn = core.Urn.fromValidString(did);
|
|
536
545
|
const didParts = didUrn.parts();
|
|
537
|
-
const objectId = didParts[
|
|
546
|
+
const objectId = didParts[didParts.length - 1];
|
|
538
547
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`);
|
|
539
548
|
}
|
|
540
549
|
cliCore.CLIDisplay.break();
|
|
@@ -554,7 +563,8 @@ function buildCommandServiceRemove() {
|
|
|
554
563
|
.summary(core.I18n.formatMessage("commands.service-remove.summary"))
|
|
555
564
|
.description(core.I18n.formatMessage("commands.service-remove.description"))
|
|
556
565
|
.requiredOption(core.I18n.formatMessage("commands.service-remove.options.seed.param"), core.I18n.formatMessage("commands.service-remove.options.seed.description"))
|
|
557
|
-
.requiredOption(core.I18n.formatMessage("commands.service-remove.options.id.param"), core.I18n.formatMessage("commands.service-remove.options.id.description"))
|
|
566
|
+
.requiredOption(core.I18n.formatMessage("commands.service-remove.options.id.param"), core.I18n.formatMessage("commands.service-remove.options.id.description"))
|
|
567
|
+
.option(core.I18n.formatMessage("commands.service-remove.options.addressIndex.param"), core.I18n.formatMessage("commands.service-remove.options.addressIndex.description"), "0");
|
|
558
568
|
cliCore.CLIOptions.output(command, {
|
|
559
569
|
noConsole: true,
|
|
560
570
|
json: true,
|
|
@@ -581,16 +591,19 @@ function buildCommandServiceRemove() {
|
|
|
581
591
|
* @param opts.node The node URL.
|
|
582
592
|
* @param opts.network The network to use for connector.
|
|
583
593
|
* @param opts.explorer The explorer URL.
|
|
594
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
584
595
|
*/
|
|
585
596
|
async function actionCommandServiceRemove(opts) {
|
|
586
597
|
const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
|
|
587
598
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
599
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
588
600
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
589
601
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
590
602
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
591
603
|
: undefined;
|
|
592
604
|
const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
|
|
593
605
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.service-remove.labels.serviceId"), id);
|
|
606
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.service-remove.labels.addressIndex"), addressIndex);
|
|
594
607
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
595
608
|
if (core.Is.stringValue(network)) {
|
|
596
609
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -604,7 +617,7 @@ async function actionCommandServiceRemove(opts) {
|
|
|
604
617
|
await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
|
|
605
618
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, vaultSeedId, network }, opts.connector);
|
|
606
619
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
607
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
|
|
620
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex, vaultSeedId }, opts.connector);
|
|
608
621
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.service-remove.progress.removingService"));
|
|
609
622
|
cliCore.CLIDisplay.break();
|
|
610
623
|
cliCore.CLIDisplay.spinnerStart();
|
|
@@ -614,7 +627,7 @@ async function actionCommandServiceRemove(opts) {
|
|
|
614
627
|
if (opts.connector === IdentityConnectorTypes.Iota) {
|
|
615
628
|
const didUrn = core.Urn.fromValidString(did);
|
|
616
629
|
const didParts = didUrn.parts();
|
|
617
|
-
const objectId = didParts[
|
|
630
|
+
const objectId = didParts[didParts.length - 1];
|
|
618
631
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`);
|
|
619
632
|
}
|
|
620
633
|
cliCore.CLIDisplay.break();
|
|
@@ -637,7 +650,8 @@ function buildCommandVerifiableCredentialCreate() {
|
|
|
637
650
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-create.options.private-key.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.private-key.description"))
|
|
638
651
|
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.credential-id.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.credential-id.description"))
|
|
639
652
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-create.options.subject-json.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.subject-json.description"))
|
|
640
|
-
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.description"))
|
|
653
|
+
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.description"))
|
|
654
|
+
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.addressIndex.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.addressIndex.description"), "0");
|
|
641
655
|
cliCore.CLIOptions.output(command, {
|
|
642
656
|
noConsole: true,
|
|
643
657
|
json: true,
|
|
@@ -662,6 +676,7 @@ function buildCommandVerifiableCredentialCreate() {
|
|
|
662
676
|
* @param opts.credentialId The id of the credential.
|
|
663
677
|
* @param opts.subjectJson The JSON data for the subject.
|
|
664
678
|
* @param opts.revocationIndex The revocation index for the credential.
|
|
679
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
665
680
|
* @param opts.connector The connector to perform the operations with.
|
|
666
681
|
* @param opts.node The node URL.
|
|
667
682
|
*/
|
|
@@ -671,6 +686,7 @@ async function actionCommandVerifiableCredentialCreate(opts) {
|
|
|
671
686
|
const credentialId = cliCore.CLIParam.stringValue("credential-id", opts.credentialId);
|
|
672
687
|
const subjectJson = path.resolve(cliCore.CLIParam.stringValue("subject-json", opts.subjectJson));
|
|
673
688
|
const revocationIndex = core.Coerce.number(opts.revocationIndex);
|
|
689
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
674
690
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
675
691
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
676
692
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
@@ -679,6 +695,7 @@ async function actionCommandVerifiableCredentialCreate(opts) {
|
|
|
679
695
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.credentialId"), credentialId);
|
|
680
696
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.subjectJson"), subjectJson);
|
|
681
697
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.revocationIndex"), revocationIndex);
|
|
698
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.addressIndex"), addressIndex);
|
|
682
699
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
683
700
|
if (core.Is.stringValue(network)) {
|
|
684
701
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -691,7 +708,7 @@ async function actionCommandVerifiableCredentialCreate(opts) {
|
|
|
691
708
|
await vaultConnector.addKey(`${localIdentity}/${vmParts.fragment}`, vaultModels.VaultKeyType.Ed25519, privateKey, new Uint8Array());
|
|
692
709
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, network }, opts.connector);
|
|
693
710
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
694
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network }, opts.connector);
|
|
711
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex }, opts.connector);
|
|
695
712
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.verifiable-credential-create.progress.loadingSubjectData"));
|
|
696
713
|
cliCore.CLIDisplay.break();
|
|
697
714
|
const jsonData = await cliCore.CLIUtils.readJsonFile(subjectJson);
|
|
@@ -701,7 +718,9 @@ async function actionCommandVerifiableCredentialCreate(opts) {
|
|
|
701
718
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.verifiable-credential-create.progress.creatingVerifiableCredential"));
|
|
702
719
|
cliCore.CLIDisplay.break();
|
|
703
720
|
cliCore.CLIDisplay.spinnerStart();
|
|
704
|
-
const verifiableCredential = await identityConnector.createVerifiableCredential(localIdentity, id, credentialId, jsonData,
|
|
721
|
+
const verifiableCredential = await identityConnector.createVerifiableCredential(localIdentity, id, credentialId, jsonData, {
|
|
722
|
+
revocationIndex
|
|
723
|
+
});
|
|
705
724
|
cliCore.CLIDisplay.spinnerStop();
|
|
706
725
|
if (opts.console) {
|
|
707
726
|
cliCore.CLIDisplay.section(core.I18n.formatMessage("commands.verifiable-credential-create.labels.verifiableCredential"));
|
|
@@ -732,7 +751,8 @@ function buildCommandVerifiableCredentialRevoke() {
|
|
|
732
751
|
.description(core.I18n.formatMessage("commands.verifiable-credential-revoke.description"))
|
|
733
752
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-revoke.options.seed.param"), core.I18n.formatMessage("commands.verifiable-credential-revoke.options.seed.description"))
|
|
734
753
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-revoke.options.did.param"), core.I18n.formatMessage("commands.verifiable-credential-revoke.options.did.description"))
|
|
735
|
-
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-revoke.options.revocation-index.param"), core.I18n.formatMessage("commands.verifiable-credential-revoke.options.revocation-index.description"))
|
|
754
|
+
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-revoke.options.revocation-index.param"), core.I18n.formatMessage("commands.verifiable-credential-revoke.options.revocation-index.description"))
|
|
755
|
+
.option(core.I18n.formatMessage("commands.verifiable-credential-revoke.options.addressIndex.param"), core.I18n.formatMessage("commands.verifiable-credential-revoke.options.addressIndex.description"), "0");
|
|
736
756
|
command
|
|
737
757
|
.addOption(new commander.Option(core.I18n.formatMessage("commands.common.options.connector.param"), core.I18n.formatMessage("commands.common.options.connector.description"))
|
|
738
758
|
.choices(Object.values(IdentityConnectorTypes))
|
|
@@ -751,17 +771,20 @@ function buildCommandVerifiableCredentialRevoke() {
|
|
|
751
771
|
* @param opts.connector The connector to perform the operations with.
|
|
752
772
|
* @param opts.node The node URL.
|
|
753
773
|
* @param opts.network The network to use for connector.
|
|
774
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
754
775
|
*/
|
|
755
776
|
async function actionCommandVerifiableCredentialRevoke(opts) {
|
|
756
777
|
const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
|
|
757
778
|
const did = cliCore.CLIParam.stringValue("did", opts.did);
|
|
758
779
|
const revocationIndex = cliCore.CLIParam.integer("revocation-index", opts.revocationIndex);
|
|
780
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
759
781
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
760
782
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
761
783
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
762
784
|
: undefined;
|
|
763
785
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.did"), did);
|
|
764
786
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-revoke.labels.revocationIndex"), revocationIndex);
|
|
787
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-revoke.labels.addressIndex"), addressIndex);
|
|
765
788
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
766
789
|
if (core.Is.stringValue(network)) {
|
|
767
790
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -774,7 +797,7 @@ async function actionCommandVerifiableCredentialRevoke(opts) {
|
|
|
774
797
|
await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
|
|
775
798
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, vaultSeedId, network }, opts.connector);
|
|
776
799
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
777
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
|
|
800
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex, vaultSeedId }, opts.connector);
|
|
778
801
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.verifiable-credential-revoke.progress.revokingCredential"));
|
|
779
802
|
cliCore.CLIDisplay.break();
|
|
780
803
|
cliCore.CLIDisplay.spinnerStart();
|
|
@@ -797,7 +820,8 @@ function buildCommandVerifiableCredentialUnrevoke() {
|
|
|
797
820
|
.description(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.description"))
|
|
798
821
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.seed.param"), core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.seed.description"))
|
|
799
822
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.did.param"), core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.did.description"))
|
|
800
|
-
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.revocation-index.param"), core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.revocation-index.description"))
|
|
823
|
+
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.revocation-index.param"), core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.revocation-index.description"))
|
|
824
|
+
.option(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.addressIndex.param"), core.I18n.formatMessage("commands.verifiable-credential-unrevoke.options.addressIndex.description"), "0");
|
|
801
825
|
command
|
|
802
826
|
.addOption(new commander.Option(core.I18n.formatMessage("commands.common.options.connector.param"), core.I18n.formatMessage("commands.common.options.connector.description"))
|
|
803
827
|
.choices(Object.values(IdentityConnectorTypes))
|
|
@@ -816,17 +840,20 @@ function buildCommandVerifiableCredentialUnrevoke() {
|
|
|
816
840
|
* @param opts.connector The connector to perform the operations with.
|
|
817
841
|
* @param opts.node The node URL.
|
|
818
842
|
* @param opts.network The network to use for connector.
|
|
843
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
819
844
|
*/
|
|
820
845
|
async function actionCommandVerifiableCredentialUnrevoke(opts) {
|
|
821
846
|
const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
|
|
822
847
|
const did = cliCore.CLIParam.stringValue("did", opts.did);
|
|
823
848
|
const revocationIndex = cliCore.CLIParam.integer("revocation-index", opts.revocationIndex);
|
|
849
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
824
850
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
825
851
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
826
852
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
827
853
|
: undefined;
|
|
828
854
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.did"), did);
|
|
829
855
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.labels.revocationIndex"), revocationIndex);
|
|
856
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.labels.addressIndex"), addressIndex);
|
|
830
857
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
831
858
|
if (core.Is.stringValue(network)) {
|
|
832
859
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -839,7 +866,7 @@ async function actionCommandVerifiableCredentialUnrevoke(opts) {
|
|
|
839
866
|
await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
|
|
840
867
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, vaultSeedId, network }, opts.connector);
|
|
841
868
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
842
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
|
|
869
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex, vaultSeedId }, opts.connector);
|
|
843
870
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.verifiable-credential-unrevoke.progress.unrevokingCredential"));
|
|
844
871
|
cliCore.CLIDisplay.break();
|
|
845
872
|
cliCore.CLIDisplay.spinnerStart();
|
|
@@ -941,7 +968,8 @@ function buildCommandVerificationMethodAdd() {
|
|
|
941
968
|
.addOption(new commander.Option(core.I18n.formatMessage("commands.verification-method-add.options.type.param"), core.I18n.formatMessage("commands.verification-method-add.options.type.description"))
|
|
942
969
|
.choices(Object.values(standardsW3cDid.DidVerificationMethodType))
|
|
943
970
|
.makeOptionMandatory())
|
|
944
|
-
.option(core.I18n.formatMessage("commands.verification-method-add.options.id.param"), core.I18n.formatMessage("commands.verification-method-add.options.id.description"))
|
|
971
|
+
.option(core.I18n.formatMessage("commands.verification-method-add.options.id.param"), core.I18n.formatMessage("commands.verification-method-add.options.id.description"))
|
|
972
|
+
.option(core.I18n.formatMessage("commands.verification-method-add.options.addressIndex.param"), core.I18n.formatMessage("commands.verification-method-add.options.addressIndex.description"), "0");
|
|
945
973
|
cliCore.CLIOptions.output(command, {
|
|
946
974
|
noConsole: true,
|
|
947
975
|
json: true,
|
|
@@ -969,11 +997,14 @@ function buildCommandVerificationMethodAdd() {
|
|
|
969
997
|
* @param opts.connector The connector to perform the operations with.
|
|
970
998
|
* @param opts.node The node URL.
|
|
971
999
|
* @param opts.explorer The explorer URL.
|
|
1000
|
+
* @param opts.network The network to use for connector.
|
|
1001
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
972
1002
|
*/
|
|
973
1003
|
async function actionCommandVerificationMethodAdd(opts) {
|
|
974
1004
|
const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
|
|
975
1005
|
const did = cliCore.CLIParam.stringValue("did", opts.did);
|
|
976
1006
|
const type = cliCore.CLIParam.stringValue("type", opts.type);
|
|
1007
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
977
1008
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
978
1009
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
979
1010
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
@@ -984,6 +1015,7 @@ async function actionCommandVerificationMethodAdd(opts) {
|
|
|
984
1015
|
if (core.Is.stringValue(opts.id)) {
|
|
985
1016
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.verificationMethodId"), opts?.id);
|
|
986
1017
|
}
|
|
1018
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-add.labels.addressIndex"), addressIndex);
|
|
987
1019
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
988
1020
|
if (core.Is.stringValue(network)) {
|
|
989
1021
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -997,7 +1029,7 @@ async function actionCommandVerificationMethodAdd(opts) {
|
|
|
997
1029
|
await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
|
|
998
1030
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, vaultSeedId, network }, opts.connector);
|
|
999
1031
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
1000
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
|
|
1032
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex, vaultSeedId }, opts.connector);
|
|
1001
1033
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.verification-method-add.progress.addingVerificationMethod"));
|
|
1002
1034
|
cliCore.CLIDisplay.break();
|
|
1003
1035
|
cliCore.CLIDisplay.spinnerStart();
|
|
@@ -1041,7 +1073,7 @@ async function actionCommandVerificationMethodAdd(opts) {
|
|
|
1041
1073
|
if (opts.connector === IdentityConnectorTypes.Iota) {
|
|
1042
1074
|
const didUrn = core.Urn.fromValidString(did);
|
|
1043
1075
|
const didParts = didUrn.parts();
|
|
1044
|
-
const objectId = didParts[
|
|
1076
|
+
const objectId = didParts[didParts.length - 1];
|
|
1045
1077
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`);
|
|
1046
1078
|
}
|
|
1047
1079
|
cliCore.CLIDisplay.break();
|
|
@@ -1061,7 +1093,8 @@ function buildCommandVerificationMethodRemove() {
|
|
|
1061
1093
|
.summary(core.I18n.formatMessage("commands.verification-method-remove.summary"))
|
|
1062
1094
|
.description(core.I18n.formatMessage("commands.verification-method-remove.description"))
|
|
1063
1095
|
.requiredOption(core.I18n.formatMessage("commands.verification-method-remove.options.seed.param"), core.I18n.formatMessage("commands.verification-method-remove.options.seed.description"))
|
|
1064
|
-
.requiredOption(core.I18n.formatMessage("commands.verification-method-remove.options.id.param"), core.I18n.formatMessage("commands.verification-method-remove.options.id.description"))
|
|
1096
|
+
.requiredOption(core.I18n.formatMessage("commands.verification-method-remove.options.id.param"), core.I18n.formatMessage("commands.verification-method-remove.options.id.description"))
|
|
1097
|
+
.option(core.I18n.formatMessage("commands.verification-method-remove.options.addressIndex.param"), core.I18n.formatMessage("commands.verification-method-remove.options.addressIndex.description"), "0");
|
|
1065
1098
|
cliCore.CLIOptions.output(command, {
|
|
1066
1099
|
noConsole: true,
|
|
1067
1100
|
json: true,
|
|
@@ -1088,16 +1121,19 @@ function buildCommandVerificationMethodRemove() {
|
|
|
1088
1121
|
* @param opts.node The node URL.
|
|
1089
1122
|
* @param opts.explorer The explorer URL.
|
|
1090
1123
|
* @param opts.network The network to use for connector.
|
|
1124
|
+
* @param opts.addressIndex The address index to use for key derivation (if applicable).
|
|
1091
1125
|
*/
|
|
1092
1126
|
async function actionCommandVerificationMethodRemove(opts) {
|
|
1093
1127
|
const seed = cliCore.CLIParam.hexBase64("seed", opts.seed);
|
|
1094
1128
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
1129
|
+
const addressIndex = cliCore.CLIParam.integer("addressIndex", opts.addressIndex ?? "0", false, 0);
|
|
1095
1130
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
1096
1131
|
const network = opts.connector === IdentityConnectorTypes.Iota
|
|
1097
1132
|
? cliCore.CLIParam.stringValue("network", opts.network)
|
|
1098
1133
|
: undefined;
|
|
1099
1134
|
const explorerEndpoint = cliCore.CLIParam.url("explorer", opts.explorer);
|
|
1100
|
-
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-
|
|
1135
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-remove.labels.verificationMethodId"), id);
|
|
1136
|
+
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verification-method-remove.labels.addressIndex"), addressIndex);
|
|
1101
1137
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
1102
1138
|
if (core.Is.stringValue(network)) {
|
|
1103
1139
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.network"), network);
|
|
@@ -1111,7 +1147,7 @@ async function actionCommandVerificationMethodRemove(opts) {
|
|
|
1111
1147
|
await vaultConnector.setSecret(`${localIdentity}/${vaultSeedId}`, core.Converter.bytesToBase64(seed));
|
|
1112
1148
|
const walletConnector = walletCli.setupWalletConnector({ nodeEndpoint, vaultSeedId, network }, opts.connector);
|
|
1113
1149
|
walletModels.WalletConnectorFactory.register("wallet", () => walletConnector);
|
|
1114
|
-
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, vaultSeedId }, opts.connector);
|
|
1150
|
+
const identityConnector = setupIdentityConnector({ nodeEndpoint, network, addressIndex, vaultSeedId }, opts.connector);
|
|
1115
1151
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.verification-method-remove.progress.removingVerificationMethod"));
|
|
1116
1152
|
cliCore.CLIDisplay.break();
|
|
1117
1153
|
cliCore.CLIDisplay.spinnerStart();
|
|
@@ -1121,7 +1157,7 @@ async function actionCommandVerificationMethodRemove(opts) {
|
|
|
1121
1157
|
if (opts.connector === IdentityConnectorTypes.Iota) {
|
|
1122
1158
|
const didUrn = core.Urn.fromValidString(did);
|
|
1123
1159
|
const didParts = didUrn.parts();
|
|
1124
|
-
const objectId = didParts[
|
|
1160
|
+
const objectId = didParts[didParts.length - 1];
|
|
1125
1161
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.explore"), `${core.StringHelper.trimTrailingSlashes(explorerEndpoint)}/object/${objectId}?network=${network}`);
|
|
1126
1162
|
}
|
|
1127
1163
|
cliCore.CLIDisplay.break();
|
|
@@ -1146,10 +1182,11 @@ class CLI extends cliCore.CLIBase {
|
|
|
1146
1182
|
return this.execute({
|
|
1147
1183
|
title: "TWIN Identity",
|
|
1148
1184
|
appName: "twin-identity",
|
|
1149
|
-
version: "0.0.
|
|
1185
|
+
version: "0.0.2-next.10", // x-release-please-version
|
|
1150
1186
|
icon: "🌍",
|
|
1151
1187
|
supportsEnvFiles: true,
|
|
1152
|
-
overrideOutputWidth: options?.overrideOutputWidth
|
|
1188
|
+
overrideOutputWidth: options?.overrideOutputWidth,
|
|
1189
|
+
showDevToolWarning: true
|
|
1153
1190
|
}, localesDirectory ?? path.join(path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))), "../locales"), argv);
|
|
1154
1191
|
}
|
|
1155
1192
|
/**
|