@cheqd/sdk 1.5.0-develop.3 → 2.0.0-develop.2
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/CHANGELOG.md +18 -0
- package/build/index.d.ts +4 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/modules/did.d.ts +31 -4
- package/build/modules/did.d.ts.map +1 -1
- package/build/modules/did.js +172 -14
- package/build/modules/did.js.map +1 -1
- package/build/modules/resource.d.ts +24 -1
- package/build/modules/resource.d.ts.map +1 -1
- package/build/modules/resource.js +63 -3
- package/build/modules/resource.js.map +1 -1
- package/build/signer.d.ts.map +1 -1
- package/build/signer.js +0 -13
- package/build/signer.js.map +1 -1
- package/build/types.d.ts +10 -236
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -120
- package/build/types.js.map +1 -1
- package/build/utils.d.ts +5 -5
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +70 -20
- package/build/utils.js.map +1 -1
- package/package.json +4 -2
- package/src/index.ts +5 -2
- package/src/modules/did.ts +204 -19
- package/src/modules/resource.ts +75 -4
- package/src/signer.ts +2 -17
- package/src/types.ts +14 -156
- package/src/utils.ts +85 -38
- package/tests/index.test.ts +5 -6
- package/tests/modules/did.test.ts +390 -80
- package/tests/modules/resource.test.ts +160 -27
- package/tests/signer.test.ts +55 -31
- package/tests/testutils.test.ts +3 -148
- package/tests/utils.test.ts +4 -4
package/build/signer.js
CHANGED
|
@@ -41,8 +41,6 @@ function makeDidAuthInfoBytes(signers, feeAmount, gasLimit, feePayer, signMode =
|
|
|
41
41
|
payer: feePayer
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
//* There is a `Long` type incompatibility in the protobuf library that causes the following line to throw an error. No actual type mismatch is ever encountered.
|
|
45
|
-
// @ts-ignore
|
|
46
44
|
return tx_1.AuthInfo.encode(tx_1.AuthInfo.fromPartial(authInfo)).finish();
|
|
47
45
|
}
|
|
48
46
|
exports.makeDidAuthInfoBytes = makeDidAuthInfoBytes;
|
|
@@ -60,10 +58,6 @@ class CheqdSigningStargateClient extends stargate_1.SigningStargateClient {
|
|
|
60
58
|
this._signer = signer;
|
|
61
59
|
if (options.gasPrice)
|
|
62
60
|
this._gasPrice = options.gasPrice;
|
|
63
|
-
/** GRPC Connection */
|
|
64
|
-
/* if (tmClient) {
|
|
65
|
-
this.cheqdExtensions = QueryClient.withExtensions(tmClient, setupCheqdExtensions)
|
|
66
|
-
} */
|
|
67
61
|
}
|
|
68
62
|
async signAndBroadcast(signerAddress, messages, fee, memo = "") {
|
|
69
63
|
let usedFee;
|
|
@@ -98,10 +92,6 @@ class CheqdSigningStargateClient extends stargate_1.SigningStargateClient {
|
|
|
98
92
|
};
|
|
99
93
|
}
|
|
100
94
|
return this._signDirect(signerAddress, messages, fee, memo, signerData);
|
|
101
|
-
// TODO: override signAmino as well
|
|
102
|
-
/* return isOfflineDirectSigner(this._signer)
|
|
103
|
-
? this._signDirect(signerAddress, messages, fee, memo, signerData)
|
|
104
|
-
: this._signAmino(signerAddress, messages, fee, memo, signerData) */
|
|
105
95
|
}
|
|
106
96
|
async _signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
|
|
107
97
|
(0, utils_1.assert)((0, proto_signing_1.isOfflineDirectSigner)(this._signer));
|
|
@@ -158,7 +148,6 @@ class CheqdSigningStargateClient extends stargate_1.SigningStargateClient {
|
|
|
158
148
|
const signInfos = await Promise.all(signInputs.map(async (signInput) => {
|
|
159
149
|
return {
|
|
160
150
|
verificationMethodId: signInput.verificationMethodId,
|
|
161
|
-
// TODO: We can't rely on `payload.verificationMethod` here because `CreateResourceTx` doesn't have it
|
|
162
151
|
signature: (0, did_jwt_1.base64ToBytes)((await (await this.getDidSigner(signInput.verificationMethodId, payload.verificationMethod))((0, did_jwt_1.hexToBytes)(signInput.privateKeyHex))(signBytes)))
|
|
163
152
|
};
|
|
164
153
|
}));
|
|
@@ -170,7 +159,6 @@ class CheqdSigningStargateClient extends stargate_1.SigningStargateClient {
|
|
|
170
159
|
const signInfos = await Promise.all(signInputs.map(async (signInput) => {
|
|
171
160
|
return {
|
|
172
161
|
verificationMethodId: signInput.verificationMethodId,
|
|
173
|
-
// TODO: We can't rely on `payload.verificationMethod` here because `CreateResourceTx` doesn't have it
|
|
174
162
|
signature: (0, did_jwt_1.base64ToBytes)((await (await this.getDidSigner(signInput.verificationMethodId, payload.verificationMethod))((0, did_jwt_1.hexToBytes)(signInput.privateKeyHex))(signBytes)))
|
|
175
163
|
};
|
|
176
164
|
}));
|
|
@@ -182,7 +170,6 @@ class CheqdSigningStargateClient extends stargate_1.SigningStargateClient {
|
|
|
182
170
|
const signInfos = await Promise.all(signInputs.map(async (signInput) => {
|
|
183
171
|
return {
|
|
184
172
|
verificationMethodId: signInput.verificationMethodId,
|
|
185
|
-
// TODO: We can't rely on `payload.verificationMethod` here because `CreateResourceTx` doesn't have it
|
|
186
173
|
signature: (0, did_jwt_1.base64ToBytes)((await (await this.getDidSigner(signInput.verificationMethodId, verificationMethod))((0, did_jwt_1.hexToBytes)(signInput.privateKeyHex))(signBytes)))
|
|
187
174
|
};
|
|
188
175
|
}));
|
package/build/signer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":";;;;;;AACA,yDAAyI;AACzI,+
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":";;;;;;AACA,yDAAyI;AACzI,+CAA2J;AAC3J,2DAA2D;AAC3D,yCAAuD;AACvD,qDAAwJ;AACxJ,mCAAmF;AACnF,qCAAoG;AACpG,yCAAqD;AACrD,yCAAqD;AACrD,uCAAoC;AACpC,+CAA6C;AAC7C,0DAA+E;AAC/E,4EAAyE;AAGzE,gDAAuB;AAEvB,SAAgB,eAAe,CAAC,QAAgB,EAAE,QAA2B;IAC5E,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oBAC3F,MAAM;gBACP,KAAK,MAAM;oBACV,SAAS,GAAG,CAAC,MAAM,IAAA,qBAAW,EAAC,IAAA,oBAAU,EAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAW,CAAC;oBAC1F,MAAM;gBACP;oBACC,MAAM,IAAI,KAAK,CAAC,+BAA+B,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;aACrE;YAED,SAAS,CAAC,IAAI,CAAC;gBACd,oBAAoB,EAAE,SAAS,CAAC,oBAAoB;gBACpD,SAAS,EAAE,IAAA,uBAAa,EAAC,SAAS,CAAC;aACnC,CAAC,CAAC;SACH;QAED,OAAO,SAAS,CAAA;IACjB,CAAC;CACD;AA5MD,gEA4MC"}
|
package/build/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Service as ProtobufService, VerificationMethod as ProtobufVerificationMethod } from "@cheqd/ts-proto/cheqd/did/v2";
|
|
1
2
|
import { CheqdSDK } from ".";
|
|
2
3
|
import { Coin } from "@cosmjs/proto-signing";
|
|
3
4
|
import { Signer } from "did-jwt";
|
|
4
|
-
|
|
5
|
+
export { DIDDocument, VerificationMethod, Service, ServiceEndpoint, JsonWebKey } from "did-resolver";
|
|
5
6
|
export declare enum CheqdNetwork {
|
|
6
7
|
Mainnet = "mainnet",
|
|
7
8
|
Testnet = "testnet"
|
|
@@ -14,6 +15,12 @@ export interface IModuleMethodMap extends Record<string, IModuleMethod> {
|
|
|
14
15
|
export interface IContext {
|
|
15
16
|
sdk: CheqdSDK;
|
|
16
17
|
}
|
|
18
|
+
export type SpecValidationResult = {
|
|
19
|
+
valid: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
protobufVerificationMethod?: ProtobufVerificationMethod[];
|
|
22
|
+
protobufService?: ProtobufService[];
|
|
23
|
+
};
|
|
17
24
|
export declare enum VerificationMethods {
|
|
18
25
|
Ed255192020 = "Ed25519VerificationKey2020",
|
|
19
26
|
Ed255192018 = "Ed25519VerificationKey2018",
|
|
@@ -31,9 +38,6 @@ export interface ISignInputs {
|
|
|
31
38
|
keyType?: 'Ed25519' | 'Secp256k1' | 'P256';
|
|
32
39
|
privateKeyHex: string;
|
|
33
40
|
}
|
|
34
|
-
export declare const ISignInputs: {
|
|
35
|
-
isSignInput(object: Object[]): object is ISignInputs[];
|
|
36
|
-
};
|
|
37
41
|
export interface IKeyPair {
|
|
38
42
|
publicKey: string;
|
|
39
43
|
privateKey: string;
|
|
@@ -58,237 +62,7 @@ export interface DidStdFee {
|
|
|
58
62
|
payer?: string;
|
|
59
63
|
granter?: string;
|
|
60
64
|
}
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
export interface MsgCreateDidPayload extends Omit<MsgCreateDidDocPayload, 'verificationMethod' | 'service'> {
|
|
65
|
-
verificationMethod: VerificationMethodPayload[];
|
|
66
|
-
service: ServicePayload[];
|
|
67
|
-
}
|
|
68
|
-
export declare const MsgCreateDidPayload: {
|
|
69
|
-
transformPayload<I extends {
|
|
70
|
-
verificationMethod?: {
|
|
71
|
-
id?: string | undefined;
|
|
72
|
-
type?: string | undefined;
|
|
73
|
-
controller?: string | undefined;
|
|
74
|
-
publicKeyBase58?: string | undefined;
|
|
75
|
-
publicKeyMultibase?: string | undefined;
|
|
76
|
-
publicKeyJWK?: any;
|
|
77
|
-
}[] | undefined;
|
|
78
|
-
service?: {
|
|
79
|
-
id?: string | undefined;
|
|
80
|
-
type?: string | undefined;
|
|
81
|
-
serviceEndpoint?: string[] | undefined;
|
|
82
|
-
}[] | undefined;
|
|
83
|
-
context?: string[] | undefined;
|
|
84
|
-
id?: string | undefined;
|
|
85
|
-
controller?: string[] | undefined;
|
|
86
|
-
authentication?: string[] | undefined;
|
|
87
|
-
assertionMethod?: string[] | undefined;
|
|
88
|
-
capabilityInvocation?: string[] | undefined;
|
|
89
|
-
capabilityDelegation?: string[] | undefined;
|
|
90
|
-
keyAgreement?: string[] | undefined;
|
|
91
|
-
alsoKnownAs?: string[] | undefined;
|
|
92
|
-
versionId?: string | undefined;
|
|
93
|
-
} & {
|
|
94
|
-
verificationMethod?: ({
|
|
95
|
-
id?: string | undefined;
|
|
96
|
-
type?: string | undefined;
|
|
97
|
-
controller?: string | undefined;
|
|
98
|
-
publicKeyBase58?: string | undefined;
|
|
99
|
-
publicKeyMultibase?: string | undefined;
|
|
100
|
-
publicKeyJWK?: any;
|
|
101
|
-
}[] & ({
|
|
102
|
-
id?: string | undefined;
|
|
103
|
-
type?: string | undefined;
|
|
104
|
-
controller?: string | undefined;
|
|
105
|
-
publicKeyBase58?: string | undefined;
|
|
106
|
-
publicKeyMultibase?: string | undefined;
|
|
107
|
-
publicKeyJWK?: any;
|
|
108
|
-
} & {
|
|
109
|
-
id?: string | undefined;
|
|
110
|
-
type?: string | undefined;
|
|
111
|
-
controller?: string | undefined;
|
|
112
|
-
publicKeyBase58?: string | undefined;
|
|
113
|
-
publicKeyMultibase?: string | undefined;
|
|
114
|
-
publicKeyJWK?: any;
|
|
115
|
-
} & { [K in Exclude<keyof I["verificationMethod"][number], keyof VerificationMethodPayload>]: never; })[] & { [K_1 in Exclude<keyof I["verificationMethod"], keyof {
|
|
116
|
-
id?: string | undefined;
|
|
117
|
-
type?: string | undefined;
|
|
118
|
-
controller?: string | undefined;
|
|
119
|
-
publicKeyBase58?: string | undefined;
|
|
120
|
-
publicKeyMultibase?: string | undefined;
|
|
121
|
-
publicKeyJWK?: any;
|
|
122
|
-
}[]>]: never; }) | undefined;
|
|
123
|
-
service?: ({
|
|
124
|
-
id?: string | undefined;
|
|
125
|
-
type?: string | undefined;
|
|
126
|
-
serviceEndpoint?: string[] | undefined;
|
|
127
|
-
}[] & ({
|
|
128
|
-
id?: string | undefined;
|
|
129
|
-
type?: string | undefined;
|
|
130
|
-
serviceEndpoint?: string[] | undefined;
|
|
131
|
-
} & {
|
|
132
|
-
id?: string | undefined;
|
|
133
|
-
type?: string | undefined;
|
|
134
|
-
serviceEndpoint?: (string[] & string[] & { [K_2 in Exclude<keyof I["service"][number]["serviceEndpoint"], keyof string[]>]: never; }) | undefined;
|
|
135
|
-
} & { [K_3 in Exclude<keyof I["service"][number], keyof ServicePayload>]: never; })[] & { [K_4 in Exclude<keyof I["service"], keyof {
|
|
136
|
-
id?: string | undefined;
|
|
137
|
-
type?: string | undefined;
|
|
138
|
-
serviceEndpoint?: string[] | undefined;
|
|
139
|
-
}[]>]: never; }) | undefined;
|
|
140
|
-
context?: (string[] & string[] & { [K_5 in Exclude<keyof I["context"], keyof string[]>]: never; }) | undefined;
|
|
141
|
-
id?: string | undefined;
|
|
142
|
-
controller?: (string[] & string[] & { [K_6 in Exclude<keyof I["controller"], keyof string[]>]: never; }) | undefined;
|
|
143
|
-
authentication?: (string[] & string[] & { [K_7 in Exclude<keyof I["authentication"], keyof string[]>]: never; }) | undefined;
|
|
144
|
-
assertionMethod?: (string[] & string[] & { [K_8 in Exclude<keyof I["assertionMethod"], keyof string[]>]: never; }) | undefined;
|
|
145
|
-
capabilityInvocation?: (string[] & string[] & { [K_9 in Exclude<keyof I["capabilityInvocation"], keyof string[]>]: never; }) | undefined;
|
|
146
|
-
capabilityDelegation?: (string[] & string[] & { [K_10 in Exclude<keyof I["capabilityDelegation"], keyof string[]>]: never; }) | undefined;
|
|
147
|
-
keyAgreement?: (string[] & string[] & { [K_11 in Exclude<keyof I["keyAgreement"], keyof string[]>]: never; }) | undefined;
|
|
148
|
-
alsoKnownAs?: (string[] & string[] & { [K_12 in Exclude<keyof I["alsoKnownAs"], keyof string[]>]: never; }) | undefined;
|
|
149
|
-
versionId?: string | undefined;
|
|
150
|
-
} & { [K_13 in Exclude<keyof I, keyof MsgCreateDidPayload>]: never; }>(message: I): MsgCreateDidDocPayload;
|
|
151
|
-
fromPartial<I_1 extends {
|
|
152
|
-
verificationMethod?: {
|
|
153
|
-
id?: string | undefined;
|
|
154
|
-
type?: string | undefined;
|
|
155
|
-
controller?: string | undefined;
|
|
156
|
-
publicKeyBase58?: string | undefined;
|
|
157
|
-
publicKeyMultibase?: string | undefined;
|
|
158
|
-
publicKeyJWK?: any;
|
|
159
|
-
}[] | undefined;
|
|
160
|
-
service?: {
|
|
161
|
-
id?: string | undefined;
|
|
162
|
-
type?: string | undefined;
|
|
163
|
-
serviceEndpoint?: string[] | undefined;
|
|
164
|
-
}[] | undefined;
|
|
165
|
-
context?: string[] | undefined;
|
|
166
|
-
id?: string | undefined;
|
|
167
|
-
controller?: string[] | undefined;
|
|
168
|
-
authentication?: string[] | undefined;
|
|
169
|
-
assertionMethod?: string[] | undefined;
|
|
170
|
-
capabilityInvocation?: string[] | undefined;
|
|
171
|
-
capabilityDelegation?: string[] | undefined;
|
|
172
|
-
keyAgreement?: string[] | undefined;
|
|
173
|
-
alsoKnownAs?: string[] | undefined;
|
|
174
|
-
versionId?: string | undefined;
|
|
175
|
-
} & {
|
|
176
|
-
verificationMethod?: ({
|
|
177
|
-
id?: string | undefined;
|
|
178
|
-
type?: string | undefined;
|
|
179
|
-
controller?: string | undefined;
|
|
180
|
-
publicKeyBase58?: string | undefined;
|
|
181
|
-
publicKeyMultibase?: string | undefined;
|
|
182
|
-
publicKeyJWK?: any;
|
|
183
|
-
}[] & ({
|
|
184
|
-
id?: string | undefined;
|
|
185
|
-
type?: string | undefined;
|
|
186
|
-
controller?: string | undefined;
|
|
187
|
-
publicKeyBase58?: string | undefined;
|
|
188
|
-
publicKeyMultibase?: string | undefined;
|
|
189
|
-
publicKeyJWK?: any;
|
|
190
|
-
} & {
|
|
191
|
-
id?: string | undefined;
|
|
192
|
-
type?: string | undefined;
|
|
193
|
-
controller?: string | undefined;
|
|
194
|
-
publicKeyBase58?: string | undefined;
|
|
195
|
-
publicKeyMultibase?: string | undefined;
|
|
196
|
-
publicKeyJWK?: any;
|
|
197
|
-
} & { [K_14 in Exclude<keyof I_1["verificationMethod"][number], keyof VerificationMethodPayload>]: never; })[] & { [K_15 in Exclude<keyof I_1["verificationMethod"], keyof {
|
|
198
|
-
id?: string | undefined;
|
|
199
|
-
type?: string | undefined;
|
|
200
|
-
controller?: string | undefined;
|
|
201
|
-
publicKeyBase58?: string | undefined;
|
|
202
|
-
publicKeyMultibase?: string | undefined;
|
|
203
|
-
publicKeyJWK?: any;
|
|
204
|
-
}[]>]: never; }) | undefined;
|
|
205
|
-
service?: ({
|
|
206
|
-
id?: string | undefined;
|
|
207
|
-
type?: string | undefined;
|
|
208
|
-
serviceEndpoint?: string[] | undefined;
|
|
209
|
-
}[] & ({
|
|
210
|
-
id?: string | undefined;
|
|
211
|
-
type?: string | undefined;
|
|
212
|
-
serviceEndpoint?: string[] | undefined;
|
|
213
|
-
} & {
|
|
214
|
-
id?: string | undefined;
|
|
215
|
-
type?: string | undefined;
|
|
216
|
-
serviceEndpoint?: (string[] & string[] & { [K_16 in Exclude<keyof I_1["service"][number]["serviceEndpoint"], keyof string[]>]: never; }) | undefined;
|
|
217
|
-
} & { [K_17 in Exclude<keyof I_1["service"][number], keyof ServicePayload>]: never; })[] & { [K_18 in Exclude<keyof I_1["service"], keyof {
|
|
218
|
-
id?: string | undefined;
|
|
219
|
-
type?: string | undefined;
|
|
220
|
-
serviceEndpoint?: string[] | undefined;
|
|
221
|
-
}[]>]: never; }) | undefined;
|
|
222
|
-
context?: (string[] & string[] & { [K_19 in Exclude<keyof I_1["context"], keyof string[]>]: never; }) | undefined;
|
|
223
|
-
id?: string | undefined;
|
|
224
|
-
controller?: (string[] & string[] & { [K_20 in Exclude<keyof I_1["controller"], keyof string[]>]: never; }) | undefined;
|
|
225
|
-
authentication?: (string[] & string[] & { [K_21 in Exclude<keyof I_1["authentication"], keyof string[]>]: never; }) | undefined;
|
|
226
|
-
assertionMethod?: (string[] & string[] & { [K_22 in Exclude<keyof I_1["assertionMethod"], keyof string[]>]: never; }) | undefined;
|
|
227
|
-
capabilityInvocation?: (string[] & string[] & { [K_23 in Exclude<keyof I_1["capabilityInvocation"], keyof string[]>]: never; }) | undefined;
|
|
228
|
-
capabilityDelegation?: (string[] & string[] & { [K_24 in Exclude<keyof I_1["capabilityDelegation"], keyof string[]>]: never; }) | undefined;
|
|
229
|
-
keyAgreement?: (string[] & string[] & { [K_25 in Exclude<keyof I_1["keyAgreement"], keyof string[]>]: never; }) | undefined;
|
|
230
|
-
alsoKnownAs?: (string[] & string[] & { [K_26 in Exclude<keyof I_1["alsoKnownAs"], keyof string[]>]: never; }) | undefined;
|
|
231
|
-
versionId?: string | undefined;
|
|
232
|
-
} & { [K_27 in Exclude<keyof I_1, keyof MsgCreateDidPayload>]: never; }>(object: I_1): MsgCreateDidPayload;
|
|
233
|
-
};
|
|
234
|
-
export interface VerificationMethodPayload {
|
|
235
|
-
id: string;
|
|
236
|
-
type: string;
|
|
237
|
-
controller: string;
|
|
238
|
-
publicKeyBase58?: string;
|
|
239
|
-
publicKeyMultibase?: string;
|
|
240
|
-
publicKeyJWK?: any;
|
|
241
|
-
}
|
|
242
|
-
export declare const VerificationMethodPayload: {
|
|
243
|
-
fromPartial<I extends {
|
|
244
|
-
id?: string | undefined;
|
|
245
|
-
type?: string | undefined;
|
|
246
|
-
controller?: string | undefined;
|
|
247
|
-
publicKeyBase58?: string | undefined;
|
|
248
|
-
publicKeyMultibase?: string | undefined;
|
|
249
|
-
publicKeyJWK?: any;
|
|
250
|
-
} & {
|
|
251
|
-
id?: string | undefined;
|
|
252
|
-
type?: string | undefined;
|
|
253
|
-
controller?: string | undefined;
|
|
254
|
-
publicKeyBase58?: string | undefined;
|
|
255
|
-
publicKeyMultibase?: string | undefined;
|
|
256
|
-
publicKeyJWK?: any;
|
|
257
|
-
} & { [K in Exclude<keyof I, keyof VerificationMethodPayload>]: never; }>(object: I): VerificationMethodPayload;
|
|
258
|
-
transformPayload<I_1 extends {
|
|
259
|
-
id?: string | undefined;
|
|
260
|
-
type?: string | undefined;
|
|
261
|
-
controller?: string | undefined;
|
|
262
|
-
publicKeyBase58?: string | undefined;
|
|
263
|
-
publicKeyMultibase?: string | undefined;
|
|
264
|
-
publicKeyJWK?: any;
|
|
265
|
-
} & {
|
|
266
|
-
id?: string | undefined;
|
|
267
|
-
type?: string | undefined;
|
|
268
|
-
controller?: string | undefined;
|
|
269
|
-
publicKeyBase58?: string | undefined;
|
|
270
|
-
publicKeyMultibase?: string | undefined;
|
|
271
|
-
publicKeyJWK?: any;
|
|
272
|
-
} & { [K_1 in Exclude<keyof I_1, keyof VerificationMethodPayload>]: never; }>(payload: I_1): VerificationMethod;
|
|
273
|
-
};
|
|
274
|
-
export interface ServicePayload {
|
|
275
|
-
id: string;
|
|
276
|
-
type: string;
|
|
277
|
-
serviceEndpoint: string[];
|
|
278
|
-
}
|
|
279
|
-
export declare const ServicePayload: {
|
|
280
|
-
fromPartial<I extends {
|
|
281
|
-
id?: string | undefined;
|
|
282
|
-
type?: string | undefined;
|
|
283
|
-
serviceEndpoint?: string[] | undefined;
|
|
284
|
-
} & {
|
|
285
|
-
id?: string | undefined;
|
|
286
|
-
type?: string | undefined;
|
|
287
|
-
serviceEndpoint?: (string[] & string[] & { [K in Exclude<keyof I["serviceEndpoint"], keyof string[]>]: never; }) | undefined;
|
|
288
|
-
} & { [K_1 in Exclude<keyof I, keyof ServicePayload>]: never; }>(object: I): ServicePayload;
|
|
65
|
+
export declare const ISignInputs: {
|
|
66
|
+
isSignInput(object: Object[]): object is ISignInputs[];
|
|
289
67
|
};
|
|
290
|
-
export interface MsgUpdateDidPayload extends Omit<MsgUpdateDidDocPayload, 'verificationMethod' | 'service'> {
|
|
291
|
-
verificationMethod: VerificationMethodPayload[];
|
|
292
|
-
service: ServicePayload[];
|
|
293
|
-
}
|
|
294
68
|
//# sourceMappingURL=types.d.ts.map
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA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ACF,MAAM,EAAE;CAG7B,CAAA"}
|
package/build/types.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const v2_1 = require("@cheqd/ts-proto/cheqd/did/v2");
|
|
3
|
+
exports.ISignInputs = exports.MethodSpecificIdAlgo = exports.VerificationMethods = exports.CheqdNetwork = void 0;
|
|
5
4
|
var CheqdNetwork;
|
|
6
5
|
(function (CheqdNetwork) {
|
|
7
6
|
CheqdNetwork["Mainnet"] = "mainnet";
|
|
@@ -23,122 +22,4 @@ exports.ISignInputs = {
|
|
|
23
22
|
return object.some((x) => 'privateKeyHex' in x);
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
|
-
exports.MsgCreateDidPayload = {
|
|
27
|
-
transformPayload(message) {
|
|
28
|
-
const obj = {};
|
|
29
|
-
if (message.context) {
|
|
30
|
-
obj.context = message.context;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
obj.context = [];
|
|
34
|
-
}
|
|
35
|
-
message.id !== undefined && (obj.id = message.id);
|
|
36
|
-
if (message.controller) {
|
|
37
|
-
obj.controller = message.controller;
|
|
38
|
-
}
|
|
39
|
-
if (message.verificationMethod) {
|
|
40
|
-
obj.verificationMethod = message.verificationMethod.map((e) => e ? exports.VerificationMethodPayload.transformPayload(e) : undefined);
|
|
41
|
-
}
|
|
42
|
-
if (message.authentication) {
|
|
43
|
-
obj.authentication = message.authentication;
|
|
44
|
-
}
|
|
45
|
-
if (message.assertionMethod) {
|
|
46
|
-
obj.assertionMethod = message.assertionMethod;
|
|
47
|
-
}
|
|
48
|
-
if (message.capabilityInvocation) {
|
|
49
|
-
obj.capabilityInvocation = message.capabilityInvocation;
|
|
50
|
-
}
|
|
51
|
-
if (message.capabilityDelegation) {
|
|
52
|
-
obj.capabilityDelegation = message.capabilityDelegation;
|
|
53
|
-
}
|
|
54
|
-
if (message.keyAgreement) {
|
|
55
|
-
obj.keyAgreement = message.keyAgreement;
|
|
56
|
-
}
|
|
57
|
-
if (message.alsoKnownAs) {
|
|
58
|
-
obj.alsoKnownAs = message.alsoKnownAs;
|
|
59
|
-
}
|
|
60
|
-
if (message.service) {
|
|
61
|
-
obj.service = message.service.map((e) => e ? { id: e.id, serviceEndpoint: e.serviceEndpoint, serviceType: e.type } : undefined);
|
|
62
|
-
}
|
|
63
|
-
message.versionId !== undefined && (obj.versionId = message.versionId);
|
|
64
|
-
return v2_1.MsgCreateDidDocPayload.fromPartial(obj);
|
|
65
|
-
},
|
|
66
|
-
fromPartial(object) {
|
|
67
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
68
|
-
const message = createBaseMsgCreateDidPayload();
|
|
69
|
-
message.context = ((_a = object.context) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
|
|
70
|
-
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : "";
|
|
71
|
-
message.controller = ((_c = object.controller) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
|
|
72
|
-
message.verificationMethod = ((_d = object.verificationMethod) === null || _d === void 0 ? void 0 : _d.map((e) => exports.VerificationMethodPayload.fromPartial(e))) || [];
|
|
73
|
-
message.authentication = ((_e = object.authentication) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || [];
|
|
74
|
-
message.assertionMethod = ((_f = object.assertionMethod) === null || _f === void 0 ? void 0 : _f.map((e) => e)) || [];
|
|
75
|
-
message.capabilityInvocation = ((_g = object.capabilityInvocation) === null || _g === void 0 ? void 0 : _g.map((e) => e)) || [];
|
|
76
|
-
message.capabilityDelegation = ((_h = object.capabilityDelegation) === null || _h === void 0 ? void 0 : _h.map((e) => e)) || [];
|
|
77
|
-
message.keyAgreement = ((_j = object.keyAgreement) === null || _j === void 0 ? void 0 : _j.map((e) => e)) || [];
|
|
78
|
-
message.alsoKnownAs = ((_k = object.alsoKnownAs) === null || _k === void 0 ? void 0 : _k.map((e) => e)) || [];
|
|
79
|
-
message.service = ((_l = object.service) === null || _l === void 0 ? void 0 : _l.map((e) => exports.ServicePayload.fromPartial(e))) || [];
|
|
80
|
-
message.versionId = (_m = object.versionId) !== null && _m !== void 0 ? _m : "";
|
|
81
|
-
return message;
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
function createBaseMsgCreateDidPayload() {
|
|
85
|
-
return {
|
|
86
|
-
context: [],
|
|
87
|
-
id: "",
|
|
88
|
-
controller: [],
|
|
89
|
-
verificationMethod: [],
|
|
90
|
-
authentication: [],
|
|
91
|
-
assertionMethod: [],
|
|
92
|
-
capabilityInvocation: [],
|
|
93
|
-
capabilityDelegation: [],
|
|
94
|
-
keyAgreement: [],
|
|
95
|
-
alsoKnownAs: [],
|
|
96
|
-
service: [],
|
|
97
|
-
versionId: "",
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
exports.VerificationMethodPayload = {
|
|
101
|
-
fromPartial(object) {
|
|
102
|
-
var _a, _b, _c;
|
|
103
|
-
const message = createBaseVerificationMethod();
|
|
104
|
-
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
105
|
-
message.type = (_b = object.type) !== null && _b !== void 0 ? _b : "";
|
|
106
|
-
message.controller = (_c = object.controller) !== null && _c !== void 0 ? _c : "";
|
|
107
|
-
if (object.publicKeyMultibase) {
|
|
108
|
-
message.publicKeyMultibase = object.publicKeyMultibase;
|
|
109
|
-
}
|
|
110
|
-
else if (object.publicKeyBase58) {
|
|
111
|
-
message.publicKeyBase58 = object.publicKeyBase58;
|
|
112
|
-
}
|
|
113
|
-
else if (object.publicKeyJWK) {
|
|
114
|
-
message.publicKeyJWK = object.publicKeyJWK;
|
|
115
|
-
}
|
|
116
|
-
return message;
|
|
117
|
-
},
|
|
118
|
-
transformPayload(payload) {
|
|
119
|
-
var _a, _b, _c;
|
|
120
|
-
return {
|
|
121
|
-
id: (_a = payload.id) !== null && _a !== void 0 ? _a : "",
|
|
122
|
-
controller: (_b = payload.controller) !== null && _b !== void 0 ? _b : "",
|
|
123
|
-
verificationMethodType: (_c = payload.type) !== null && _c !== void 0 ? _c : "",
|
|
124
|
-
verificationMaterial: payload.publicKeyBase58 || payload.publicKeyMultibase || JSON.stringify(payload.publicKeyJWK) || ""
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
function createBaseVerificationMethod() {
|
|
129
|
-
return { id: "", type: "", controller: "" };
|
|
130
|
-
}
|
|
131
|
-
exports.ServicePayload = {
|
|
132
|
-
fromPartial(object) {
|
|
133
|
-
var _a, _b, _c;
|
|
134
|
-
const message = createBaseService();
|
|
135
|
-
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
|
|
136
|
-
message.type = (_b = object.type) !== null && _b !== void 0 ? _b : "";
|
|
137
|
-
message.serviceEndpoint = ((_c = object.serviceEndpoint) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
|
|
138
|
-
return message;
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
function createBaseService() {
|
|
142
|
-
return { id: "", type: "", serviceEndpoint: [] };
|
|
143
|
-
}
|
|
144
25
|
//# sourceMappingURL=types.js.map
|
package/build/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAMA,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;AACvB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAmBD,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,iEAA0C,CAAA;IAC1C,iEAA0C,CAAA;IAC1C,6CAAsB,CAAA;AAC1B,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B;AAED,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC5B,4CAAoB,CAAA;IACpB,qCAAa,CAAA;AACjB,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B;AA2CY,QAAA,WAAW,GAAG;IACzB,WAAW,CAAC,MAAgB;QAC5B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,EAAE,CAAC,eAAe,IAAI,CAAC,CAAC,CAAA;IAC/C,CAAC;CACD,CAAA"}
|
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IKeyPair, IKeyValuePair, ISignInputs, VerificationMethods, MethodSpecificIdAlgo, TVerificationKey, TVerificationKeyPrefix, CheqdNetwork, IVerificationKeys,
|
|
1
|
+
import { IKeyPair, IKeyValuePair, ISignInputs, VerificationMethods, MethodSpecificIdAlgo, TVerificationKey, TVerificationKeyPrefix, CheqdNetwork, IVerificationKeys, VerificationMethod, DIDDocument, SpecValidationResult } from "./types";
|
|
2
2
|
import { KeyPair } from '@stablelib/ed25519';
|
|
3
3
|
export type TImportableEd25519Key = {
|
|
4
4
|
publicKeyHex: string;
|
|
@@ -6,13 +6,13 @@ export type TImportableEd25519Key = {
|
|
|
6
6
|
kid: string;
|
|
7
7
|
type: "Ed25519";
|
|
8
8
|
};
|
|
9
|
-
export type IdentifierPayload = Partial<MsgCreateDidPayload> | Partial<MsgUpdateDidPayload>;
|
|
10
9
|
export declare function isEqualKeyValuePair(kv1: IKeyValuePair[], kv2: IKeyValuePair[]): boolean;
|
|
11
|
-
export declare function createSignInputsFromImportableEd25519Key(key: TImportableEd25519Key, verificationMethod:
|
|
10
|
+
export declare function createSignInputsFromImportableEd25519Key(key: TImportableEd25519Key, verificationMethod: VerificationMethod[]): ISignInputs;
|
|
12
11
|
export declare function createKeyPairRaw(seed?: string): KeyPair;
|
|
13
12
|
export declare function createKeyPairBase64(seed?: string): IKeyPair;
|
|
14
13
|
export declare function createKeyPairHex(seed?: string): IKeyPair;
|
|
15
14
|
export declare function createVerificationKeys(publicKey: string, algo: MethodSpecificIdAlgo, key: TVerificationKey<TVerificationKeyPrefix, number>, network?: CheqdNetwork): IVerificationKeys;
|
|
16
|
-
export declare function createDidVerificationMethod(verificationMethodTypes: VerificationMethods[], verificationKeys: IVerificationKeys[]):
|
|
17
|
-
export declare function createDidPayload(verificationMethods:
|
|
15
|
+
export declare function createDidVerificationMethod(verificationMethodTypes: VerificationMethods[], verificationKeys: IVerificationKeys[]): VerificationMethod[];
|
|
16
|
+
export declare function createDidPayload(verificationMethods: VerificationMethod[], verificationKeys: IVerificationKeys[]): DIDDocument;
|
|
17
|
+
export declare function validateSpecCompliantPayload(didDocument: DIDDocument): SpecValidationResult;
|
|
18
18
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,aAAa,EACb,WAAW,EACX,mBAAmB,EAEnB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,aAAa,EACb,WAAW,EACX,mBAAmB,EAEnB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EAEvB,MAAM,SAAS,CAAA;AAIhB,OAAO,EAA4C,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAQtF,MAAM,MAAM,qBAAqB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,SAAS,CA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