@twin.org/identity-cli 0.0.1-next.4 → 0.0.1-next.6
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 +1 -19
- package/dist/esm/index.mjs +2 -20
- package/dist/locales/en.json +9 -19
- package/dist/types/commands/verifiableCredentialCreate.d.ts +0 -4
- package/docs/changelog.md +1 -1
- package/locales/en.json +1 -11
- package/package.json +4 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -557,8 +557,6 @@ function buildCommandVerifiableCredentialCreate() {
|
|
|
557
557
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-create.options.id.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.id.description"))
|
|
558
558
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-create.options.private-key.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.private-key.description"))
|
|
559
559
|
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.credential-id.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.credential-id.description"))
|
|
560
|
-
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.types.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.types.description"))
|
|
561
|
-
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.contexts.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.contexts.description"))
|
|
562
560
|
.requiredOption(core.I18n.formatMessage("commands.verifiable-credential-create.options.subject-json.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.subject-json.description"))
|
|
563
561
|
.option(core.I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.param"), core.I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.description"));
|
|
564
562
|
cliCore.CLIOptions.output(command, {
|
|
@@ -579,35 +577,19 @@ function buildCommandVerifiableCredentialCreate() {
|
|
|
579
577
|
* @param opts.id The id of the verification method to use for the credential.
|
|
580
578
|
* @param opts.privateKey The private key for the verification method.
|
|
581
579
|
* @param opts.credentialId The id of the credential.
|
|
582
|
-
* @param opts.types The types for the credential.
|
|
583
580
|
* @param opts.subjectJson The JSON data for the subject.
|
|
584
|
-
* @param opts.contexts The contexts for the credential.
|
|
585
581
|
* @param opts.revocationIndex The revocation index for the credential.
|
|
586
582
|
* @param opts.node The node URL.
|
|
587
583
|
*/
|
|
588
584
|
async function actionCommandVerifiableCredentialCreate(opts) {
|
|
589
|
-
if (!core.Is.undefined(opts.types)) {
|
|
590
|
-
core.Guards.arrayValue("commands", "types", opts.types);
|
|
591
|
-
}
|
|
592
|
-
if (!core.Is.undefined(opts.contexts)) {
|
|
593
|
-
core.Guards.arrayValue("commands", "contexts", opts.contexts);
|
|
594
|
-
}
|
|
595
585
|
const id = cliCore.CLIParam.stringValue("id", opts.id);
|
|
596
586
|
const privateKey = cliCore.CLIParam.hexBase64("private-key", opts.privateKey);
|
|
597
587
|
const credentialId = cliCore.CLIParam.stringValue("credential-id", opts.credentialId);
|
|
598
|
-
const types = opts.types;
|
|
599
|
-
const contexts = opts.contexts;
|
|
600
588
|
const subjectJson = path.resolve(cliCore.CLIParam.stringValue("subject-json", opts.subjectJson));
|
|
601
589
|
const revocationIndex = core.Coerce.number(opts.revocationIndex);
|
|
602
590
|
const nodeEndpoint = cliCore.CLIParam.url("node", opts.node);
|
|
603
591
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.verificationMethodId"), id);
|
|
604
592
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.credentialId"), credentialId);
|
|
605
|
-
if (core.Is.arrayValue(types)) {
|
|
606
|
-
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.types"), types.join(","));
|
|
607
|
-
}
|
|
608
|
-
if (core.Is.arrayValue(contexts)) {
|
|
609
|
-
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.contexts"), contexts.join(","));
|
|
610
|
-
}
|
|
611
593
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.subjectJson"), subjectJson);
|
|
612
594
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.verifiable-credential-create.labels.revocationIndex"), revocationIndex);
|
|
613
595
|
cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
@@ -642,7 +624,7 @@ async function actionCommandVerifiableCredentialCreate(opts) {
|
|
|
642
624
|
cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.verifiable-credential-create.progress.creatingVerifiableCredential"));
|
|
643
625
|
cliCore.CLIDisplay.break();
|
|
644
626
|
cliCore.CLIDisplay.spinnerStart();
|
|
645
|
-
const verifiableCredential = await iotaIdentityConnector.createVerifiableCredential(localIdentity, id, credentialId,
|
|
627
|
+
const verifiableCredential = await iotaIdentityConnector.createVerifiableCredential(localIdentity, id, credentialId, jsonData, revocationIndex);
|
|
646
628
|
cliCore.CLIDisplay.spinnerStop();
|
|
647
629
|
if (opts.console) {
|
|
648
630
|
cliCore.CLIDisplay.section(core.I18n.formatMessage("commands.verifiable-credential-create.labels.verifiableCredential"));
|
package/dist/esm/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
3
3
|
import { CLIOptions, CLIParam, CLIDisplay, CLIUtils, CLIBase } from '@twin.org/cli-core';
|
|
4
4
|
import { buildCommandMnemonic, buildCommandAddress } from '@twin.org/crypto-cli';
|
|
5
5
|
import { buildCommandFaucet, buildCommandTransfer } from '@twin.org/wallet-cli';
|
|
6
|
-
import { I18n, Converter, Is, StringHelper,
|
|
6
|
+
import { I18n, Converter, Is, StringHelper, Coerce, GeneralError } from '@twin.org/core';
|
|
7
7
|
import { IotaIdentityConnector, IotaIdentityUtils } from '@twin.org/identity-connector-iota';
|
|
8
8
|
import { VaultConnectorFactory, VaultKeyType } from '@twin.org/vault-models';
|
|
9
9
|
import { IotaWalletConnector } from '@twin.org/wallet-connector-iota';
|
|
@@ -554,8 +554,6 @@ function buildCommandVerifiableCredentialCreate() {
|
|
|
554
554
|
.requiredOption(I18n.formatMessage("commands.verifiable-credential-create.options.id.param"), I18n.formatMessage("commands.verifiable-credential-create.options.id.description"))
|
|
555
555
|
.requiredOption(I18n.formatMessage("commands.verifiable-credential-create.options.private-key.param"), I18n.formatMessage("commands.verifiable-credential-create.options.private-key.description"))
|
|
556
556
|
.option(I18n.formatMessage("commands.verifiable-credential-create.options.credential-id.param"), I18n.formatMessage("commands.verifiable-credential-create.options.credential-id.description"))
|
|
557
|
-
.option(I18n.formatMessage("commands.verifiable-credential-create.options.types.param"), I18n.formatMessage("commands.verifiable-credential-create.options.types.description"))
|
|
558
|
-
.option(I18n.formatMessage("commands.verifiable-credential-create.options.contexts.param"), I18n.formatMessage("commands.verifiable-credential-create.options.contexts.description"))
|
|
559
557
|
.requiredOption(I18n.formatMessage("commands.verifiable-credential-create.options.subject-json.param"), I18n.formatMessage("commands.verifiable-credential-create.options.subject-json.description"))
|
|
560
558
|
.option(I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.param"), I18n.formatMessage("commands.verifiable-credential-create.options.revocation-index.description"));
|
|
561
559
|
CLIOptions.output(command, {
|
|
@@ -576,35 +574,19 @@ function buildCommandVerifiableCredentialCreate() {
|
|
|
576
574
|
* @param opts.id The id of the verification method to use for the credential.
|
|
577
575
|
* @param opts.privateKey The private key for the verification method.
|
|
578
576
|
* @param opts.credentialId The id of the credential.
|
|
579
|
-
* @param opts.types The types for the credential.
|
|
580
577
|
* @param opts.subjectJson The JSON data for the subject.
|
|
581
|
-
* @param opts.contexts The contexts for the credential.
|
|
582
578
|
* @param opts.revocationIndex The revocation index for the credential.
|
|
583
579
|
* @param opts.node The node URL.
|
|
584
580
|
*/
|
|
585
581
|
async function actionCommandVerifiableCredentialCreate(opts) {
|
|
586
|
-
if (!Is.undefined(opts.types)) {
|
|
587
|
-
Guards.arrayValue("commands", "types", opts.types);
|
|
588
|
-
}
|
|
589
|
-
if (!Is.undefined(opts.contexts)) {
|
|
590
|
-
Guards.arrayValue("commands", "contexts", opts.contexts);
|
|
591
|
-
}
|
|
592
582
|
const id = CLIParam.stringValue("id", opts.id);
|
|
593
583
|
const privateKey = CLIParam.hexBase64("private-key", opts.privateKey);
|
|
594
584
|
const credentialId = CLIParam.stringValue("credential-id", opts.credentialId);
|
|
595
|
-
const types = opts.types;
|
|
596
|
-
const contexts = opts.contexts;
|
|
597
585
|
const subjectJson = path.resolve(CLIParam.stringValue("subject-json", opts.subjectJson));
|
|
598
586
|
const revocationIndex = Coerce.number(opts.revocationIndex);
|
|
599
587
|
const nodeEndpoint = CLIParam.url("node", opts.node);
|
|
600
588
|
CLIDisplay.value(I18n.formatMessage("commands.verifiable-credential-create.labels.verificationMethodId"), id);
|
|
601
589
|
CLIDisplay.value(I18n.formatMessage("commands.verifiable-credential-create.labels.credentialId"), credentialId);
|
|
602
|
-
if (Is.arrayValue(types)) {
|
|
603
|
-
CLIDisplay.value(I18n.formatMessage("commands.verifiable-credential-create.labels.types"), types.join(","));
|
|
604
|
-
}
|
|
605
|
-
if (Is.arrayValue(contexts)) {
|
|
606
|
-
CLIDisplay.value(I18n.formatMessage("commands.verifiable-credential-create.labels.contexts"), contexts.join(","));
|
|
607
|
-
}
|
|
608
590
|
CLIDisplay.value(I18n.formatMessage("commands.verifiable-credential-create.labels.subjectJson"), subjectJson);
|
|
609
591
|
CLIDisplay.value(I18n.formatMessage("commands.verifiable-credential-create.labels.revocationIndex"), revocationIndex);
|
|
610
592
|
CLIDisplay.value(I18n.formatMessage("commands.common.labels.node"), nodeEndpoint);
|
|
@@ -639,7 +621,7 @@ async function actionCommandVerifiableCredentialCreate(opts) {
|
|
|
639
621
|
CLIDisplay.task(I18n.formatMessage("commands.verifiable-credential-create.progress.creatingVerifiableCredential"));
|
|
640
622
|
CLIDisplay.break();
|
|
641
623
|
CLIDisplay.spinnerStart();
|
|
642
|
-
const verifiableCredential = await iotaIdentityConnector.createVerifiableCredential(localIdentity, id, credentialId,
|
|
624
|
+
const verifiableCredential = await iotaIdentityConnector.createVerifiableCredential(localIdentity, id, credentialId, jsonData, revocationIndex);
|
|
643
625
|
CLIDisplay.spinnerStop();
|
|
644
626
|
if (opts.console) {
|
|
645
627
|
CLIDisplay.section(I18n.formatMessage("commands.verifiable-credential-create.labels.verifiableCredential"));
|
package/dist/locales/en.json
CHANGED
|
@@ -389,17 +389,9 @@
|
|
|
389
389
|
"param": "--credential-id '<'credential-id'>'",
|
|
390
390
|
"description": "The credential id which uniquely identifies the credential."
|
|
391
391
|
},
|
|
392
|
-
"types": {
|
|
393
|
-
"param": "--types [types...]",
|
|
394
|
-
"description": "The list of types to include in the verifiable credential."
|
|
395
|
-
},
|
|
396
392
|
"subject-json": {
|
|
397
393
|
"param": "--subject-json '<'subject-json'>'",
|
|
398
|
-
"description": "A JSON file to read which includes the data for the verifiable credential."
|
|
399
|
-
},
|
|
400
|
-
"contexts": {
|
|
401
|
-
"param": "--contexts [contexts...]",
|
|
402
|
-
"description": "The list of contexts to include in the verifiable credential."
|
|
394
|
+
"description": "A JSON-LD file to read which includes the data for the verifiable credential."
|
|
403
395
|
},
|
|
404
396
|
"revocation-index": {
|
|
405
397
|
"param": "--revocation-index '<'revocation-index'>'",
|
|
@@ -413,8 +405,6 @@
|
|
|
413
405
|
"labels": {
|
|
414
406
|
"verificationMethodId": "Verification Method Id",
|
|
415
407
|
"credentialId": "Credential Id",
|
|
416
|
-
"types": "Types",
|
|
417
|
-
"contexts": "Contexts",
|
|
418
408
|
"subjectJson": "Subject JSON",
|
|
419
409
|
"revocationIndex": "Revocation Index",
|
|
420
410
|
"verifiableCredential": "Verifiable Credential"
|
|
@@ -768,6 +758,14 @@
|
|
|
768
758
|
}
|
|
769
759
|
}
|
|
770
760
|
},
|
|
761
|
+
"jsonLdProcessor": {
|
|
762
|
+
"compact": "The JSON-LD compaction failed",
|
|
763
|
+
"expand": "The JSON-LD expansion failed",
|
|
764
|
+
"invalidUrl": "The JSON-LD processing failed to retrieve from the following url \"{url}\""
|
|
765
|
+
},
|
|
766
|
+
"errorMessages": {
|
|
767
|
+
"fetch": "Fetch"
|
|
768
|
+
},
|
|
771
769
|
"identityRole": {
|
|
772
770
|
"organization": "Organization",
|
|
773
771
|
"user": "User",
|
|
@@ -778,13 +776,5 @@
|
|
|
778
776
|
"rejected": "Rejected",
|
|
779
777
|
"issued": "Issued",
|
|
780
778
|
"revoked": "Revoked"
|
|
781
|
-
},
|
|
782
|
-
"errorMessages": {
|
|
783
|
-
"fetch": "Fetch"
|
|
784
|
-
},
|
|
785
|
-
"jsonLdProcessor": {
|
|
786
|
-
"compact": "The JSON-LD compaction failed",
|
|
787
|
-
"expand": "The JSON-LD expansion failed",
|
|
788
|
-
"invalidUrl": "The JSON-LD processing failed to retrieve from the following url \"{url}\""
|
|
789
779
|
}
|
|
790
780
|
}
|
|
@@ -11,9 +11,7 @@ export declare function buildCommandVerifiableCredentialCreate(): Command;
|
|
|
11
11
|
* @param opts.id The id of the verification method to use for the credential.
|
|
12
12
|
* @param opts.privateKey The private key for the verification method.
|
|
13
13
|
* @param opts.credentialId The id of the credential.
|
|
14
|
-
* @param opts.types The types for the credential.
|
|
15
14
|
* @param opts.subjectJson The JSON data for the subject.
|
|
16
|
-
* @param opts.contexts The contexts for the credential.
|
|
17
15
|
* @param opts.revocationIndex The revocation index for the credential.
|
|
18
16
|
* @param opts.node The node URL.
|
|
19
17
|
*/
|
|
@@ -21,9 +19,7 @@ export declare function actionCommandVerifiableCredentialCreate(opts: {
|
|
|
21
19
|
id: string;
|
|
22
20
|
privateKey: string;
|
|
23
21
|
credentialId?: string;
|
|
24
|
-
types?: string[];
|
|
25
22
|
subjectJson: string;
|
|
26
|
-
contexts?: string[];
|
|
27
23
|
revocationIndex?: string;
|
|
28
24
|
node: string;
|
|
29
25
|
} & CliOutputOptions): Promise<void>;
|
package/docs/changelog.md
CHANGED
package/locales/en.json
CHANGED
|
@@ -164,17 +164,9 @@
|
|
|
164
164
|
"param": "--credential-id '<'credential-id'>'",
|
|
165
165
|
"description": "The credential id which uniquely identifies the credential."
|
|
166
166
|
},
|
|
167
|
-
"types": {
|
|
168
|
-
"param": "--types [types...]",
|
|
169
|
-
"description": "The list of types to include in the verifiable credential."
|
|
170
|
-
},
|
|
171
167
|
"subject-json": {
|
|
172
168
|
"param": "--subject-json '<'subject-json'>'",
|
|
173
|
-
"description": "A JSON file to read which includes the data for the verifiable credential."
|
|
174
|
-
},
|
|
175
|
-
"contexts": {
|
|
176
|
-
"param": "--contexts [contexts...]",
|
|
177
|
-
"description": "The list of contexts to include in the verifiable credential."
|
|
169
|
+
"description": "A JSON-LD file to read which includes the data for the verifiable credential."
|
|
178
170
|
},
|
|
179
171
|
"revocation-index": {
|
|
180
172
|
"param": "--revocation-index '<'revocation-index'>'",
|
|
@@ -188,8 +180,6 @@
|
|
|
188
180
|
"labels": {
|
|
189
181
|
"verificationMethodId": "Verification Method Id",
|
|
190
182
|
"credentialId": "Credential Id",
|
|
191
|
-
"types": "Types",
|
|
192
|
-
"contexts": "Contexts",
|
|
193
183
|
"subjectJson": "Subject JSON",
|
|
194
184
|
"revocationIndex": "Revocation Index",
|
|
195
185
|
"verifiableCredential": "Verifiable Credential"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/identity-cli",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.6",
|
|
4
4
|
"description": "A command line interface for interacting with the identity connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/crypto": "next",
|
|
21
21
|
"@twin.org/crypto-cli": "next",
|
|
22
|
+
"@twin.org/data-json-ld": "next",
|
|
22
23
|
"@twin.org/entity": "next",
|
|
23
24
|
"@twin.org/entity-storage-connector-memory": "next",
|
|
24
|
-
"@twin.org/identity-connector-iota": "0.0.1-next.
|
|
25
|
-
"@twin.org/identity-models": "0.0.1-next.
|
|
25
|
+
"@twin.org/identity-connector-iota": "0.0.1-next.6",
|
|
26
|
+
"@twin.org/identity-models": "0.0.1-next.6",
|
|
26
27
|
"@twin.org/nameof": "next",
|
|
27
28
|
"@twin.org/standards-w3c-did": "next",
|
|
28
29
|
"@twin.org/vault-connector-entity-storage": "next",
|