@0xpolygonid/js-sdk 1.6.1 → 1.7.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/README.md +3 -1
- package/dist/browser/esm/index.js +738 -491
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +784 -531
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/circuits/comparer.js +3 -3
- package/dist/node/cjs/credentials/credential-wallet.js +19 -2
- package/dist/node/cjs/credentials/index.js +1 -0
- package/dist/node/cjs/credentials/rhs.js +28 -15
- package/dist/node/cjs/credentials/status/credential-status-publisher.js +84 -0
- package/dist/node/cjs/credentials/utils.js +14 -1
- package/dist/node/cjs/identity/identity-wallet.js +57 -26
- package/dist/node/cjs/storage/blockchain/abi/CredentialStatusResolver.json +1 -1
- package/dist/node/cjs/storage/blockchain/index.js +1 -0
- package/dist/node/cjs/storage/blockchain/onchain-revocation.js +45 -5
- package/dist/node/esm/circuits/comparer.js +3 -3
- package/dist/node/esm/credentials/credential-wallet.js +20 -3
- package/dist/node/esm/credentials/index.js +1 -0
- package/dist/node/esm/credentials/rhs.js +26 -14
- package/dist/node/esm/credentials/status/credential-status-publisher.js +78 -0
- package/dist/node/esm/credentials/utils.js +12 -0
- package/dist/node/esm/identity/identity-wallet.js +52 -21
- package/dist/node/esm/storage/blockchain/abi/CredentialStatusResolver.json +1 -1
- package/dist/node/esm/storage/blockchain/index.js +1 -0
- package/dist/node/esm/storage/blockchain/onchain-revocation.js +45 -5
- package/dist/types/credentials/index.d.ts +1 -0
- package/dist/types/credentials/rhs.d.ts +11 -0
- package/dist/types/credentials/status/credential-status-publisher.d.ts +70 -0
- package/dist/types/credentials/utils.d.ts +2 -0
- package/dist/types/identity/identity-wallet.d.ts +42 -13
- package/dist/types/storage/blockchain/index.d.ts +1 -0
- package/dist/types/storage/blockchain/onchain-revocation.d.ts +7 -3
- package/package.json +1 -1
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { KMS, KmsKeyId, KmsKeyType } from '../kms';
|
|
2
2
|
import { Claim, DID } from '@iden3/js-iden3-core';
|
|
3
3
|
import { Signature } from '@iden3/js-crypto';
|
|
4
|
-
import { IDataStorage } from '../storage
|
|
4
|
+
import { IDataStorage, Profile } from '../storage';
|
|
5
5
|
import { W3CCredential, MerkleTreeProofWithTreeState, CredentialStatusType, ProofQuery } from '../verifiable';
|
|
6
6
|
import { CredentialRequest, ICredentialWallet, TreesModel } from '../credentials';
|
|
7
7
|
import { TreeState } from '../circuits';
|
|
8
8
|
import { Options } from '@iden3/js-jsonld-merklization';
|
|
9
|
-
import {
|
|
9
|
+
import { TransactionReceipt } from 'ethers';
|
|
10
|
+
import { CredentialStatusPublisherRegistry } from '../credentials/status/credential-status-publisher';
|
|
10
11
|
/**
|
|
11
12
|
* DID creation options
|
|
12
|
-
* seed - seed to generate BJJ
|
|
13
|
+
* seed - seed to generate BJJ key pair
|
|
13
14
|
* revocationOpts -
|
|
14
15
|
|
|
15
|
-
* @
|
|
16
|
+
* @type IdentityCreationOptions
|
|
16
17
|
*/
|
|
17
|
-
export
|
|
18
|
+
export type IdentityCreationOptions = {
|
|
18
19
|
method?: string;
|
|
19
20
|
blockchain?: string;
|
|
20
21
|
networkId?: string;
|
|
@@ -22,9 +23,23 @@ export interface IdentityCreationOptions {
|
|
|
22
23
|
id: string;
|
|
23
24
|
type: CredentialStatusType;
|
|
24
25
|
nonce?: number;
|
|
26
|
+
onChain?: {
|
|
27
|
+
txCallback?: (tx: TransactionReceipt) => Promise<void>;
|
|
28
|
+
};
|
|
25
29
|
};
|
|
26
30
|
seed?: Uint8Array;
|
|
27
|
-
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Options for RevocationInfoOptions.
|
|
34
|
+
*/
|
|
35
|
+
export type RevocationInfoOptions = {
|
|
36
|
+
revokedNonces?: number[];
|
|
37
|
+
treeModel?: TreesModel;
|
|
38
|
+
rhsUrl?: string;
|
|
39
|
+
onChain?: {
|
|
40
|
+
txCallback?: (tx: TransactionReceipt) => Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
28
43
|
/**
|
|
29
44
|
* Proof creation result
|
|
30
45
|
*
|
|
@@ -151,23 +166,32 @@ export interface IIdentityWallet {
|
|
|
151
166
|
*/
|
|
152
167
|
addCredentialsToMerkleTree(credentials: W3CCredential[], issuerDID: DID): Promise<Iden3ProofCreationResult>;
|
|
153
168
|
/**
|
|
169
|
+
* Publishes issuer state to the reverse hash service by given URL
|
|
154
170
|
*
|
|
155
|
-
*
|
|
171
|
+
* @deprecated use publishRevocationInfoByCredentialStatusType instead with the same arguments in opts
|
|
156
172
|
* @param {DID} issuerDID - issuer did
|
|
157
173
|
* @param {string} rhsURL - reverse hash service URL
|
|
158
174
|
* @param {number[]} [revokedNonces] - revoked nonces for the period from the last published
|
|
159
175
|
* @returns `Promise<void>`
|
|
160
176
|
*/
|
|
161
|
-
publishStateToRHS(issuerDID: DID, rhsURL: string, revokedNonces?: number[]): Promise<void>;
|
|
177
|
+
publishStateToRHS(issuerDID: DID, rhsURL: string, revokedNonces?: number[], opts?: object): Promise<void>;
|
|
162
178
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
179
|
+
* Publishes specific state to the reverse hash service by given URL
|
|
180
|
+
* @deprecated use publishRevocationInfoByCredentialStatusType instead with the same arguments in opts
|
|
165
181
|
* @param {TreesModel} treeModel - trees model to publish
|
|
166
182
|
* @param {string} rhsURL - reverse hash service URL
|
|
167
183
|
* @param {number[]} [revokedNonces] - revoked nonces for the period from the last published
|
|
168
184
|
* @returns `Promise<void>`
|
|
169
185
|
*/
|
|
170
|
-
publishSpecificStateToRHS(treeModel: TreesModel, rhsURL: string, revokedNonces?: number[]): Promise<void>;
|
|
186
|
+
publishSpecificStateToRHS(treeModel: TreesModel, rhsURL: string, revokedNonces?: number[], opts?: object): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* Publishes revocation info by credential status predefined publishers
|
|
189
|
+
*
|
|
190
|
+
* @param {(RevocationInfoOptions)} opts
|
|
191
|
+
* @returns {Promise<void>}
|
|
192
|
+
* @memberof IIdentityWallet
|
|
193
|
+
*/
|
|
194
|
+
publishRevocationInfoByCredentialStatusType(issuerDID: DID, credentialStatusType: CredentialStatusType, opts?: RevocationInfoOptions): Promise<void>;
|
|
171
195
|
/**
|
|
172
196
|
* Extracts core claim from signature or merkle tree proof. If both proof persists core claim must be the same
|
|
173
197
|
*
|
|
@@ -237,6 +261,8 @@ export declare class IdentityWallet implements IIdentityWallet {
|
|
|
237
261
|
private readonly _kms;
|
|
238
262
|
private readonly _storage;
|
|
239
263
|
private readonly _credentialWallet;
|
|
264
|
+
private readonly _opts?;
|
|
265
|
+
private readonly _credentialStatusPublisherRegistry;
|
|
240
266
|
/**
|
|
241
267
|
* Constructs a new instance of the `IdentityWallet` class
|
|
242
268
|
*
|
|
@@ -245,7 +271,9 @@ export declare class IdentityWallet implements IIdentityWallet {
|
|
|
245
271
|
* @param {ICredentialWallet} _credentialWallet - credential wallet instance to quickly access credential CRUD functionality
|
|
246
272
|
* @public
|
|
247
273
|
*/
|
|
248
|
-
constructor(_kms: KMS, _storage: IDataStorage, _credentialWallet: ICredentialWallet
|
|
274
|
+
constructor(_kms: KMS, _storage: IDataStorage, _credentialWallet: ICredentialWallet, _opts?: {
|
|
275
|
+
credentialStatusPublisherRegistry?: CredentialStatusPublisherRegistry | undefined;
|
|
276
|
+
} | undefined);
|
|
249
277
|
/**
|
|
250
278
|
* {@inheritDoc IIdentityWallet.createIdentity}
|
|
251
279
|
*/
|
|
@@ -293,7 +321,8 @@ export declare class IdentityWallet implements IIdentityWallet {
|
|
|
293
321
|
publishSpecificStateToRHS(treeModel: TreesModel, rhsURL: string, revokedNonces?: number[]): Promise<void>;
|
|
294
322
|
/** {@inheritDoc IIdentityWallet.publishStateToRHS} */
|
|
295
323
|
publishStateToRHS(issuerDID: DID, rhsURL: string, revokedNonces?: number[]): Promise<void>;
|
|
296
|
-
|
|
324
|
+
/** {@inheritDoc IIdentityWallet.publishRevocationInfoByCredentialStatusType} */
|
|
325
|
+
publishRevocationInfoByCredentialStatusType(issuerDID: DID, credentialStatusType: CredentialStatusType, opts?: RevocationInfoOptions): Promise<void>;
|
|
297
326
|
getCoreClaimFromCredential(credential: W3CCredential): Promise<Claim>;
|
|
298
327
|
findOwnedCredentialsByDID(did: DID, query: ProofQuery): Promise<W3CCredential[]>;
|
|
299
328
|
/** {@inheritDoc IIdentityWallet.updateIdentityState} */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RevocationStatus } from '../../verifiable';
|
|
2
|
+
import { Signer, TransactionReceipt } from 'ethers';
|
|
2
3
|
import { EthConnectionConfig } from './state';
|
|
3
4
|
/**
|
|
4
5
|
* OnChainRevocationStore is a class that allows to interact with the onchain contract
|
|
@@ -8,8 +9,10 @@ import { EthConnectionConfig } from './state';
|
|
|
8
9
|
* @class OnChainIssuer
|
|
9
10
|
*/
|
|
10
11
|
export declare class OnChainRevocationStorage {
|
|
11
|
-
private readonly
|
|
12
|
-
private
|
|
12
|
+
private readonly _config;
|
|
13
|
+
private _signer?;
|
|
14
|
+
private readonly _contract;
|
|
15
|
+
private readonly _provider;
|
|
13
16
|
/**
|
|
14
17
|
*
|
|
15
18
|
* Creates an instance of OnChainIssuer.
|
|
@@ -17,7 +20,7 @@ export declare class OnChainRevocationStorage {
|
|
|
17
20
|
* @param {string} - onhcain contract address
|
|
18
21
|
* @param {string} - rpc url to connect to the blockchain
|
|
19
22
|
*/
|
|
20
|
-
constructor(
|
|
23
|
+
constructor(_config: EthConnectionConfig, contractAddress: string, _signer?: Signer | undefined);
|
|
21
24
|
/**
|
|
22
25
|
* Get revocation status by issuerId, issuerState and nonce from the onchain.
|
|
23
26
|
* @public
|
|
@@ -30,6 +33,7 @@ export declare class OnChainRevocationStorage {
|
|
|
30
33
|
* @returns Promise<RevocationStatus>
|
|
31
34
|
*/
|
|
32
35
|
getRevocationStatus(issuerID: bigint, nonce: number): Promise<RevocationStatus>;
|
|
36
|
+
saveNodes(payload: bigint[][]): Promise<TransactionReceipt>;
|
|
33
37
|
private static convertIssuerInfo;
|
|
34
38
|
private static convertSmtProofToProof;
|
|
35
39
|
}
|