@0xpolygonid/js-sdk 1.19.0 → 1.20.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/dist/browser/esm/index.js +186 -53
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +308 -175
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/credentials/status/on-chain-revocation.js +1 -1
- package/dist/node/cjs/proof/provers/witness_calculator.js +4 -4
- package/dist/node/cjs/storage/blockchain/onchain-revocation.js +1 -1
- package/dist/node/cjs/verifiable/constants.js +2 -2
- package/dist/node/cjs/verifiable/credential.js +1 -1
- package/dist/node/esm/credentials/status/on-chain-revocation.js +1 -1
- package/dist/node/esm/proof/provers/witness_calculator.js +4 -4
- package/dist/node/esm/storage/blockchain/onchain-revocation.js +1 -1
- package/dist/node/esm/verifiable/constants.js +2 -2
- package/dist/node/esm/verifiable/credential.js +1 -1
- package/dist/types/credentials/status/resolver.d.ts +1 -1
- package/dist/types/storage/blockchain/onchain-revocation.d.ts +1 -1
- package/dist/types/verifiable/constants.d.ts +1 -1
- package/package.json +4 -3
|
@@ -120,7 +120,7 @@ class OnChainResolver {
|
|
|
120
120
|
}
|
|
121
121
|
return network;
|
|
122
122
|
}
|
|
123
|
-
// TODO
|
|
123
|
+
// TODO: is dirty hack for mock in tests.
|
|
124
124
|
// need to pass to constructor list of state stores not list of network configs
|
|
125
125
|
_getStateStorageForIssuer(issuerId) {
|
|
126
126
|
const issuerChainId = (0, js_iden3_core_1.getChainId)(js_iden3_core_1.DID.blockchainFromId(issuerId), js_iden3_core_1.DID.networkIdFromId(issuerId));
|
|
@@ -274,8 +274,8 @@ function fnvHash(str) {
|
|
|
274
274
|
hash *= BigInt(0x100000001b3);
|
|
275
275
|
hash %= uint64_max;
|
|
276
276
|
}
|
|
277
|
-
let
|
|
278
|
-
const n = 16 -
|
|
279
|
-
|
|
280
|
-
return
|
|
277
|
+
let hashHex = hash.toString(16);
|
|
278
|
+
const n = 16 - hashHex.length;
|
|
279
|
+
hashHex = '0'.repeat(n).concat(hashHex);
|
|
280
|
+
return hashHex;
|
|
281
281
|
}
|
|
@@ -20,7 +20,7 @@ class OnChainRevocationStorage {
|
|
|
20
20
|
*
|
|
21
21
|
* Creates an instance of OnChainIssuer.
|
|
22
22
|
* @public
|
|
23
|
-
* @param {string} -
|
|
23
|
+
* @param {string} - onchain contract address
|
|
24
24
|
* @param {string} - rpc url to connect to the blockchain
|
|
25
25
|
*/
|
|
26
26
|
constructor(_config, contractAddress, _signer) {
|
|
@@ -34,7 +34,7 @@ exports.VerifiableConstants = Object.freeze({
|
|
|
34
34
|
PUSH_NOTIFICATION: 'push-notification'
|
|
35
35
|
},
|
|
36
36
|
AUTH: {
|
|
37
|
-
|
|
37
|
+
AUTH_BJJ_CREDENTIAL_HASH: '013fd3f623559d850fb5b02ff012d0e2',
|
|
38
38
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: 'https://schema.iden3.io/core/json/auth.json',
|
|
39
39
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: 'https://schema.iden3.io/core/jsonld/auth.jsonld',
|
|
40
40
|
AUTH_BJJ_CREDENTIAL_TYPE: 'AuthBJJCredential',
|
|
@@ -66,7 +66,7 @@ var CredentialStatusType;
|
|
|
66
66
|
CredentialStatusType["Iden3ReverseSparseMerkleTreeProof"] = "Iden3ReverseSparseMerkleTreeProof";
|
|
67
67
|
// Iden3commRevocationStatusV1 is CredentialStatusType for iden3comm revocation status
|
|
68
68
|
CredentialStatusType["Iden3commRevocationStatusV1"] = "Iden3commRevocationStatusV1.0";
|
|
69
|
-
//
|
|
69
|
+
// Iden3OnchainSparseMerkleTreeProof2023 is a proof type for MTP proofs with iden3 metadata from blockchain
|
|
70
70
|
CredentialStatusType["Iden3OnchainSparseMerkleTreeProof2023"] = "Iden3OnchainSparseMerkleTreeProof2023";
|
|
71
71
|
})(CredentialStatusType = exports.CredentialStatusType || (exports.CredentialStatusType = {}));
|
|
72
72
|
/**
|
|
@@ -323,7 +323,7 @@ class W3CCredential {
|
|
|
323
323
|
}
|
|
324
324
|
async verifyIden3SparseMerkleTreeProof(proof, coreClaim, resolverURL) {
|
|
325
325
|
await (0, utils_2.validateDIDDocumentAuth)(proof.issuerData.id, resolverURL, proof.issuerData.state.value);
|
|
326
|
-
// root from proof == issuerData.state
|
|
326
|
+
// root from proof == issuerData.state.claimsTreeRoot
|
|
327
327
|
const { hi, hv } = coreClaim.hiHv();
|
|
328
328
|
const rootFromProofValue = await (0, js_merkletree_1.rootFromProof)(proof.mtp, hi, hv);
|
|
329
329
|
if (!rootFromProofValue.equals(proof.issuerData.state.claimsTreeRoot)) {
|
|
@@ -117,7 +117,7 @@ export class OnChainResolver {
|
|
|
117
117
|
}
|
|
118
118
|
return network;
|
|
119
119
|
}
|
|
120
|
-
// TODO
|
|
120
|
+
// TODO: is dirty hack for mock in tests.
|
|
121
121
|
// need to pass to constructor list of state stores not list of network configs
|
|
122
122
|
_getStateStorageForIssuer(issuerId) {
|
|
123
123
|
const issuerChainId = getChainId(DID.blockchainFromId(issuerId), DID.networkIdFromId(issuerId));
|
|
@@ -270,8 +270,8 @@ function fnvHash(str) {
|
|
|
270
270
|
hash *= BigInt(0x100000001b3);
|
|
271
271
|
hash %= uint64_max;
|
|
272
272
|
}
|
|
273
|
-
let
|
|
274
|
-
const n = 16 -
|
|
275
|
-
|
|
276
|
-
return
|
|
273
|
+
let hashHex = hash.toString(16);
|
|
274
|
+
const n = 16 - hashHex.length;
|
|
275
|
+
hashHex = '0'.repeat(n).concat(hashHex);
|
|
276
|
+
return hashHex;
|
|
277
277
|
}
|
|
@@ -14,7 +14,7 @@ export class OnChainRevocationStorage {
|
|
|
14
14
|
*
|
|
15
15
|
* Creates an instance of OnChainIssuer.
|
|
16
16
|
* @public
|
|
17
|
-
* @param {string} -
|
|
17
|
+
* @param {string} - onchain contract address
|
|
18
18
|
* @param {string} - rpc url to connect to the blockchain
|
|
19
19
|
*/
|
|
20
20
|
constructor(_config, contractAddress, _signer) {
|
|
@@ -31,7 +31,7 @@ export const VerifiableConstants = Object.freeze({
|
|
|
31
31
|
PUSH_NOTIFICATION: 'push-notification'
|
|
32
32
|
},
|
|
33
33
|
AUTH: {
|
|
34
|
-
|
|
34
|
+
AUTH_BJJ_CREDENTIAL_HASH: '013fd3f623559d850fb5b02ff012d0e2',
|
|
35
35
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: 'https://schema.iden3.io/core/json/auth.json',
|
|
36
36
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: 'https://schema.iden3.io/core/jsonld/auth.jsonld',
|
|
37
37
|
AUTH_BJJ_CREDENTIAL_TYPE: 'AuthBJJCredential',
|
|
@@ -63,7 +63,7 @@ export var CredentialStatusType;
|
|
|
63
63
|
CredentialStatusType["Iden3ReverseSparseMerkleTreeProof"] = "Iden3ReverseSparseMerkleTreeProof";
|
|
64
64
|
// Iden3commRevocationStatusV1 is CredentialStatusType for iden3comm revocation status
|
|
65
65
|
CredentialStatusType["Iden3commRevocationStatusV1"] = "Iden3commRevocationStatusV1.0";
|
|
66
|
-
//
|
|
66
|
+
// Iden3OnchainSparseMerkleTreeProof2023 is a proof type for MTP proofs with iden3 metadata from blockchain
|
|
67
67
|
CredentialStatusType["Iden3OnchainSparseMerkleTreeProof2023"] = "Iden3OnchainSparseMerkleTreeProof2023";
|
|
68
68
|
})(CredentialStatusType || (CredentialStatusType = {}));
|
|
69
69
|
/**
|
|
@@ -297,7 +297,7 @@ export class W3CCredential {
|
|
|
297
297
|
}
|
|
298
298
|
async verifyIden3SparseMerkleTreeProof(proof, coreClaim, resolverURL) {
|
|
299
299
|
await validateDIDDocumentAuth(proof.issuerData.id, resolverURL, proof.issuerData.state.value);
|
|
300
|
-
// root from proof == issuerData.state
|
|
300
|
+
// root from proof == issuerData.state.claimsTreeRoot
|
|
301
301
|
const { hi, hv } = coreClaim.hiHv();
|
|
302
302
|
const rootFromProofValue = await rootFromProof(proof.mtp, hi, hv);
|
|
303
303
|
if (!rootFromProofValue.equals(proof.issuerData.state.claimsTreeRoot)) {
|
|
@@ -23,7 +23,7 @@ export interface CredentialStatusResolveOptions {
|
|
|
23
23
|
userDID?: DID;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* CredentialStatusResolver is an interface that allows to interact with
|
|
26
|
+
* CredentialStatusResolver is an interface that allows to interact with different types of credential status
|
|
27
27
|
* to resolve revocation status
|
|
28
28
|
*
|
|
29
29
|
* @public
|
|
@@ -18,7 +18,7 @@ export declare class OnChainRevocationStorage {
|
|
|
18
18
|
*
|
|
19
19
|
* Creates an instance of OnChainIssuer.
|
|
20
20
|
* @public
|
|
21
|
-
* @param {string} -
|
|
21
|
+
* @param {string} - onchain contract address
|
|
22
22
|
* @param {string} - rpc url to connect to the blockchain
|
|
23
23
|
*/
|
|
24
24
|
constructor(_config: EthConnectionConfig, contractAddress: string, _signer?: Signer | undefined);
|
|
@@ -23,7 +23,7 @@ export declare const VerifiableConstants: Readonly<{
|
|
|
23
23
|
PUSH_NOTIFICATION: string;
|
|
24
24
|
};
|
|
25
25
|
AUTH: {
|
|
26
|
-
|
|
26
|
+
AUTH_BJJ_CREDENTIAL_HASH: string;
|
|
27
27
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: string;
|
|
28
28
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: string;
|
|
29
29
|
AUTH_BJJ_CREDENTIAL_TYPE: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xpolygonid/js-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "SDK to work with Polygon ID",
|
|
5
5
|
"main": "dist/node/cjs/index.js",
|
|
6
6
|
"module": "dist/node/esm/index.js",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/0xPolygonID/js-sdk#readme",
|
|
52
52
|
"devDependencies": {
|
|
53
|
+
"@cspell/eslint-plugin": "^8.14.2",
|
|
53
54
|
"@gr2m/fetch-mock": "9.11.0-pull-request-644.1",
|
|
54
55
|
"@iden3/eslint-config": "https://github.com/iden3/eslint-config",
|
|
55
56
|
"@microsoft/api-documenter": "^7.8.20",
|
|
@@ -88,9 +89,9 @@
|
|
|
88
89
|
},
|
|
89
90
|
"peerDependencies": {
|
|
90
91
|
"@iden3/js-crypto": "1.1.0",
|
|
91
|
-
"@iden3/js-iden3-core": "1.4.
|
|
92
|
+
"@iden3/js-iden3-core": "1.4.1",
|
|
92
93
|
"@iden3/js-jsonld-merklization": "1.4.1",
|
|
93
|
-
"@iden3/js-jwz": "1.
|
|
94
|
+
"@iden3/js-jwz": "1.8.0",
|
|
94
95
|
"@iden3/js-merkletree": "1.3.1",
|
|
95
96
|
"ffjavascript": "0.3.0",
|
|
96
97
|
"rfc4648": "1.5.3",
|