@0xpolygonid/js-sdk 1.8.1 → 1.8.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/dist/browser/esm/index.js +50 -14
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +50 -14
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/credentials/credential-wallet.js +10 -0
- package/dist/node/cjs/iden3comm/handlers/auth.js +5 -3
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +1 -0
- package/dist/node/cjs/identity/identity-wallet.js +31 -6
- package/dist/node/cjs/proof/provers/inputs-generator.js +3 -5
- package/dist/node/esm/credentials/credential-wallet.js +10 -0
- package/dist/node/esm/iden3comm/handlers/auth.js +5 -3
- package/dist/node/esm/iden3comm/handlers/contract-request.js +1 -0
- package/dist/node/esm/identity/identity-wallet.js +32 -7
- package/dist/node/esm/proof/provers/inputs-generator.js +3 -5
- package/dist/types/credentials/credential-wallet.d.ts +12 -1
- package/dist/types/iden3comm/types/protocol/auth.d.ts +5 -1
- package/dist/types/identity/identity-wallet.d.ts +24 -0
- package/package.json +1 -1
|
@@ -115,6 +115,16 @@ class CredentialWallet {
|
|
|
115
115
|
}
|
|
116
116
|
throw new Error('all auth bjj credentials are revoked');
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* {@inheritDoc ICredentialWallet.getAllAuthBJJCredentials}
|
|
120
|
+
*/
|
|
121
|
+
async getAllAuthBJJCredentials(did) {
|
|
122
|
+
return this._storage.credential.findCredentialsByQuery({
|
|
123
|
+
context: verifiable_1.VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL,
|
|
124
|
+
type: verifiable_1.VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_TYPE,
|
|
125
|
+
allowedIssuers: [did.string()]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
118
128
|
/**
|
|
119
129
|
* {@inheritDoc ICredentialWallet.getRevocationStatusFromCredential}
|
|
120
130
|
*/
|
|
@@ -97,6 +97,7 @@ class AuthHandler {
|
|
|
97
97
|
if (message.type !== constants_2.PROTOCOL_MESSAGE_TYPE.AUTHORIZATION_REQUEST_MESSAGE_TYPE) {
|
|
98
98
|
throw new Error('Invalid media type');
|
|
99
99
|
}
|
|
100
|
+
authRequest.body.scope = authRequest.body.scope || [];
|
|
100
101
|
return authRequest;
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
@@ -208,7 +209,8 @@ class AuthHandler {
|
|
|
208
209
|
throw new Error(`sender of the request is not a target of response - expected ${request.from}, given ${response.to}`);
|
|
209
210
|
}
|
|
210
211
|
this.verifyAuthRequest(request);
|
|
211
|
-
const requestScope = request.body.scope;
|
|
212
|
+
const requestScope = request.body.scope || [];
|
|
213
|
+
const responseScope = response.body.scope || [];
|
|
212
214
|
if (!response.from) {
|
|
213
215
|
throw new Error(`proof response doesn't contain from field`);
|
|
214
216
|
}
|
|
@@ -216,7 +218,7 @@ class AuthHandler {
|
|
|
216
218
|
// group requests by query group id
|
|
217
219
|
for (const proofRequest of requestScope) {
|
|
218
220
|
const groupId = proofRequest.query.groupId;
|
|
219
|
-
const proofResp =
|
|
221
|
+
const proofResp = responseScope.find((resp) => resp.id === proofRequest.id);
|
|
220
222
|
if (!proofResp) {
|
|
221
223
|
throw new Error(`proof is not given for requestId ${proofRequest.id}`);
|
|
222
224
|
}
|
|
@@ -252,7 +254,7 @@ class AuthHandler {
|
|
|
252
254
|
}
|
|
253
255
|
verifyAuthRequest(request) {
|
|
254
256
|
const groupIdValidationMap = {};
|
|
255
|
-
const requestScope = request.body.scope;
|
|
257
|
+
const requestScope = request.body.scope || [];
|
|
256
258
|
for (const proofRequest of requestScope) {
|
|
257
259
|
const groupId = proofRequest.query.groupId;
|
|
258
260
|
if (groupId) {
|
|
@@ -44,6 +44,7 @@ class ContractRequestHandler {
|
|
|
44
44
|
if (message.type !== constants_1.PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE) {
|
|
45
45
|
throw new Error('Invalid media type');
|
|
46
46
|
}
|
|
47
|
+
ciRequest.body.scope = ciRequest.body.scope || [];
|
|
47
48
|
return ciRequest;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
@@ -61,13 +61,19 @@ class IdentityWallet {
|
|
|
61
61
|
this._storage = _storage;
|
|
62
62
|
this._credentialWallet = _credentialWallet;
|
|
63
63
|
this._opts = _opts;
|
|
64
|
+
this._credentialStatusPublisherRegistry = this.getCredentialStatusPublisherRegistry(_opts);
|
|
65
|
+
}
|
|
66
|
+
getCredentialStatusPublisherRegistry(_opts) {
|
|
64
67
|
if (!_opts?.credentialStatusPublisherRegistry) {
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
const registry = new credential_status_publisher_1.CredentialStatusPublisherRegistry();
|
|
69
|
+
const emptyPublisher = { publish: () => Promise.resolve() };
|
|
70
|
+
registry.register(verifiable_1.CredentialStatusType.Iden3ReverseSparseMerkleTreeProof, new credential_status_publisher_1.Iden3SmtRhsCredentialStatusPublisher());
|
|
71
|
+
registry.register(verifiable_1.CredentialStatusType.SparseMerkleTreeProof, emptyPublisher);
|
|
72
|
+
registry.register(verifiable_1.CredentialStatusType.Iden3commRevocationStatusV1, emptyPublisher);
|
|
73
|
+
return registry;
|
|
67
74
|
}
|
|
68
75
|
else {
|
|
69
|
-
|
|
70
|
-
?.credentialStatusPublisherRegistry;
|
|
76
|
+
return this._opts?.credentialStatusPublisherRegistry;
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
@@ -305,7 +311,7 @@ class IdentityWallet {
|
|
|
305
311
|
catch (e) {
|
|
306
312
|
throw new Error(`Error create w3c credential ${e.message}`);
|
|
307
313
|
}
|
|
308
|
-
const issuerAuthBJJCredential = await this.
|
|
314
|
+
const { authCredential: issuerAuthBJJCredential } = await this.getActualAuthCredential(issuerDID);
|
|
309
315
|
const coreClaimOpts = {
|
|
310
316
|
revNonce: req.revocationOpts.nonce,
|
|
311
317
|
subjectPosition: req.subjectPosition,
|
|
@@ -314,7 +320,7 @@ class IdentityWallet {
|
|
|
314
320
|
version: 0,
|
|
315
321
|
merklizeOpts: { ...opts, documentLoader: loader }
|
|
316
322
|
};
|
|
317
|
-
const coreClaim = await
|
|
323
|
+
const coreClaim = await credential.toCoreClaim(coreClaimOpts);
|
|
318
324
|
const { hi, hv } = coreClaim.hiHv();
|
|
319
325
|
const coreClaimHash = js_crypto_1.poseidon.hash([hi, hv]);
|
|
320
326
|
const signature = await this.signChallenge(coreClaimHash, issuerAuthBJJCredential);
|
|
@@ -339,6 +345,25 @@ class IdentityWallet {
|
|
|
339
345
|
credential.proof = [sigProof];
|
|
340
346
|
return credential;
|
|
341
347
|
}
|
|
348
|
+
/** {@inheritDoc IIdentityWallet.getActualAuthCredential} */
|
|
349
|
+
async getActualAuthCredential(did, treeStateInfo) {
|
|
350
|
+
const authCredentials = await this._credentialWallet.getAllAuthBJJCredentials(did);
|
|
351
|
+
for (let i = 0; i < authCredentials.length; i++) {
|
|
352
|
+
const incProof = await this.generateCredentialMtp(did, authCredentials[i], treeStateInfo);
|
|
353
|
+
if (!incProof.proof.existence) {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
const nonRevProof = await this.generateNonRevocationMtp(did, authCredentials[i], treeStateInfo);
|
|
357
|
+
if (!nonRevProof.proof.existence) {
|
|
358
|
+
return {
|
|
359
|
+
authCredential: authCredentials[i],
|
|
360
|
+
incProof,
|
|
361
|
+
nonRevProof
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
throw new Error('no auth credentials found');
|
|
366
|
+
}
|
|
342
367
|
/** {@inheritDoc IIdentityWallet.revokeCredential} */
|
|
343
368
|
async revokeCredential(issuerDID, credential) {
|
|
344
369
|
const issuerTree = await this.getDIDTreeModel(issuerDID);
|
|
@@ -265,8 +265,8 @@ class InputGenerator {
|
|
|
265
265
|
circuitInputs.proofType = proofType;
|
|
266
266
|
circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
|
|
267
267
|
circuitInputs.verifierID = params.verifierDid ? js_iden3_core_1.DID.idFromDID(params.verifierDid) : undefined;
|
|
268
|
-
circuitInputs.nullifierSessionID = proofReq.params?.
|
|
269
|
-
? BigInt(proofReq.params?.
|
|
268
|
+
circuitInputs.nullifierSessionID = proofReq.params?.nullifierSessionId
|
|
269
|
+
? BigInt(proofReq.params?.nullifierSessionId?.toString())
|
|
270
270
|
: BigInt(0);
|
|
271
271
|
let isEthIdentity = true;
|
|
272
272
|
try {
|
|
@@ -375,9 +375,7 @@ class InputGenerator {
|
|
|
375
375
|
return circuitClaim;
|
|
376
376
|
}
|
|
377
377
|
async prepareAuthBJJCredential(did, treeStateInfo) {
|
|
378
|
-
const authCredential = await this.
|
|
379
|
-
const incProof = await this._identityWallet.generateCredentialMtp(did, authCredential, treeStateInfo);
|
|
380
|
-
const nonRevProof = await this._identityWallet.generateNonRevocationMtp(did, authCredential, treeStateInfo);
|
|
378
|
+
const { authCredential, incProof, nonRevProof } = await this._identityWallet.getActualAuthCredential(did, treeStateInfo);
|
|
381
379
|
const authCoreClaim = authCredential.getCoreClaimFromProof(verifiable_1.ProofType.Iden3SparseMerkleTreeProof);
|
|
382
380
|
if (!authCoreClaim) {
|
|
383
381
|
throw new Error('auth core claim is not defined for auth bjj credential');
|
|
@@ -89,6 +89,16 @@ export class CredentialWallet {
|
|
|
89
89
|
}
|
|
90
90
|
throw new Error('all auth bjj credentials are revoked');
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc ICredentialWallet.getAllAuthBJJCredentials}
|
|
94
|
+
*/
|
|
95
|
+
async getAllAuthBJJCredentials(did) {
|
|
96
|
+
return this._storage.credential.findCredentialsByQuery({
|
|
97
|
+
context: VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL,
|
|
98
|
+
type: VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_TYPE,
|
|
99
|
+
allowedIssuers: [did.string()]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
92
102
|
/**
|
|
93
103
|
* {@inheritDoc ICredentialWallet.getRevocationStatusFromCredential}
|
|
94
104
|
*/
|
|
@@ -69,6 +69,7 @@ export class AuthHandler {
|
|
|
69
69
|
if (message.type !== PROTOCOL_MESSAGE_TYPE.AUTHORIZATION_REQUEST_MESSAGE_TYPE) {
|
|
70
70
|
throw new Error('Invalid media type');
|
|
71
71
|
}
|
|
72
|
+
authRequest.body.scope = authRequest.body.scope || [];
|
|
72
73
|
return authRequest;
|
|
73
74
|
}
|
|
74
75
|
/**
|
|
@@ -180,7 +181,8 @@ export class AuthHandler {
|
|
|
180
181
|
throw new Error(`sender of the request is not a target of response - expected ${request.from}, given ${response.to}`);
|
|
181
182
|
}
|
|
182
183
|
this.verifyAuthRequest(request);
|
|
183
|
-
const requestScope = request.body.scope;
|
|
184
|
+
const requestScope = request.body.scope || [];
|
|
185
|
+
const responseScope = response.body.scope || [];
|
|
184
186
|
if (!response.from) {
|
|
185
187
|
throw new Error(`proof response doesn't contain from field`);
|
|
186
188
|
}
|
|
@@ -188,7 +190,7 @@ export class AuthHandler {
|
|
|
188
190
|
// group requests by query group id
|
|
189
191
|
for (const proofRequest of requestScope) {
|
|
190
192
|
const groupId = proofRequest.query.groupId;
|
|
191
|
-
const proofResp =
|
|
193
|
+
const proofResp = responseScope.find((resp) => resp.id === proofRequest.id);
|
|
192
194
|
if (!proofResp) {
|
|
193
195
|
throw new Error(`proof is not given for requestId ${proofRequest.id}`);
|
|
194
196
|
}
|
|
@@ -224,7 +226,7 @@ export class AuthHandler {
|
|
|
224
226
|
}
|
|
225
227
|
verifyAuthRequest(request) {
|
|
226
228
|
const groupIdValidationMap = {};
|
|
227
|
-
const requestScope = request.body.scope;
|
|
229
|
+
const requestScope = request.body.scope || [];
|
|
228
230
|
for (const proofRequest of requestScope) {
|
|
229
231
|
const groupId = proofRequest.query.groupId;
|
|
230
232
|
if (groupId) {
|
|
@@ -4,7 +4,7 @@ import { poseidon, PublicKey, sha256, Signature, Hex, getRandomBytes } from '@id
|
|
|
4
4
|
import { hashElems, ZERO_HASH } from '@iden3/js-merkletree';
|
|
5
5
|
import { generateProfileDID, subjectPositionIndex } from './common';
|
|
6
6
|
import * as uuid from 'uuid';
|
|
7
|
-
import {
|
|
7
|
+
import { JsonSchemaValidator, cacheLoader } from '../schema-processor';
|
|
8
8
|
import { MerkleTreeType } from '../storage';
|
|
9
9
|
import { VerifiableConstants, BJJSignatureProof2021, MerklizedRootPosition, SubjectPosition, W3CCredential, Iden3SparseMerkleTreeProof, ProofType, CredentialStatusType } from '../verifiable';
|
|
10
10
|
import { getKMSIdByAuthCredential, getNodesRepresentation, pushHashesToRHS } from '../credentials';
|
|
@@ -35,13 +35,19 @@ export class IdentityWallet {
|
|
|
35
35
|
this._storage = _storage;
|
|
36
36
|
this._credentialWallet = _credentialWallet;
|
|
37
37
|
this._opts = _opts;
|
|
38
|
+
this._credentialStatusPublisherRegistry = this.getCredentialStatusPublisherRegistry(_opts);
|
|
39
|
+
}
|
|
40
|
+
getCredentialStatusPublisherRegistry(_opts) {
|
|
38
41
|
if (!_opts?.credentialStatusPublisherRegistry) {
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
const registry = new CredentialStatusPublisherRegistry();
|
|
43
|
+
const emptyPublisher = { publish: () => Promise.resolve() };
|
|
44
|
+
registry.register(CredentialStatusType.Iden3ReverseSparseMerkleTreeProof, new Iden3SmtRhsCredentialStatusPublisher());
|
|
45
|
+
registry.register(CredentialStatusType.SparseMerkleTreeProof, emptyPublisher);
|
|
46
|
+
registry.register(CredentialStatusType.Iden3commRevocationStatusV1, emptyPublisher);
|
|
47
|
+
return registry;
|
|
41
48
|
}
|
|
42
49
|
else {
|
|
43
|
-
|
|
44
|
-
?.credentialStatusPublisherRegistry;
|
|
50
|
+
return this._opts?.credentialStatusPublisherRegistry;
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
@@ -279,7 +285,7 @@ export class IdentityWallet {
|
|
|
279
285
|
catch (e) {
|
|
280
286
|
throw new Error(`Error create w3c credential ${e.message}`);
|
|
281
287
|
}
|
|
282
|
-
const issuerAuthBJJCredential = await this.
|
|
288
|
+
const { authCredential: issuerAuthBJJCredential } = await this.getActualAuthCredential(issuerDID);
|
|
283
289
|
const coreClaimOpts = {
|
|
284
290
|
revNonce: req.revocationOpts.nonce,
|
|
285
291
|
subjectPosition: req.subjectPosition,
|
|
@@ -288,7 +294,7 @@ export class IdentityWallet {
|
|
|
288
294
|
version: 0,
|
|
289
295
|
merklizeOpts: { ...opts, documentLoader: loader }
|
|
290
296
|
};
|
|
291
|
-
const coreClaim = await
|
|
297
|
+
const coreClaim = await credential.toCoreClaim(coreClaimOpts);
|
|
292
298
|
const { hi, hv } = coreClaim.hiHv();
|
|
293
299
|
const coreClaimHash = poseidon.hash([hi, hv]);
|
|
294
300
|
const signature = await this.signChallenge(coreClaimHash, issuerAuthBJJCredential);
|
|
@@ -313,6 +319,25 @@ export class IdentityWallet {
|
|
|
313
319
|
credential.proof = [sigProof];
|
|
314
320
|
return credential;
|
|
315
321
|
}
|
|
322
|
+
/** {@inheritDoc IIdentityWallet.getActualAuthCredential} */
|
|
323
|
+
async getActualAuthCredential(did, treeStateInfo) {
|
|
324
|
+
const authCredentials = await this._credentialWallet.getAllAuthBJJCredentials(did);
|
|
325
|
+
for (let i = 0; i < authCredentials.length; i++) {
|
|
326
|
+
const incProof = await this.generateCredentialMtp(did, authCredentials[i], treeStateInfo);
|
|
327
|
+
if (!incProof.proof.existence) {
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
const nonRevProof = await this.generateNonRevocationMtp(did, authCredentials[i], treeStateInfo);
|
|
331
|
+
if (!nonRevProof.proof.existence) {
|
|
332
|
+
return {
|
|
333
|
+
authCredential: authCredentials[i],
|
|
334
|
+
incProof,
|
|
335
|
+
nonRevProof
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
throw new Error('no auth credentials found');
|
|
340
|
+
}
|
|
316
341
|
/** {@inheritDoc IIdentityWallet.revokeCredential} */
|
|
317
342
|
async revokeCredential(issuerDID, credential) {
|
|
318
343
|
const issuerTree = await this.getDIDTreeModel(issuerDID);
|
|
@@ -262,8 +262,8 @@ export class InputGenerator {
|
|
|
262
262
|
circuitInputs.proofType = proofType;
|
|
263
263
|
circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
|
|
264
264
|
circuitInputs.verifierID = params.verifierDid ? DID.idFromDID(params.verifierDid) : undefined;
|
|
265
|
-
circuitInputs.nullifierSessionID = proofReq.params?.
|
|
266
|
-
? BigInt(proofReq.params?.
|
|
265
|
+
circuitInputs.nullifierSessionID = proofReq.params?.nullifierSessionId
|
|
266
|
+
? BigInt(proofReq.params?.nullifierSessionId?.toString())
|
|
267
267
|
: BigInt(0);
|
|
268
268
|
let isEthIdentity = true;
|
|
269
269
|
try {
|
|
@@ -372,9 +372,7 @@ export class InputGenerator {
|
|
|
372
372
|
return circuitClaim;
|
|
373
373
|
}
|
|
374
374
|
async prepareAuthBJJCredential(did, treeStateInfo) {
|
|
375
|
-
const authCredential = await this.
|
|
376
|
-
const incProof = await this._identityWallet.generateCredentialMtp(did, authCredential, treeStateInfo);
|
|
377
|
-
const nonRevProof = await this._identityWallet.generateNonRevocationMtp(did, authCredential, treeStateInfo);
|
|
375
|
+
const { authCredential, incProof, nonRevProof } = await this._identityWallet.getActualAuthCredential(did, treeStateInfo);
|
|
378
376
|
const authCoreClaim = authCredential.getCoreClaimFromProof(ProofType.Iden3SparseMerkleTreeProof);
|
|
379
377
|
if (!authCoreClaim) {
|
|
380
378
|
throw new Error('auth core claim is not defined for auth bjj credential');
|
|
@@ -68,12 +68,19 @@ export interface ICredentialWallet {
|
|
|
68
68
|
*/
|
|
69
69
|
filterByCredentialSubject(credentials: W3CCredential[], subject: DID): Promise<W3CCredential[]>;
|
|
70
70
|
/**
|
|
71
|
-
* Finds Auth BJJ credential for given user
|
|
71
|
+
* Finds first non-revoked Auth BJJ credential for given user
|
|
72
72
|
*
|
|
73
73
|
* @param {DID} did - the issuer of Auth BJJ credential
|
|
74
74
|
* @returns `Promise<W3CCredential>` W3CCredential with AuthBJJCredential type
|
|
75
75
|
*/
|
|
76
76
|
getAuthBJJCredential(did: DID): Promise<W3CCredential>;
|
|
77
|
+
/**
|
|
78
|
+
* Finds all Auth BJJ credentials for given user
|
|
79
|
+
*
|
|
80
|
+
* @param {DID} did - the issuer of Auth BJJ credential
|
|
81
|
+
* @returns `Promise<W3CCredential[]>` W3CCredentials with AuthBJJCredential type
|
|
82
|
+
*/
|
|
83
|
+
getAllAuthBJJCredentials(did: DID): Promise<W3CCredential[]>;
|
|
77
84
|
/**
|
|
78
85
|
* Fetches or Builds a revocation status for a given credential
|
|
79
86
|
* Supported types for credentialStatus field: SparseMerkleTreeProof, Iden3ReverseSparseMerkleTreeProof
|
|
@@ -137,6 +144,10 @@ export declare class CredentialWallet implements ICredentialWallet {
|
|
|
137
144
|
* {@inheritDoc ICredentialWallet.getAuthBJJCredential}
|
|
138
145
|
*/
|
|
139
146
|
getAuthBJJCredential(did: DID): Promise<W3CCredential>;
|
|
147
|
+
/**
|
|
148
|
+
* {@inheritDoc ICredentialWallet.getAllAuthBJJCredentials}
|
|
149
|
+
*/
|
|
150
|
+
getAllAuthBJJCredentials(did: DID): Promise<W3CCredential[]>;
|
|
140
151
|
/**
|
|
141
152
|
* {@inheritDoc ICredentialWallet.getRevocationStatusFromCredential}
|
|
142
153
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ZKProof } from '@iden3/js-jwz';
|
|
2
2
|
import { MediaType } from '../../constants';
|
|
3
3
|
import { JSONObject, ProtocolMessage } from '../packer';
|
|
4
|
+
import { DID } from '@iden3/js-iden3-core';
|
|
4
5
|
/** AuthorizationResponseMessage is struct the represents iden3message authorization response */
|
|
5
6
|
export type AuthorizationResponseMessage = {
|
|
6
7
|
id: string;
|
|
@@ -41,7 +42,10 @@ export type ZeroKnowledgeProofRequest = {
|
|
|
41
42
|
circuitId: string;
|
|
42
43
|
optional?: boolean;
|
|
43
44
|
query: JSONObject;
|
|
44
|
-
params?:
|
|
45
|
+
params?: {
|
|
46
|
+
nullifierSessionId?: string | number;
|
|
47
|
+
verifierDid?: DID;
|
|
48
|
+
};
|
|
45
49
|
};
|
|
46
50
|
/** ZeroKnowledgeProofResponse represents structure of zkp response */
|
|
47
51
|
export type ZeroKnowledgeProofResponse = {
|
|
@@ -247,6 +247,23 @@ export interface IIdentityWallet {
|
|
|
247
247
|
* @returns `{Promise<void>}`
|
|
248
248
|
*/
|
|
249
249
|
updateIdentityState(issuerDID: DID, published: boolean, treeState?: TreeState): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
*
|
|
252
|
+
* gets actual auth credential with proofs for provided tree state or latest from the trees.
|
|
253
|
+
*
|
|
254
|
+
* @param {DID} issuerDID - identifier of the issuer
|
|
255
|
+
* @param {TreeState} treeStateInfo - optional, state for retrieval
|
|
256
|
+
* @returns `{Promise<{
|
|
257
|
+
authCredential: W3CCredential;
|
|
258
|
+
incProof: MerkleTreeProofWithTreeState;
|
|
259
|
+
nonRevProof: MerkleTreeProofWithTreeState;
|
|
260
|
+
}>}`
|
|
261
|
+
*/
|
|
262
|
+
getActualAuthCredential(did: DID, treeStateInfo?: TreeState): Promise<{
|
|
263
|
+
authCredential: W3CCredential;
|
|
264
|
+
incProof: MerkleTreeProofWithTreeState;
|
|
265
|
+
nonRevProof: MerkleTreeProofWithTreeState;
|
|
266
|
+
}>;
|
|
250
267
|
}
|
|
251
268
|
/**
|
|
252
269
|
* @public
|
|
@@ -276,6 +293,7 @@ export declare class IdentityWallet implements IIdentityWallet {
|
|
|
276
293
|
constructor(_kms: KMS, _storage: IDataStorage, _credentialWallet: ICredentialWallet, _opts?: {
|
|
277
294
|
credentialStatusPublisherRegistry?: CredentialStatusPublisherRegistry | undefined;
|
|
278
295
|
} | undefined);
|
|
296
|
+
private getCredentialStatusPublisherRegistry;
|
|
279
297
|
/**
|
|
280
298
|
* {@inheritDoc IIdentityWallet.createIdentity}
|
|
281
299
|
*/
|
|
@@ -313,6 +331,12 @@ export declare class IdentityWallet implements IIdentityWallet {
|
|
|
313
331
|
signChallenge(challenge: bigint, credential: W3CCredential): Promise<Signature>;
|
|
314
332
|
/** {@inheritDoc IIdentityWallet.issueCredential} */
|
|
315
333
|
issueCredential(issuerDID: DID, req: CredentialRequest, opts?: Options): Promise<W3CCredential>;
|
|
334
|
+
/** {@inheritDoc IIdentityWallet.getActualAuthCredential} */
|
|
335
|
+
getActualAuthCredential(did: DID, treeStateInfo?: TreeState): Promise<{
|
|
336
|
+
authCredential: W3CCredential;
|
|
337
|
+
incProof: MerkleTreeProofWithTreeState;
|
|
338
|
+
nonRevProof: MerkleTreeProofWithTreeState;
|
|
339
|
+
}>;
|
|
316
340
|
/** {@inheritDoc IIdentityWallet.revokeCredential} */
|
|
317
341
|
revokeCredential(issuerDID: DID, credential: W3CCredential): Promise<number>;
|
|
318
342
|
/** {@inheritDoc IIdentityWallet.addCredentialsToMerkleTree} */
|