@cef-ebsi/cli 1.3.2 → 1.5.0
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/bin/cli.js +1 -1
- package/dist/abi/pilot/DidRegistry.js +568 -0
- package/dist/abi/pilot/DidRegistry.js.map +1 -0
- package/dist/abi/{test/TirV4.js → pilot/Ptr.js} +255 -299
- package/dist/abi/pilot/Ptr.js.map +1 -0
- package/dist/abi/pilot/SchemaSCRegistry.js +264 -0
- package/dist/abi/pilot/SchemaSCRegistry.js.map +1 -0
- package/dist/abi/{test/TprV3.js → pilot/Tcr.js} +269 -261
- package/dist/abi/pilot/Tcr.js.map +1 -0
- package/dist/abi/pilot/Timestamp.js +658 -0
- package/dist/abi/pilot/Timestamp.js.map +1 -0
- package/dist/abi/pilot/Tir.js +428 -0
- package/dist/abi/pilot/Tir.js.map +1 -0
- package/dist/abi/pilot/TnT.js +842 -0
- package/dist/abi/pilot/TnT.js.map +1 -0
- package/dist/abi/pilot/Tpr.js +492 -0
- package/dist/abi/pilot/Tpr.js.map +1 -0
- package/dist/abi/test/DidRegistry.js +144 -658
- package/dist/abi/test/DidRegistry.js.map +1 -1
- package/dist/abi/{pilot/TirV4.js → test/Ptr.js} +255 -299
- package/dist/abi/test/Ptr.js.map +1 -0
- package/dist/abi/test/SchemaSCRegistry.js +122 -795
- package/dist/abi/test/SchemaSCRegistry.js.map +1 -1
- package/dist/abi/{pilot/TprV3.js → test/Tcr.js} +269 -261
- package/dist/abi/test/Tcr.js.map +1 -0
- package/dist/abi/test/Timestamp.js +239 -673
- package/dist/abi/test/Timestamp.js.map +1 -1
- package/dist/abi/test/Tir.js +167 -636
- package/dist/abi/test/Tir.js.map +1 -1
- package/dist/abi/test/TnT.js +842 -0
- package/dist/abi/test/TnT.js.map +1 -0
- package/dist/abi/test/Tpr.js +166 -942
- package/dist/abi/test/Tpr.js.map +1 -1
- package/dist/app.js +447 -443
- package/dist/app.js.map +1 -1
- package/dist/buildParam/{didV3.js → didr.js} +210 -204
- package/dist/buildParam/didr.js.map +1 -0
- package/dist/buildParam/index.js +42 -48
- package/dist/buildParam/index.js.map +1 -1
- package/dist/buildParam/ptr.js +80 -0
- package/dist/buildParam/ptr.js.map +1 -0
- package/dist/buildParam/tcr.js +36 -0
- package/dist/buildParam/tcr.js.map +1 -0
- package/dist/buildParam/{timestampV3.js → timestamp.js} +179 -136
- package/dist/buildParam/timestamp.js.map +1 -0
- package/dist/buildParam/{tirV3.js → tir.js} +67 -59
- package/dist/buildParam/tir.js.map +1 -0
- package/dist/buildParam/{tntV1.js → tnt.js} +90 -61
- package/dist/buildParam/tnt.js.map +1 -0
- package/dist/buildParam/{tprV2.js → tpr.js} +44 -33
- package/dist/buildParam/tpr.js.map +1 -0
- package/dist/buildParam/{tsrV2.js → tsr.js} +45 -40
- package/dist/buildParam/tsr.js.map +1 -0
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/{authorisation-v5.js → authorisation.js} +95 -72
- package/dist/commands/authorisation.js.map +1 -0
- package/dist/commands/compute.js +429 -389
- package/dist/commands/compute.js.map +1 -1
- package/dist/commands/{conformance-v3.js → conformance.js} +236 -248
- package/dist/commands/conformance.js.map +1 -0
- package/dist/commands/hardwarewallet.js +5 -5
- package/dist/commands/hardwarewallet.js.map +1 -1
- package/dist/commands/index.js +4 -4
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/{ledger-v4.js → ledger.js} +203 -127
- package/dist/commands/ledger.js.map +1 -0
- package/dist/commands/ptr.js +56 -0
- package/dist/commands/ptr.js.map +1 -0
- package/dist/commands/tcr.js +51 -0
- package/dist/commands/tcr.js.map +1 -0
- package/dist/commands/tnl.js +10 -9
- package/dist/commands/tnl.js.map +1 -1
- package/dist/commands/tsr.js +46 -0
- package/dist/commands/tsr.js.map +1 -0
- package/dist/commands/view.js +8 -8
- package/dist/commands/view.js.map +1 -1
- package/dist/config.js +311 -279
- package/dist/config.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.js +1 -1
- package/dist/interfaces/index.js.map +1 -1
- package/dist/programs/migrateDid.js +33 -33
- package/dist/programs/migrateDid.js.map +1 -1
- package/dist/programs/migrateDids.js +39 -42
- package/dist/programs/migrateDids.js.map +1 -1
- package/dist/programs/migrateTsr.js +153 -113
- package/dist/programs/migrateTsr.js.map +1 -1
- package/dist/scripts/accreditAndAuthorize/conformance/step1 +1 -1
- package/dist/scripts/accreditAndAuthorize/test/step1 +1 -1
- package/dist/scripts/accreditTI +1 -1
- package/dist/scripts/assets/CTRevocableCredential.json +1 -1
- package/dist/scripts/assets/CredentialToAttestVerifiableAuthorisationForTrustChain.json +2 -2
- package/dist/scripts/assets/TrustedNodesList.json +1 -1
- package/dist/scripts/assets/VerifiableAccreditationToAccredit.json +2 -2
- package/dist/scripts/assets/VerifiableAccreditationToAttest.json +2 -2
- package/dist/scripts/assets/VerifiableAuthorisationForTrustChain.json +1 -1
- package/dist/scripts/assets/VerifiableAuthorisationToInvoke.json +24 -0
- package/dist/scripts/assets/VerifiableAuthorisationToOnboard.json +1 -1
- package/dist/scripts/bootstrap/1-populateTPR +18 -15
- package/dist/scripts/bootstrap/6-setupConformanceIssuer +1 -1
- package/dist/scripts/issueVcInvoke +10 -0
- package/dist/scripts/issueVcOnboard +1 -1
- package/dist/scripts/issueVcRootTAO +1 -1
- package/dist/scripts/issueVcTAO +2 -2
- package/dist/scripts/issueVcTI +2 -2
- package/dist/scripts/issueVcTnl +1 -1
- package/dist/scripts/issue_CTRevocableCredential +1 -1
- package/dist/scripts/issue_SelfAttestationSupportOffice +2 -2
- package/dist/scripts/issue_VerifiableAccreditationToAccredit +2 -2
- package/dist/scripts/issue_VerifiableAccreditationToAttest +2 -2
- package/dist/scripts/issue_VerifiableAuthorisationForTrustChain +1 -1
- package/dist/scripts/issue_VerifiableAuthorisationToOnboard +1 -1
- package/dist/scripts/updateVcRootTAO +1 -1
- package/dist/scripts/updateVcTAO +2 -2
- package/dist/scripts/updateVcTI +2 -2
- package/dist/scripts/{wctv3 → wct}/accreditAndAuthorize +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/utils/Client.js +81 -68
- package/dist/utils/Client.js.map +1 -1
- package/dist/utils/HardwareWallet.js +169 -165
- package/dist/utils/HardwareWallet.js.map +1 -1
- package/dist/utils/http.js +24 -27
- package/dist/utils/http.js.map +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/jsonrpc.js +14 -14
- package/dist/utils/jsonrpc.js.map +1 -1
- package/dist/utils/print.js +19 -19
- package/dist/utils/print.js.map +1 -1
- package/dist/utils/utils.js +180 -173
- package/dist/utils/utils.js.map +1 -1
- package/package.json +70 -46
- package/dist/abi/pilot/DidRegistryV3.js +0 -1082
- package/dist/abi/pilot/DidRegistryV3.js.map +0 -1
- package/dist/abi/pilot/DidRegistryV4.js +0 -942
- package/dist/abi/pilot/DidRegistryV4.js.map +0 -1
- package/dist/abi/pilot/SchemaSCRegistryV2.js +0 -474
- package/dist/abi/pilot/SchemaSCRegistryV2.js.map +0 -1
- package/dist/abi/pilot/TimestampV2.js +0 -1128
- package/dist/abi/pilot/TimestampV2.js.map +0 -1
- package/dist/abi/pilot/TimestampV3.js +0 -995
- package/dist/abi/pilot/TimestampV3.js.map +0 -1
- package/dist/abi/pilot/TirV3.js +0 -496
- package/dist/abi/pilot/TirV3.js.map +0 -1
- package/dist/abi/pilot/TirV4.js.map +0 -1
- package/dist/abi/pilot/TnTV1.js +0 -1375
- package/dist/abi/pilot/TnTV1.js.map +0 -1
- package/dist/abi/pilot/TprV2.js +0 -889
- package/dist/abi/pilot/TprV2.js.map +0 -1
- package/dist/abi/pilot/TprV3.js.map +0 -1
- package/dist/abi/pilot/TsrV3.js +0 -571
- package/dist/abi/pilot/TsrV3.js.map +0 -1
- package/dist/abi/test/DidRegistryV3.js +0 -1089
- package/dist/abi/test/DidRegistryV3.js.map +0 -1
- package/dist/abi/test/DidRegistryV4.js +0 -960
- package/dist/abi/test/DidRegistryV4.js.map +0 -1
- package/dist/abi/test/SchemaSCRegistryV2.js +0 -474
- package/dist/abi/test/SchemaSCRegistryV2.js.map +0 -1
- package/dist/abi/test/TimestampV2.js +0 -1128
- package/dist/abi/test/TimestampV2.js.map +0 -1
- package/dist/abi/test/TimestampV3.js +0 -995
- package/dist/abi/test/TimestampV3.js.map +0 -1
- package/dist/abi/test/TirV3.js +0 -496
- package/dist/abi/test/TirV3.js.map +0 -1
- package/dist/abi/test/TirV4.js.map +0 -1
- package/dist/abi/test/TnTV1.js +0 -1375
- package/dist/abi/test/TnTV1.js.map +0 -1
- package/dist/abi/test/TprV2.js +0 -889
- package/dist/abi/test/TprV2.js.map +0 -1
- package/dist/abi/test/TprV3.js.map +0 -1
- package/dist/abi/test/TsrV3.js +0 -571
- package/dist/abi/test/TsrV3.js.map +0 -1
- package/dist/buildParam/didV3.js.map +0 -1
- package/dist/buildParam/didV4.js +0 -326
- package/dist/buildParam/didV4.js.map +0 -1
- package/dist/buildParam/timestampV2.js +0 -317
- package/dist/buildParam/timestampV2.js.map +0 -1
- package/dist/buildParam/timestampV3.js.map +0 -1
- package/dist/buildParam/tirV3.js.map +0 -1
- package/dist/buildParam/tirV4.js +0 -119
- package/dist/buildParam/tirV4.js.map +0 -1
- package/dist/buildParam/tntV1.js.map +0 -1
- package/dist/buildParam/tntV2.js +0 -185
- package/dist/buildParam/tntV2.js.map +0 -1
- package/dist/buildParam/tprV2.js.map +0 -1
- package/dist/buildParam/tprV3.js +0 -82
- package/dist/buildParam/tprV3.js.map +0 -1
- package/dist/buildParam/tsrV2.js.map +0 -1
- package/dist/buildParam/tsrV3.js +0 -110
- package/dist/buildParam/tsrV3.js.map +0 -1
- package/dist/commands/authorisation-v4.js +0 -119
- package/dist/commands/authorisation-v4.js.map +0 -1
- package/dist/commands/authorisation-v5.js.map +0 -1
- package/dist/commands/conformance-v3.js.map +0 -1
- package/dist/commands/ledger-v4.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/scripts/{wctv3 → wct}/holderWallet +0 -0
- /package/dist/scripts/{wctv3 → wct}/issueToHolder +0 -0
- /package/dist/scripts/{wctv3 → wct}/pda1 +0 -0
- /package/dist/scripts/{wctv3 → wct}/verifier +0 -0
package/dist/buildParam/didV4.js
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import Joi from "joi";
|
|
2
|
-
import { processInputPublicKey } from "./didV3.js";
|
|
3
|
-
export async function buildParamDidV4(method, client, inputs) {
|
|
4
|
-
switch (method) {
|
|
5
|
-
case "insertDidDocument": {
|
|
6
|
-
const [inputDid, inputBaseDocument, inputPublicKey, inputNotBefore, inputNotAfter, inputVMethodId,] = inputs;
|
|
7
|
-
Joi.assert(inputDid, Joi.string().optional());
|
|
8
|
-
Joi.assert(inputNotBefore, Joi.string().optional());
|
|
9
|
-
Joi.assert(inputNotAfter, Joi.string().optional());
|
|
10
|
-
Joi.assert(inputVMethodId, Joi.string().optional());
|
|
11
|
-
const did = inputDid || client.did;
|
|
12
|
-
let baseDocument;
|
|
13
|
-
let notBefore;
|
|
14
|
-
let notAfter;
|
|
15
|
-
if (inputBaseDocument) {
|
|
16
|
-
baseDocument = JSON.stringify(inputBaseDocument);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
const didDocument = client.generateDidDocument();
|
|
20
|
-
baseDocument = JSON.stringify({ "@context": didDocument["@context"] });
|
|
21
|
-
}
|
|
22
|
-
const { publicKey, vMethodId, isSecp256k1 } = await processInputPublicKey(client, inputPublicKey, inputVMethodId);
|
|
23
|
-
if (!isSecp256k1) {
|
|
24
|
-
throw new Error("the public key must be for secp256k1");
|
|
25
|
-
}
|
|
26
|
-
if (inputNotBefore) {
|
|
27
|
-
notBefore = Math.floor(new Date(inputNotBefore).getTime() / 1000);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
notBefore = Math.floor(Date.now() / 1000);
|
|
31
|
-
}
|
|
32
|
-
if (inputNotAfter) {
|
|
33
|
-
notAfter = Math.floor(new Date(inputNotAfter).getTime() / 1000);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
notAfter = notBefore + 84600 * 365 * 5;
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
info: {
|
|
40
|
-
title: "Did document",
|
|
41
|
-
data: did,
|
|
42
|
-
},
|
|
43
|
-
param: {
|
|
44
|
-
did,
|
|
45
|
-
baseDocument,
|
|
46
|
-
vMethodId,
|
|
47
|
-
publicKey,
|
|
48
|
-
isSecp256k1,
|
|
49
|
-
notBefore,
|
|
50
|
-
notAfter,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
case "updateBaseDocument": {
|
|
55
|
-
const [did, inputBaseDocument] = inputs;
|
|
56
|
-
Joi.assert(did, Joi.string());
|
|
57
|
-
let baseDocument;
|
|
58
|
-
if (inputBaseDocument) {
|
|
59
|
-
baseDocument = JSON.stringify(inputBaseDocument);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const didDocument = client.generateDidDocument();
|
|
63
|
-
baseDocument = JSON.stringify({ "@context": didDocument["@context"] });
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
info: {
|
|
67
|
-
title: "Update base document",
|
|
68
|
-
data: {
|
|
69
|
-
did,
|
|
70
|
-
baseDocument,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
param: {
|
|
74
|
-
did,
|
|
75
|
-
baseDocument,
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
case "addController": {
|
|
80
|
-
const [did, controller] = inputs;
|
|
81
|
-
Joi.assert(did, Joi.string());
|
|
82
|
-
Joi.assert(controller, Joi.string());
|
|
83
|
-
return {
|
|
84
|
-
info: {
|
|
85
|
-
title: "Add controller",
|
|
86
|
-
data: { did, controller },
|
|
87
|
-
},
|
|
88
|
-
param: {
|
|
89
|
-
did,
|
|
90
|
-
controller,
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
case "revokeController": {
|
|
95
|
-
const [did, controller] = inputs;
|
|
96
|
-
Joi.assert(did, Joi.string());
|
|
97
|
-
Joi.assert(controller, Joi.string());
|
|
98
|
-
return {
|
|
99
|
-
info: {
|
|
100
|
-
title: "Revoke controller",
|
|
101
|
-
data: { did, controller },
|
|
102
|
-
},
|
|
103
|
-
param: {
|
|
104
|
-
did,
|
|
105
|
-
controller,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
case "addVerificationMethod": {
|
|
110
|
-
const [did, inputPublicKeyOrAlg, inputVMethodId] = inputs;
|
|
111
|
-
Joi.assert(did, Joi.string());
|
|
112
|
-
Joi.assert(inputVMethodId, Joi.string().optional());
|
|
113
|
-
let inputPublicKey = inputPublicKeyOrAlg;
|
|
114
|
-
if (typeof inputPublicKeyOrAlg === "string" &&
|
|
115
|
-
["ES256K", "ES256", "RS256", "EdDSA"].includes(inputPublicKeyOrAlg)) {
|
|
116
|
-
const alg = inputPublicKeyOrAlg;
|
|
117
|
-
inputPublicKey = client.keys[alg].publicKeyJwk;
|
|
118
|
-
}
|
|
119
|
-
const { publicKey, vMethodId, isSecp256k1 } = await processInputPublicKey(client, inputPublicKey, inputVMethodId);
|
|
120
|
-
return {
|
|
121
|
-
info: {
|
|
122
|
-
title: "Add verification method",
|
|
123
|
-
data: {
|
|
124
|
-
did,
|
|
125
|
-
vMethodId,
|
|
126
|
-
publicKey,
|
|
127
|
-
isSecp256k1,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
param: {
|
|
131
|
-
did,
|
|
132
|
-
vMethodId,
|
|
133
|
-
publicKey,
|
|
134
|
-
isSecp256k1,
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
case "addVerificationRelationship": {
|
|
139
|
-
const [did, name, vMethodIdOrAlg, inputNotBefore, inputNotAfter] = inputs;
|
|
140
|
-
Joi.assert(did, Joi.string());
|
|
141
|
-
Joi.assert(name, Joi.string().valid("authentication", "assertionMethod", "keyAgreement", "capabilityInvocation", "capabilityDelegation"));
|
|
142
|
-
Joi.assert(vMethodIdOrAlg, Joi.string());
|
|
143
|
-
Joi.assert(inputNotBefore, Joi.string().optional());
|
|
144
|
-
Joi.assert(inputNotAfter, Joi.string().optional());
|
|
145
|
-
let notBefore;
|
|
146
|
-
let notAfter;
|
|
147
|
-
let vMethodId = vMethodIdOrAlg;
|
|
148
|
-
if (["ES256K", "ES256", "RS256", "EdDSA"].includes(vMethodIdOrAlg)) {
|
|
149
|
-
const alg = vMethodIdOrAlg;
|
|
150
|
-
vMethodId = client.keys[alg].id;
|
|
151
|
-
}
|
|
152
|
-
if (inputNotBefore) {
|
|
153
|
-
notBefore = Math.floor(new Date(inputNotBefore).getTime() / 1000);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
notBefore = Math.floor(Date.now() / 1000);
|
|
157
|
-
}
|
|
158
|
-
if (inputNotAfter) {
|
|
159
|
-
notAfter = Math.floor(new Date(inputNotAfter).getTime() / 1000);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
notAfter = notBefore + 84600 * 365 * 5;
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
info: {
|
|
166
|
-
title: "Add verification relationship",
|
|
167
|
-
data: {
|
|
168
|
-
did,
|
|
169
|
-
name,
|
|
170
|
-
vMethodId,
|
|
171
|
-
notBefore,
|
|
172
|
-
notAfter,
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
param: {
|
|
176
|
-
did,
|
|
177
|
-
name,
|
|
178
|
-
vMethodId,
|
|
179
|
-
notBefore,
|
|
180
|
-
notAfter,
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
case "revokeVerificationMethod": {
|
|
185
|
-
const [did, vMethodIdOrAlg, inputNotAfter] = inputs;
|
|
186
|
-
Joi.assert(did, Joi.string());
|
|
187
|
-
Joi.assert(vMethodIdOrAlg, Joi.string());
|
|
188
|
-
Joi.assert(inputNotAfter, Joi.string());
|
|
189
|
-
let notAfter;
|
|
190
|
-
let vMethodId = vMethodIdOrAlg;
|
|
191
|
-
if (["ES256K", "ES256", "RS256", "EdDSA"].includes(vMethodIdOrAlg)) {
|
|
192
|
-
const alg = vMethodIdOrAlg;
|
|
193
|
-
vMethodId = client.keys[alg].id;
|
|
194
|
-
}
|
|
195
|
-
if (inputNotAfter) {
|
|
196
|
-
notAfter = Math.floor(new Date(inputNotAfter).getTime() / 1000);
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
notAfter = Math.floor(Date.now() / 1000);
|
|
200
|
-
}
|
|
201
|
-
return {
|
|
202
|
-
info: {
|
|
203
|
-
title: "Revoke verification method",
|
|
204
|
-
data: {
|
|
205
|
-
did,
|
|
206
|
-
vMethodId,
|
|
207
|
-
notAfter,
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
param: {
|
|
211
|
-
did,
|
|
212
|
-
vMethodId,
|
|
213
|
-
notAfter,
|
|
214
|
-
},
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
case "expireVerificationMethod": {
|
|
218
|
-
const [did, vMethodIdOrAlg, inputNotAfter] = inputs;
|
|
219
|
-
Joi.assert(did, Joi.string());
|
|
220
|
-
Joi.assert(vMethodIdOrAlg, Joi.string());
|
|
221
|
-
Joi.assert(inputNotAfter, Joi.string());
|
|
222
|
-
const notAfter = Math.floor(new Date(inputNotAfter).getTime() / 1000);
|
|
223
|
-
let vMethodId = vMethodIdOrAlg;
|
|
224
|
-
if (["ES256K", "ES256", "RS256", "EdDSA"].includes(vMethodIdOrAlg)) {
|
|
225
|
-
const alg = vMethodIdOrAlg;
|
|
226
|
-
vMethodId = client.keys[alg].id;
|
|
227
|
-
}
|
|
228
|
-
return {
|
|
229
|
-
info: {
|
|
230
|
-
title: "Expire verification method",
|
|
231
|
-
data: {
|
|
232
|
-
did,
|
|
233
|
-
vMethodId,
|
|
234
|
-
notAfter,
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
param: {
|
|
238
|
-
did,
|
|
239
|
-
vMethodId,
|
|
240
|
-
notAfter,
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
case "rollVerificationMethod": {
|
|
245
|
-
const [did, inputPublicKeyOrAlg, inputNotBefore, inputNotAfter, oldVMethodId, inputDuration, inputVMethodId,] = inputs;
|
|
246
|
-
Joi.assert(did, Joi.string());
|
|
247
|
-
Joi.assert(inputNotBefore, Joi.string());
|
|
248
|
-
Joi.assert(inputNotAfter, Joi.string());
|
|
249
|
-
Joi.assert(oldVMethodId, Joi.string());
|
|
250
|
-
Joi.assert(inputDuration, Joi.string());
|
|
251
|
-
Joi.assert(inputVMethodId, Joi.string().optional());
|
|
252
|
-
let inputPublicKey = inputPublicKeyOrAlg;
|
|
253
|
-
if (typeof inputPublicKeyOrAlg === "string" &&
|
|
254
|
-
["ES256K", "ES256", "RS256", "EdDSA"].includes(inputPublicKeyOrAlg)) {
|
|
255
|
-
const alg = inputPublicKeyOrAlg;
|
|
256
|
-
inputPublicKey = client.keys[alg].publicKeyJwk;
|
|
257
|
-
}
|
|
258
|
-
const notBefore = Math.floor(new Date(inputNotBefore).getTime() / 1000);
|
|
259
|
-
const notAfter = Math.floor(new Date(inputNotAfter).getTime() / 1000);
|
|
260
|
-
const duration = Number(inputDuration);
|
|
261
|
-
const { publicKey, vMethodId, isSecp256k1 } = await processInputPublicKey(client, inputPublicKey, inputVMethodId);
|
|
262
|
-
return {
|
|
263
|
-
info: {
|
|
264
|
-
title: "Add verification method",
|
|
265
|
-
data: {
|
|
266
|
-
args: {
|
|
267
|
-
did,
|
|
268
|
-
vMethodId,
|
|
269
|
-
publicKey,
|
|
270
|
-
isSecp256k1,
|
|
271
|
-
notBefore,
|
|
272
|
-
notAfter,
|
|
273
|
-
oldVMethodId,
|
|
274
|
-
duration,
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
param: {
|
|
279
|
-
args: {
|
|
280
|
-
did,
|
|
281
|
-
vMethodId,
|
|
282
|
-
publicKey,
|
|
283
|
-
isSecp256k1,
|
|
284
|
-
notBefore,
|
|
285
|
-
notAfter,
|
|
286
|
-
oldVMethodId,
|
|
287
|
-
duration,
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
case "addService": {
|
|
293
|
-
const [did, service] = inputs;
|
|
294
|
-
Joi.assert(did, Joi.string());
|
|
295
|
-
return {
|
|
296
|
-
info: {
|
|
297
|
-
title: "Add service",
|
|
298
|
-
data: { did, service },
|
|
299
|
-
},
|
|
300
|
-
param: {
|
|
301
|
-
did,
|
|
302
|
-
service,
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
case "revokeService": {
|
|
307
|
-
const [did, serviceId] = inputs;
|
|
308
|
-
Joi.assert(did, Joi.string());
|
|
309
|
-
Joi.assert(serviceId, Joi.string());
|
|
310
|
-
return {
|
|
311
|
-
info: {
|
|
312
|
-
title: "Revoke service",
|
|
313
|
-
data: { did, serviceId },
|
|
314
|
-
},
|
|
315
|
-
param: {
|
|
316
|
-
did,
|
|
317
|
-
serviceId,
|
|
318
|
-
},
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
default:
|
|
322
|
-
throw new Error(`Invalid method '${method}'`);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
export default buildParamDidV4;
|
|
326
|
-
//# sourceMappingURL=didV4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"didV4.js","sourceRoot":"","sources":["../../src/buildParam/didV4.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,CAAC,K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node:crypto";
|
|
2
|
-
import { ethers } from "ethers";
|
|
3
|
-
import Multihash from "multihashes";
|
|
4
|
-
import Joi from "joi";
|
|
5
|
-
import { multibaseEncode, fromHexString } from "../utils/index.js";
|
|
6
|
-
const { sha256 } = ethers.utils;
|
|
7
|
-
export function buildParamTimestampV2(method, client, inputs) {
|
|
8
|
-
switch (method) {
|
|
9
|
-
case "timestampRecordHashes": {
|
|
10
|
-
const [inputData, inputInfo] = inputs;
|
|
11
|
-
Joi.assert(inputData, Joi.object().optional());
|
|
12
|
-
Joi.assert(inputInfo, Joi.object().optional());
|
|
13
|
-
const data = typeof inputData === "object"
|
|
14
|
-
? inputData
|
|
15
|
-
: { test: crypto.randomBytes(12).toString("hex") };
|
|
16
|
-
const buffer = Buffer.from(JSON.stringify(data));
|
|
17
|
-
const info = typeof inputInfo === "object"
|
|
18
|
-
? inputInfo
|
|
19
|
-
: {
|
|
20
|
-
info: crypto.randomBytes(12).toString("hex"),
|
|
21
|
-
};
|
|
22
|
-
const timestamp = {
|
|
23
|
-
hash: {
|
|
24
|
-
id: 0,
|
|
25
|
-
value: sha256(buffer),
|
|
26
|
-
},
|
|
27
|
-
data: `0x${buffer.toString("hex")}`,
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
info: {
|
|
31
|
-
title: "Timestamp record hashes. Record Id:",
|
|
32
|
-
data: { hashValue: timestamp.hash.value },
|
|
33
|
-
},
|
|
34
|
-
param: {
|
|
35
|
-
hashAlgorithmIds: [timestamp.hash.id],
|
|
36
|
-
hashValues: [timestamp.hash.value],
|
|
37
|
-
timestampData: [timestamp.data],
|
|
38
|
-
versionInfo: `0x${Buffer.from(JSON.stringify(info)).toString("hex")}`,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
case "timestampVersionHashes": {
|
|
43
|
-
const [versionHash, inputData, inputInfo] = inputs;
|
|
44
|
-
Joi.assert(versionHash, Joi.string());
|
|
45
|
-
Joi.assert(inputData, Joi.object().optional());
|
|
46
|
-
Joi.assert(inputInfo, Joi.object().optional());
|
|
47
|
-
const data = typeof inputData === "object"
|
|
48
|
-
? inputData
|
|
49
|
-
: { test: crypto.randomBytes(12).toString("hex") };
|
|
50
|
-
const buffer = Buffer.from(JSON.stringify(data));
|
|
51
|
-
const info = typeof inputInfo === "object"
|
|
52
|
-
? inputInfo
|
|
53
|
-
: {
|
|
54
|
-
info: crypto.randomBytes(12).toString("hex"),
|
|
55
|
-
};
|
|
56
|
-
const timestamp = {
|
|
57
|
-
hash: {
|
|
58
|
-
id: 0,
|
|
59
|
-
value: sha256(buffer),
|
|
60
|
-
},
|
|
61
|
-
data: `0x${buffer.toString("hex")}`,
|
|
62
|
-
};
|
|
63
|
-
return {
|
|
64
|
-
info: {
|
|
65
|
-
title: "Timestamp record version hashes",
|
|
66
|
-
data: { data, info },
|
|
67
|
-
},
|
|
68
|
-
param: {
|
|
69
|
-
versionHash,
|
|
70
|
-
hashAlgorithmIds: [timestamp.hash.id],
|
|
71
|
-
hashValues: [timestamp.hash.value],
|
|
72
|
-
timestampData: [timestamp.data],
|
|
73
|
-
versionInfo: `0x${Buffer.from(JSON.stringify(info)).toString("hex")}`,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
case "timestampRecordVersionHashes": {
|
|
78
|
-
const [recordId, inputData, inputInfo] = inputs;
|
|
79
|
-
Joi.assert(recordId, Joi.string());
|
|
80
|
-
Joi.assert(inputData, Joi.object().optional());
|
|
81
|
-
Joi.assert(inputInfo, Joi.object().optional());
|
|
82
|
-
const data = typeof inputData === "object"
|
|
83
|
-
? inputData
|
|
84
|
-
: { test: crypto.randomBytes(12).toString("hex") };
|
|
85
|
-
const buffer = Buffer.from(JSON.stringify(data));
|
|
86
|
-
const info = typeof inputInfo === "object"
|
|
87
|
-
? inputInfo
|
|
88
|
-
: {
|
|
89
|
-
info: crypto.randomBytes(12).toString("hex"),
|
|
90
|
-
};
|
|
91
|
-
const timestamp = {
|
|
92
|
-
hash: {
|
|
93
|
-
id: 0,
|
|
94
|
-
value: sha256(buffer),
|
|
95
|
-
},
|
|
96
|
-
data: `0x${buffer.toString("hex")}`,
|
|
97
|
-
};
|
|
98
|
-
return {
|
|
99
|
-
info: {
|
|
100
|
-
title: "Timestamp record version hashes",
|
|
101
|
-
data: { data, info },
|
|
102
|
-
},
|
|
103
|
-
param: {
|
|
104
|
-
recordId,
|
|
105
|
-
hashAlgorithmIds: [timestamp.hash.id],
|
|
106
|
-
hashValues: [timestamp.hash.value],
|
|
107
|
-
timestampData: [timestamp.data],
|
|
108
|
-
versionInfo: `0x${Buffer.from(JSON.stringify(info)).toString("hex")}`,
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
case "insertRecordOwner": {
|
|
113
|
-
const [recordId, ownerId, inputNotBefore, inputNotAfter] = inputs;
|
|
114
|
-
Joi.assert(recordId, Joi.string());
|
|
115
|
-
Joi.assert(ownerId, Joi.string());
|
|
116
|
-
Joi.assert(inputNotBefore, Joi.string().optional());
|
|
117
|
-
Joi.assert(inputNotAfter, Joi.string().optional());
|
|
118
|
-
const now = Math.round(Date.now() / 1000);
|
|
119
|
-
const notBefore = inputNotBefore || now;
|
|
120
|
-
const notAfter = inputNotAfter || 0;
|
|
121
|
-
return {
|
|
122
|
-
info: {
|
|
123
|
-
title: "Insert Record Owner",
|
|
124
|
-
data: ownerId,
|
|
125
|
-
},
|
|
126
|
-
param: {
|
|
127
|
-
recordId,
|
|
128
|
-
ownerId,
|
|
129
|
-
notBefore,
|
|
130
|
-
notAfter,
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
case "revokeRecordOwner": {
|
|
135
|
-
const [recordId, ownerId] = inputs;
|
|
136
|
-
Joi.assert(recordId, Joi.string());
|
|
137
|
-
Joi.assert(ownerId, Joi.string());
|
|
138
|
-
return {
|
|
139
|
-
info: {
|
|
140
|
-
title: "Revoke Record Owner",
|
|
141
|
-
data: ownerId,
|
|
142
|
-
},
|
|
143
|
-
param: {
|
|
144
|
-
recordId,
|
|
145
|
-
ownerId,
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
case "insertRecordVersionInfo": {
|
|
150
|
-
const [recordId, inputVersionId, inputInfo] = inputs;
|
|
151
|
-
Joi.assert(recordId, Joi.string());
|
|
152
|
-
Joi.assert(inputVersionId, Joi.string());
|
|
153
|
-
Joi.assert(inputInfo, Joi.object().optional());
|
|
154
|
-
const versionId = Number(inputVersionId);
|
|
155
|
-
const info = typeof inputInfo === "object"
|
|
156
|
-
? inputInfo
|
|
157
|
-
: {
|
|
158
|
-
info: crypto.randomBytes(12).toString("hex"),
|
|
159
|
-
};
|
|
160
|
-
return {
|
|
161
|
-
info: {
|
|
162
|
-
title: "Insert Record Version Info",
|
|
163
|
-
data: { recordId, versionId, info },
|
|
164
|
-
},
|
|
165
|
-
param: {
|
|
166
|
-
recordId,
|
|
167
|
-
versionId,
|
|
168
|
-
versionInfo: `0x${Buffer.from(JSON.stringify(info)).toString("hex")}`,
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
case "detachRecordVersionHash": {
|
|
173
|
-
const [recordId, inputVersionId, hashValue] = inputs;
|
|
174
|
-
Joi.assert(recordId, Joi.string());
|
|
175
|
-
Joi.assert(inputVersionId, Joi.string());
|
|
176
|
-
Joi.assert(hashValue, Joi.string());
|
|
177
|
-
const versionId = Number(inputVersionId);
|
|
178
|
-
return {
|
|
179
|
-
info: {
|
|
180
|
-
title: "Detach Record Version Hash",
|
|
181
|
-
data: { recordId, versionId, hashValue },
|
|
182
|
-
},
|
|
183
|
-
param: {
|
|
184
|
-
recordId,
|
|
185
|
-
versionId,
|
|
186
|
-
hashValue,
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
case "appendRecordVersionHashes": {
|
|
191
|
-
const [recordId, inputVersionId, inputData, inputInfo] = inputs;
|
|
192
|
-
Joi.assert(recordId, Joi.string());
|
|
193
|
-
Joi.assert(inputVersionId, Joi.string());
|
|
194
|
-
Joi.assert(inputData, Joi.object().optional());
|
|
195
|
-
Joi.assert(inputInfo, Joi.object().optional());
|
|
196
|
-
const versionId = Number(inputVersionId);
|
|
197
|
-
const data = typeof inputData === "object"
|
|
198
|
-
? inputData
|
|
199
|
-
: { test: crypto.randomBytes(12).toString("hex") };
|
|
200
|
-
const buffer = Buffer.from(JSON.stringify(data));
|
|
201
|
-
const info = typeof inputInfo === "object"
|
|
202
|
-
? inputInfo
|
|
203
|
-
: {
|
|
204
|
-
info: crypto.randomBytes(12).toString("hex"),
|
|
205
|
-
};
|
|
206
|
-
const timestamp = {
|
|
207
|
-
hash: {
|
|
208
|
-
id: 0,
|
|
209
|
-
value: sha256(buffer),
|
|
210
|
-
},
|
|
211
|
-
data: `0x${buffer.toString("hex")}`,
|
|
212
|
-
};
|
|
213
|
-
return {
|
|
214
|
-
info: {
|
|
215
|
-
title: "Append record version hashes",
|
|
216
|
-
data: { data, info },
|
|
217
|
-
},
|
|
218
|
-
param: {
|
|
219
|
-
recordId,
|
|
220
|
-
versionId,
|
|
221
|
-
hashAlgorithmIds: [timestamp.hash.id],
|
|
222
|
-
hashValues: [timestamp.hash.value],
|
|
223
|
-
timestampData: [timestamp.data],
|
|
224
|
-
versionInfo: `0x${Buffer.from(JSON.stringify(info)).toString("hex")}`,
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
case "timestampHashes": {
|
|
229
|
-
const [inputData] = inputs;
|
|
230
|
-
Joi.assert(inputData, Joi.object().optional());
|
|
231
|
-
const data = typeof inputData === "object"
|
|
232
|
-
? inputData
|
|
233
|
-
: { test: crypto.randomBytes(12).toString("hex") };
|
|
234
|
-
const buffer = Buffer.from(JSON.stringify(data));
|
|
235
|
-
const timestamp = {
|
|
236
|
-
hash: {
|
|
237
|
-
id: 0,
|
|
238
|
-
value: sha256(buffer),
|
|
239
|
-
},
|
|
240
|
-
data: `0x${buffer.toString("hex")}`,
|
|
241
|
-
};
|
|
242
|
-
const hashBuffer = fromHexString(sha256(timestamp.hash.value));
|
|
243
|
-
const multihash = Multihash.encode(hashBuffer, "sha2-256", 32);
|
|
244
|
-
const id = multibaseEncode("base64url", multihash);
|
|
245
|
-
return {
|
|
246
|
-
info: {
|
|
247
|
-
title: "Timestamp hashes",
|
|
248
|
-
data: { data, id },
|
|
249
|
-
},
|
|
250
|
-
param: {
|
|
251
|
-
hashAlgorithmIds: [timestamp.hash.id],
|
|
252
|
-
hashValues: [timestamp.hash.value],
|
|
253
|
-
timestampData: [timestamp.data],
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
case "insertHashAlgorithm": {
|
|
258
|
-
const [inputOutputLength, inputIanaName, inputOid, inputStatus, inputMultiHash,] = inputs;
|
|
259
|
-
Joi.assert(inputOutputLength, Joi.string().optional());
|
|
260
|
-
Joi.assert(inputIanaName, Joi.string().optional());
|
|
261
|
-
Joi.assert(inputOid, Joi.string().optional());
|
|
262
|
-
Joi.assert(inputStatus, Joi.string().optional());
|
|
263
|
-
Joi.assert(inputMultiHash, Joi.string().optional());
|
|
264
|
-
const outputLength = Number(inputOutputLength) || 1;
|
|
265
|
-
const ianaName = inputIanaName || "undefined";
|
|
266
|
-
const oid = inputOid || "undefined";
|
|
267
|
-
const status = Number(inputStatus) || 1;
|
|
268
|
-
const multiHash = inputMultiHash || ianaName;
|
|
269
|
-
return {
|
|
270
|
-
info: {
|
|
271
|
-
title: "Hash Algorithm",
|
|
272
|
-
data: ianaName,
|
|
273
|
-
},
|
|
274
|
-
param: {
|
|
275
|
-
outputLength,
|
|
276
|
-
ianaName,
|
|
277
|
-
oid,
|
|
278
|
-
status,
|
|
279
|
-
multiHash,
|
|
280
|
-
},
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
case "updateHashAlgorithm": {
|
|
284
|
-
const [inputHashAlgorithmId, inputOutputLength, inputIanaName, inputOid, inputStatus, inputMultiHash,] = inputs;
|
|
285
|
-
Joi.assert(inputHashAlgorithmId, Joi.string());
|
|
286
|
-
Joi.assert(inputOutputLength, Joi.string().optional());
|
|
287
|
-
Joi.assert(inputIanaName, Joi.string().optional());
|
|
288
|
-
Joi.assert(inputOid, Joi.string().optional());
|
|
289
|
-
Joi.assert(inputStatus, Joi.string().optional());
|
|
290
|
-
Joi.assert(inputMultiHash, Joi.string().optional());
|
|
291
|
-
const hashAlgorithmId = Number(inputHashAlgorithmId);
|
|
292
|
-
const outputLength = Number(inputOutputLength) || 1;
|
|
293
|
-
const ianaName = inputIanaName || "undefined";
|
|
294
|
-
const oid = inputOid || "undefined";
|
|
295
|
-
const status = Number(inputStatus) || 1;
|
|
296
|
-
const multiHash = inputMultiHash || ianaName;
|
|
297
|
-
return {
|
|
298
|
-
info: {
|
|
299
|
-
title: "Hash Algorithm",
|
|
300
|
-
data: ianaName,
|
|
301
|
-
},
|
|
302
|
-
param: {
|
|
303
|
-
hashAlgorithmId,
|
|
304
|
-
outputLength,
|
|
305
|
-
ianaName,
|
|
306
|
-
oid,
|
|
307
|
-
status,
|
|
308
|
-
multiHash,
|
|
309
|
-
},
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
default:
|
|
313
|
-
throw new Error(`Invalid method '${method}'`);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
export default buildParamTimestampV2;
|
|
317
|
-
//# sourceMappingURL=timestampV2.js.map
|