@twin.org/identity-cli 0.0.1-next.3
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/LICENSE +201 -0
- package/README.md +21 -0
- package/bin/index.js +10 -0
- package/dist/cjs/index.cjs +1137 -0
- package/dist/esm/index.mjs +1110 -0
- package/dist/locales/en.json +784 -0
- package/dist/types/cli.d.ts +13 -0
- package/dist/types/commands/identityCreate.d.ts +19 -0
- package/dist/types/commands/identityResolve.d.ts +19 -0
- package/dist/types/commands/proofCreate.d.ts +21 -0
- package/dist/types/commands/proofVerify.d.ts +23 -0
- package/dist/types/commands/serviceAdd.d.ts +27 -0
- package/dist/types/commands/serviceRemove.d.ts +20 -0
- package/dist/types/commands/setupCommands.d.ts +4 -0
- package/dist/types/commands/verifiableCredentialCreate.d.ts +29 -0
- package/dist/types/commands/verifiableCredentialRevoke.d.ts +20 -0
- package/dist/types/commands/verifiableCredentialUnrevoke.d.ts +20 -0
- package/dist/types/commands/verifiableCredentialVerify.d.ts +17 -0
- package/dist/types/commands/verificationMethodAdd.d.ts +26 -0
- package/dist/types/commands/verificationMethodRemove.d.ts +20 -0
- package/dist/types/index.d.ts +13 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +210 -0
- package/docs/reference/classes/CLI.md +45 -0
- package/docs/reference/functions/actionCommandIdentityCreate.md +15 -0
- package/docs/reference/functions/actionCommandIdentityResolve.md +15 -0
- package/docs/reference/functions/actionCommandProofCreate.md +15 -0
- package/docs/reference/functions/actionCommandProofVerify.md +15 -0
- package/docs/reference/functions/actionCommandServiceAdd.md +15 -0
- package/docs/reference/functions/actionCommandServiceRemove.md +31 -0
- package/docs/reference/functions/actionCommandVerifiableCredentialCreate.md +15 -0
- package/docs/reference/functions/actionCommandVerifiableCredentialRevoke.md +31 -0
- package/docs/reference/functions/actionCommandVerifiableCredentialUnrevoke.md +31 -0
- package/docs/reference/functions/actionCommandVerifiableCredentialVerify.md +15 -0
- package/docs/reference/functions/actionCommandVerificationMethodAdd.md +15 -0
- package/docs/reference/functions/actionCommandVerificationMethodRemove.md +31 -0
- package/docs/reference/functions/buildCommandIdentityCreate.md +11 -0
- package/docs/reference/functions/buildCommandIdentityResolve.md +11 -0
- package/docs/reference/functions/buildCommandProofCreate.md +11 -0
- package/docs/reference/functions/buildCommandProofVerify.md +11 -0
- package/docs/reference/functions/buildCommandServiceAdd.md +11 -0
- package/docs/reference/functions/buildCommandServiceRemove.md +11 -0
- package/docs/reference/functions/buildCommandVerifiableCredentialCreate.md +11 -0
- package/docs/reference/functions/buildCommandVerifiableCredentialRevoke.md +11 -0
- package/docs/reference/functions/buildCommandVerifiableCredentialUnrevoke.md +11 -0
- package/docs/reference/functions/buildCommandVerifiableCredentialVerify.md +11 -0
- package/docs/reference/functions/buildCommandVerificationMethodAdd.md +11 -0
- package/docs/reference/functions/buildCommandVerificationMethodRemove.md +11 -0
- package/docs/reference/index.md +32 -0
- package/locales/en.json +336 -0
- package/package.json +86 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CLIBase } from "@twin.org/cli-core";
|
|
2
|
+
/**
|
|
3
|
+
* The main entry point for the CLI.
|
|
4
|
+
*/
|
|
5
|
+
export declare class CLI extends CLIBase {
|
|
6
|
+
/**
|
|
7
|
+
* Run the app.
|
|
8
|
+
* @param argv The process arguments.
|
|
9
|
+
* @param localesDirectory The directory for the locales, default to relative to the script.
|
|
10
|
+
* @returns The exit code.
|
|
11
|
+
*/
|
|
12
|
+
run(argv: string[], localesDirectory?: string): Promise<number>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* Build the identity create command for the CLI.
|
|
5
|
+
* @returns The command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCommandIdentityCreate(): Command;
|
|
8
|
+
/**
|
|
9
|
+
* Action the identity create command.
|
|
10
|
+
* @param opts The options for the command.
|
|
11
|
+
* @param opts.seed The private key for the controller.
|
|
12
|
+
* @param opts.node The node URL.
|
|
13
|
+
* @param opts.explorer The explorer URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare function actionCommandIdentityCreate(opts: {
|
|
16
|
+
seed: string;
|
|
17
|
+
node: string;
|
|
18
|
+
explorer: string;
|
|
19
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* Build the identity resolve command for the CLI.
|
|
5
|
+
* @returns The command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCommandIdentityResolve(): Command;
|
|
8
|
+
/**
|
|
9
|
+
* Action the identity resolve command.
|
|
10
|
+
* @param opts The options for the command.
|
|
11
|
+
* @param opts.did The identity to resolve.
|
|
12
|
+
* @param opts.node The node URL.
|
|
13
|
+
* @param opts.explorer The explorer URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare function actionCommandIdentityResolve(opts: {
|
|
16
|
+
did: string;
|
|
17
|
+
node: string;
|
|
18
|
+
explorer: string;
|
|
19
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* Build the proof create command for the CLI.
|
|
5
|
+
* @returns The command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCommandProofCreate(): Command;
|
|
8
|
+
/**
|
|
9
|
+
* Action the proof create command.
|
|
10
|
+
* @param opts The options for the command.
|
|
11
|
+
* @param opts.id The id of the verification method to use for the credential.
|
|
12
|
+
* @param opts.privateKey The private key for the verification method.
|
|
13
|
+
* @param opts.data The data to create the proof for.
|
|
14
|
+
* @param opts.node The node URL.
|
|
15
|
+
*/
|
|
16
|
+
export declare function actionCommandProofCreate(opts: {
|
|
17
|
+
id: string;
|
|
18
|
+
privateKey: string;
|
|
19
|
+
data: string;
|
|
20
|
+
node: string;
|
|
21
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* Build the proof verify command for the CLI.
|
|
5
|
+
* @returns The command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCommandProofVerify(): Command;
|
|
8
|
+
/**
|
|
9
|
+
* Action the proof verify command.
|
|
10
|
+
* @param opts The options for the command.
|
|
11
|
+
* @param opts.id The id of the verification method to use for the credential.
|
|
12
|
+
* @param opts.data The data to verify the proof for.
|
|
13
|
+
* @param opts.type The type of the proof.
|
|
14
|
+
* @param opts.value The proof value.
|
|
15
|
+
* @param opts.node The node URL.
|
|
16
|
+
*/
|
|
17
|
+
export declare function actionCommandProofVerify(opts: {
|
|
18
|
+
id: string;
|
|
19
|
+
data: string;
|
|
20
|
+
type: string;
|
|
21
|
+
value: string;
|
|
22
|
+
node: string;
|
|
23
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* Build the service add command for the CLI.
|
|
5
|
+
* @returns The command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCommandServiceAdd(): Command;
|
|
8
|
+
/**
|
|
9
|
+
* Action the service add command.
|
|
10
|
+
* @param opts The options for the command.
|
|
11
|
+
* @param opts.seed The private key for the controller.
|
|
12
|
+
* @param opts.did The identity of the document to add to.
|
|
13
|
+
* @param opts.id The id of the service to add.
|
|
14
|
+
* @param opts.type The type of the service to add.
|
|
15
|
+
* @param opts.endpoint The service endpoint.
|
|
16
|
+
* @param opts.node The node URL.
|
|
17
|
+
* @param opts.explorer The explorer URL.
|
|
18
|
+
*/
|
|
19
|
+
export declare function actionCommandServiceAdd(opts: {
|
|
20
|
+
seed: string;
|
|
21
|
+
did: string;
|
|
22
|
+
id: string;
|
|
23
|
+
type: string;
|
|
24
|
+
endpoint: string;
|
|
25
|
+
node: string;
|
|
26
|
+
explorer: string;
|
|
27
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Build the service remove command for the CLI.
|
|
4
|
+
* @returns The command.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildCommandServiceRemove(): Command;
|
|
7
|
+
/**
|
|
8
|
+
* Action the service remove command.
|
|
9
|
+
* @param opts The options for the command.
|
|
10
|
+
* @param opts.seed The private key for the controller.
|
|
11
|
+
* @param opts.id The id of the service to remove.
|
|
12
|
+
* @param opts.node The node URL.
|
|
13
|
+
* @param opts.explorer The explorer URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare function actionCommandServiceRemove(opts: {
|
|
16
|
+
seed: string;
|
|
17
|
+
id: string;
|
|
18
|
+
node: string;
|
|
19
|
+
explorer: string;
|
|
20
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* Build the verifiable credential create command for the CLI.
|
|
5
|
+
* @returns The command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCommandVerifiableCredentialCreate(): Command;
|
|
8
|
+
/**
|
|
9
|
+
* Action the verifiable credential create command.
|
|
10
|
+
* @param opts The options for the command.
|
|
11
|
+
* @param opts.id The id of the verification method to use for the credential.
|
|
12
|
+
* @param opts.privateKey The private key for the verification method.
|
|
13
|
+
* @param opts.credentialId The id of the credential.
|
|
14
|
+
* @param opts.types The types for the credential.
|
|
15
|
+
* @param opts.subjectJson The JSON data for the subject.
|
|
16
|
+
* @param opts.contexts The contexts for the credential.
|
|
17
|
+
* @param opts.revocationIndex The revocation index for the credential.
|
|
18
|
+
* @param opts.node The node URL.
|
|
19
|
+
*/
|
|
20
|
+
export declare function actionCommandVerifiableCredentialCreate(opts: {
|
|
21
|
+
id: string;
|
|
22
|
+
privateKey: string;
|
|
23
|
+
credentialId?: string;
|
|
24
|
+
types?: string[];
|
|
25
|
+
subjectJson: string;
|
|
26
|
+
contexts?: string[];
|
|
27
|
+
revocationIndex?: string;
|
|
28
|
+
node: string;
|
|
29
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Build the verifiable credential revoke command for the CLI.
|
|
4
|
+
* @returns The command.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildCommandVerifiableCredentialRevoke(): Command;
|
|
7
|
+
/**
|
|
8
|
+
* Action the verifiable credential revoke command.
|
|
9
|
+
* @param opts The options for the command.
|
|
10
|
+
* @param opts.seed The seed to generate the private key for the controller.
|
|
11
|
+
* @param opts.did The id of the document to revoke the index.
|
|
12
|
+
* @param opts.revocationIndex The revocation index for the credential.
|
|
13
|
+
* @param opts.node The node URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare function actionCommandVerifiableCredentialRevoke(opts: {
|
|
16
|
+
seed: string;
|
|
17
|
+
did: string;
|
|
18
|
+
revocationIndex: string;
|
|
19
|
+
node: string;
|
|
20
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Build the verifiable credential unrevoke command for the CLI.
|
|
4
|
+
* @returns The command.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildCommandVerifiableCredentialUnrevoke(): Command;
|
|
7
|
+
/**
|
|
8
|
+
* Action the verifiable credential unrevoke command.
|
|
9
|
+
* @param opts The options for the command.
|
|
10
|
+
* @param opts.seed The seed to generate the private key for the controller.
|
|
11
|
+
* @param opts.did The id of the document to unrevoke the index.
|
|
12
|
+
* @param opts.revocationIndex The revocation index for the credential.
|
|
13
|
+
* @param opts.node The node URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare function actionCommandVerifiableCredentialUnrevoke(opts: {
|
|
16
|
+
seed: string;
|
|
17
|
+
did: string;
|
|
18
|
+
revocationIndex: string;
|
|
19
|
+
node: string;
|
|
20
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* Build the verifiable credential verify command for the CLI.
|
|
5
|
+
* @returns The command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCommandVerifiableCredentialVerify(): Command;
|
|
8
|
+
/**
|
|
9
|
+
* Action the verifiable credential verify command.
|
|
10
|
+
* @param opts The options for the command.
|
|
11
|
+
* @param opts.jwt The JSON web token for the verifiable credential.
|
|
12
|
+
* @param opts.node The node URL.
|
|
13
|
+
*/
|
|
14
|
+
export declare function actionCommandVerifiableCredentialVerify(opts: {
|
|
15
|
+
jwt: string;
|
|
16
|
+
node: string;
|
|
17
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CliOutputOptions } from "@twin.org/cli-core";
|
|
2
|
+
import { DidVerificationMethodType } from "@twin.org/standards-w3c-did";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
/**
|
|
5
|
+
* Build the verification method add command for the CLI.
|
|
6
|
+
* @returns The command.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildCommandVerificationMethodAdd(): Command;
|
|
9
|
+
/**
|
|
10
|
+
* Action the verification method add command.
|
|
11
|
+
* @param opts The options for the command.
|
|
12
|
+
* @param opts.seed The private key for the controller.
|
|
13
|
+
* @param opts.did The identity of the document to add to.
|
|
14
|
+
* @param opts.type The type of the verification method to add.
|
|
15
|
+
* @param opts.id The id of the verification method to add.
|
|
16
|
+
* @param opts.node The node URL.
|
|
17
|
+
* @param opts.explorer The explorer URL.
|
|
18
|
+
*/
|
|
19
|
+
export declare function actionCommandVerificationMethodAdd(opts: {
|
|
20
|
+
seed: string;
|
|
21
|
+
did: string;
|
|
22
|
+
type: DidVerificationMethodType;
|
|
23
|
+
id?: string;
|
|
24
|
+
node: string;
|
|
25
|
+
explorer: string;
|
|
26
|
+
} & CliOutputOptions): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Build the verification method remove command for the CLI.
|
|
4
|
+
* @returns The command.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildCommandVerificationMethodRemove(): Command;
|
|
7
|
+
/**
|
|
8
|
+
* Action the verification method remove command.
|
|
9
|
+
* @param opts The options for the command.
|
|
10
|
+
* @param opts.seed The private key for the controller.
|
|
11
|
+
* @param opts.id The id of the verification method to remove.
|
|
12
|
+
* @param opts.node The node URL.
|
|
13
|
+
* @param opts.explorer The explorer URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare function actionCommandVerificationMethodRemove(opts: {
|
|
16
|
+
seed: string;
|
|
17
|
+
id: string;
|
|
18
|
+
node: string;
|
|
19
|
+
explorer: string;
|
|
20
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./cli";
|
|
2
|
+
export * from "./commands/identityCreate";
|
|
3
|
+
export * from "./commands/identityResolve";
|
|
4
|
+
export * from "./commands/proofCreate";
|
|
5
|
+
export * from "./commands/proofVerify";
|
|
6
|
+
export * from "./commands/serviceAdd";
|
|
7
|
+
export * from "./commands/serviceRemove";
|
|
8
|
+
export * from "./commands/verifiableCredentialCreate";
|
|
9
|
+
export * from "./commands/verifiableCredentialRevoke";
|
|
10
|
+
export * from "./commands/verifiableCredentialUnrevoke";
|
|
11
|
+
export * from "./commands/verifiableCredentialVerify";
|
|
12
|
+
export * from "./commands/verificationMethodAdd";
|
|
13
|
+
export * from "./commands/verificationMethodRemove";
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# @twin.org/identity-cli - Examples
|
|
2
|
+
|
|
3
|
+
## Command Line Tool
|
|
4
|
+
|
|
5
|
+
First install the tool with the following script.
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm install @twin.org/identity-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Running the tool with no commands will provide help for all the commands. By issuing the following command you should see the result.
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
twin-identity
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Output
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
🌍 TWIN Identity v1.0.0
|
|
21
|
+
|
|
22
|
+
Usage: twin-identity [command]
|
|
23
|
+
|
|
24
|
+
Options:
|
|
25
|
+
-V, --version output the version number
|
|
26
|
+
--lang <lang> The language to display the output in. (default: "en")
|
|
27
|
+
--load-env [env...] Load the env files to initialise any environment variables.
|
|
28
|
+
-h, --help display help for command
|
|
29
|
+
|
|
30
|
+
Commands:
|
|
31
|
+
mnemonic [options] Create a mnemonic.
|
|
32
|
+
address [options] Create bech32 addresses and keys from the seed.
|
|
33
|
+
faucet [options] Request funds from the faucet.
|
|
34
|
+
transfer [options] Transfer funds from one address to another.
|
|
35
|
+
identity-create [options] Create a Decentralized Identifier (DID).
|
|
36
|
+
identity-resolve [options] Resolve a Decentralized Identifier (DID).
|
|
37
|
+
verification-method-add [options] Add a verification method to a DID.
|
|
38
|
+
verification-method-remove [options] Remove a verification method from a DID.
|
|
39
|
+
service-add [options] Add a service to a DID.
|
|
40
|
+
service-remove [options] Remove a service from a DID.
|
|
41
|
+
verifiable-credential-create [options] Create a verifiable credential.
|
|
42
|
+
verifiable-credential-verify [options] Verify a verifiable credential.
|
|
43
|
+
verifiable-credential-revoke [options] Revoke a verifiable credential.
|
|
44
|
+
verifiable-credential-unrevoke [options] Unrevoke a verifiable credential.
|
|
45
|
+
proof-create [options] Create a proof for some data using a verification method.
|
|
46
|
+
proof-verify [options] Verify a proof for some data using a verification method.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
You can get further detail on the sub commands by using the help option for the individual commands.
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
twin-identity identity-create --help
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Output
|
|
56
|
+
|
|
57
|
+
```shell
|
|
58
|
+
🌍 TWIN Identity v1.0.0
|
|
59
|
+
|
|
60
|
+
Usage: twin-identity identity-create [options]
|
|
61
|
+
|
|
62
|
+
Creates a Decentralized Identifier (DID).
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
--seed <seed> The seed for the controller address in hex or base64 used to create the DID, or start with ! to read environment variable.
|
|
66
|
+
--controller <controller> The address which controls the identity in bech32 format, or start with ! to read environment variable.
|
|
67
|
+
--no-console Hides the output in the console.
|
|
68
|
+
--json <filename> Creates a JSON file containing the output.
|
|
69
|
+
--merge-json If the JSON file already exists merge the data instead of overwriting.
|
|
70
|
+
--env <filename> Creates an env file containing the output.
|
|
71
|
+
--merge-env If the env file already exists merge the data instead of overwriting.
|
|
72
|
+
--node <url> The url for the node endpoint, or an environment variable name containing the url. (default: "!NODE_URL")
|
|
73
|
+
--explorer <url> The url for the explorer endpoint, or an environment variable name containing the url. (default: "!EXPLORER_URL")
|
|
74
|
+
-h, --help display help for command
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The commands `mnemonic`, `address`, `faucet` and `transfer` are described in more detail in the examples for `crypto-cli` and `wallet-cli`.
|
|
78
|
+
|
|
79
|
+
## Command
|
|
80
|
+
|
|
81
|
+
### identity-create
|
|
82
|
+
|
|
83
|
+
Use this command to create a new DID, the controller address must have sufficient funds to store the identity. The seed and the funds can be generated using the `mnemonic` and `faucet` commands.
|
|
84
|
+
|
|
85
|
+
```shell
|
|
86
|
+
# Generate a seed and mnemonic and store it in the env file
|
|
87
|
+
twin-identity mnemonic --env wallet.env
|
|
88
|
+
# Generate an address and store it in the env file
|
|
89
|
+
twin-identity address --load-env wallet.env --hrp tst --seed !SEED --count 4 --env wallet.env --merge-env
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
To run this on the IOTA testnet you will need an env file with the following settings. Store the following config as config.env
|
|
93
|
+
|
|
94
|
+
```shell
|
|
95
|
+
NODE_URL="https://api.testnet.iotaledger.net"
|
|
96
|
+
FAUCET_URL="https://faucet.testnet.iotaledger.net/api/enqueue"
|
|
97
|
+
EXPLORER_URL="https://explorer.iota.org/iota-testnet/"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
To then request some funds and generate the identity you can issue the following commands:
|
|
101
|
+
|
|
102
|
+
```shell
|
|
103
|
+
# Fund the controller address from the faucet loading the config and wallet env files
|
|
104
|
+
twin-identity faucet --load-env config.env wallet.env --address !ADDRESS_0_BECH32
|
|
105
|
+
# Create an identity
|
|
106
|
+
twin-identity identity-create --load-env config.env wallet.env --seed !SEED --controller !ADDRESS_0_BECH32 --env identity.env
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### identity-resolve
|
|
110
|
+
|
|
111
|
+
The identity resolve will lookup and identity by DID to check it exists and return the DID document.
|
|
112
|
+
|
|
113
|
+
```shell
|
|
114
|
+
twin-identity identity-resolve --load-env config.env identity.env --did !DID --json did-document.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### verification-method-add
|
|
118
|
+
|
|
119
|
+
This command will add a verification method to a DID document.
|
|
120
|
+
|
|
121
|
+
```shell
|
|
122
|
+
twin-identity verification-method-add --load-env config.env wallet.env identity.env --seed !SEED --did !DID --type verificationMethod --env verification-method.env
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### verification-method-remove
|
|
126
|
+
|
|
127
|
+
This command will remove a verification method from a DID document.
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
twin-identity verification-method-remove --load-env config.env wallet.env identity.env verification-method.env --seed !SEED --id !DID_VERIFICATION_METHOD_ID
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### service-add
|
|
134
|
+
|
|
135
|
+
This command will add a service to a DID document.
|
|
136
|
+
|
|
137
|
+
```shell
|
|
138
|
+
twin-identity service-add --load-env config.env wallet.env identity.env --seed !SEED --did !DID --id linked-domain --type LinkedDomains --endpoint https://www.twindev.org --env service.env
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### service-remove
|
|
142
|
+
|
|
143
|
+
This command will remove a service from the DID document.
|
|
144
|
+
|
|
145
|
+
```shell
|
|
146
|
+
twin-identity service-remove --load-env config.env wallet.env identity.env service.env --seed !SEED --did !DID --id !DID_SERVICE_ID
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## verifiable-credential-create
|
|
150
|
+
|
|
151
|
+
This command will generate a verifiable credential using the specified verification method. You will need to supply the data as a json file
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"name": "Alice",
|
|
156
|
+
"degreeName": "Bachelor of Science and Arts"
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```shell
|
|
161
|
+
twin-identity verifiable-credential-create --load-env config.env verification-method.env --id !DID_VERIFICATION_METHOD_ID --private-key !DID_VERIFICATION_METHOD_PRIVATE_KEY --credential-id https://example.edu/credentials/3732 --types UniversityDegreeCredential --subject-json subject.json --env vc.env --revocation-index 0
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
This will output the verifiable credential as a JSON Web Token e.g.
|
|
165
|
+
|
|
166
|
+
```shell
|
|
167
|
+
eyJraWQiOiJkaWQ6aW90YTp0c3Q6MHgxZTQ3YWQ0MjY4YWI5ZWNhNTFkYTkwNmRkNzE4MDIxZmJkNGYyZGUxYmU5NjA4NmRjMTMzZDQ0MmIwYjk3MzIyI2V5em9GMHFEUmtSQ0FlU1Rmdjd6WWFQNU00U2c2TkJLQUZ6eElhQVBTQzAiLCJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJpc3MiOiJkaWQ6aW90YTp0c3Q6MHgxZTQ3YWQ0MjY4YWI5ZWNhNTFkYTkwNmRkNzE4MDIxZmJkNGYyZGUxYmU5NjA4NmRjMTMzZDQ0MmIwYjk3MzIyIiwibmJmIjoxNzE4MTk3NDA5LCJqdGkiOiJodHRwczovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIiLCJ2YyI6eyJAY29udGV4dCI6Imh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL3YxIiwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlVuaXZlcnNpdHlEZWdyZWVDcmVkZW50aWFsIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImRlZ3JlZU5hbWUiOiJCYWNoZWxvciBvZiBTY2llbmNlIGFuZCBBcnRzIiwibmFtZSI6IkFsaWNlIn0sImNyZWRlbnRpYWxTdGF0dXMiOnsiaWQiOiJkaWQ6aW90YTp0c3Q6MHgxZTQ3YWQ0MjY4YWI5ZWNhNTFkYTkwNmRkNzE4MDIxZmJkNGYyZGUxYmU5NjA4NmRjMTMzZDQ0MmIwYjk3MzIyI3Jldm9jYXRpb24iLCJ0eXBlIjoiUmV2b2NhdGlvbkJpdG1hcDIwMjIiLCJyZXZvY2F0aW9uQml0bWFwSW5kZXgiOiIwIn19fQ.O3tMQ1UdGSI2qv9ia3xiT1yTmvpnJKd749POMSy42-SWTWN99HyYr5SEVIDj5cLdCORRP3Se4O7wxPe7_tfmCw
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## verifiable-credential-verify
|
|
171
|
+
|
|
172
|
+
You can verify a verifiable credential stored as a JWT using this command.
|
|
173
|
+
|
|
174
|
+
```shell
|
|
175
|
+
twin-identity verifiable-credential-verify --load-env config.env vc.env --jwt !DID_VERIFIABLE_CREDENTIAL_JWT
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## verifiable-credential-revoke
|
|
179
|
+
|
|
180
|
+
You can revoke a verifiable credential by revoking the index on the generating document.
|
|
181
|
+
|
|
182
|
+
```shell
|
|
183
|
+
twin-identity verifiable-credential-revoke --load-env config.env wallet.env identity.env --seed !SEED --did !DID --revocation-index 5
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## verifiable-credential-unrevoke
|
|
187
|
+
|
|
188
|
+
You can unrevoke a verifiable credential by revoking the index on the generating document.
|
|
189
|
+
|
|
190
|
+
```shell
|
|
191
|
+
twin-identity verifiable-credential-unrevoke --load-env config.env wallet.env identity.env --seed !SEED --did !DID --revocation-index 5
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## proof-create
|
|
195
|
+
|
|
196
|
+
This command will generate a proof using the specified verification method.
|
|
197
|
+
|
|
198
|
+
```shell
|
|
199
|
+
twin-identity proof-create --load-env config.env verification-method.env --id !DID_VERIFICATION_METHOD_ID --private-key !DID_VERIFICATION_METHOD_PRIVATE_KEY --data aGVsbG8gd29ybGQ=
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
This will output the proof as a set of data containing the type and a value in base64.
|
|
203
|
+
|
|
204
|
+
## proof-verify
|
|
205
|
+
|
|
206
|
+
This command will verify a proof using the specified verification method.
|
|
207
|
+
|
|
208
|
+
```shell
|
|
209
|
+
twin-identity proof-verify --load-env config.env verification-method.env --id !DID_VERIFICATION_METHOD_ID --data aGVsbG8gd29ybGQ= --type Ed25519 --value lrPdZ+Gfgc8w/ha2YU7hil8s+gykFHAdmIEdJdraWeRkkb8nHHF1PLKs4gGPXCT1mqBIwiwOgz5V0JKIg00UDg==
|
|
210
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Class: CLI
|
|
2
|
+
|
|
3
|
+
The main entry point for the CLI.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `CLIBase`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### new CLI()
|
|
12
|
+
|
|
13
|
+
> **new CLI**(): [`CLI`](CLI.md)
|
|
14
|
+
|
|
15
|
+
#### Returns
|
|
16
|
+
|
|
17
|
+
[`CLI`](CLI.md)
|
|
18
|
+
|
|
19
|
+
#### Inherited from
|
|
20
|
+
|
|
21
|
+
`CLIBase.constructor`
|
|
22
|
+
|
|
23
|
+
## Methods
|
|
24
|
+
|
|
25
|
+
### run()
|
|
26
|
+
|
|
27
|
+
> **run**(`argv`, `localesDirectory`?): `Promise`\<`number`\>
|
|
28
|
+
|
|
29
|
+
Run the app.
|
|
30
|
+
|
|
31
|
+
#### Parameters
|
|
32
|
+
|
|
33
|
+
• **argv**: `string`[]
|
|
34
|
+
|
|
35
|
+
The process arguments.
|
|
36
|
+
|
|
37
|
+
• **localesDirectory?**: `string`
|
|
38
|
+
|
|
39
|
+
The directory for the locales, default to relative to the script.
|
|
40
|
+
|
|
41
|
+
#### Returns
|
|
42
|
+
|
|
43
|
+
`Promise`\<`number`\>
|
|
44
|
+
|
|
45
|
+
The exit code.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: actionCommandIdentityCreate()
|
|
2
|
+
|
|
3
|
+
> **actionCommandIdentityCreate**(`opts`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Action the identity create command.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
• **opts**: `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
|
|
10
|
+
|
|
11
|
+
The options for the command.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: actionCommandIdentityResolve()
|
|
2
|
+
|
|
3
|
+
> **actionCommandIdentityResolve**(`opts`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Action the identity resolve command.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
• **opts**: `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
|
|
10
|
+
|
|
11
|
+
The options for the command.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: actionCommandProofCreate()
|
|
2
|
+
|
|
3
|
+
> **actionCommandProofCreate**(`opts`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Action the proof create command.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
• **opts**: `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
|
|
10
|
+
|
|
11
|
+
The options for the command.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: actionCommandProofVerify()
|
|
2
|
+
|
|
3
|
+
> **actionCommandProofVerify**(`opts`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Action the proof verify command.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
• **opts**: `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
|
|
10
|
+
|
|
11
|
+
The options for the command.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Function: actionCommandServiceAdd()
|
|
2
|
+
|
|
3
|
+
> **actionCommandServiceAdd**(`opts`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Action the service add command.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
• **opts**: `object` & `ICliOutputOptionsConsole` & `ICliOutputOptionsEnv` & `ICliOutputOptionsJson`
|
|
10
|
+
|
|
11
|
+
The options for the command.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`Promise`\<`void`\>
|