@0xpolygonid/js-sdk 1.23.0 → 1.25.1
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 +2573 -392
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +2575 -390
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/circuits/auth-v2.js +6 -0
- package/dist/node/cjs/credentials/credential-wallet.js +11 -78
- package/dist/node/cjs/credentials/index.js +1 -0
- package/dist/node/cjs/credentials/status/did-resolver-revocation.js +21 -0
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +7 -1
- package/dist/node/cjs/iden3comm/handlers/fetch.js +32 -0
- package/dist/node/cjs/iden3comm/handlers/payment.js +30 -24
- package/dist/node/cjs/iden3comm/utils/contract-request.utils.js +59 -0
- package/dist/node/cjs/iden3comm/utils/index.js +1 -0
- package/dist/node/cjs/proof/proof-service.js +6 -0
- package/dist/node/cjs/storage/blockchain/abi/ERC20.json +1 -0
- package/dist/node/cjs/storage/blockchain/did-resolver-readonly-storage.js +72 -0
- package/dist/node/cjs/storage/blockchain/{erc20-permit-sig.js → erc20-helper.js} +14 -1
- package/dist/node/cjs/storage/blockchain/index.js +3 -1
- package/dist/node/cjs/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.js +245 -0
- package/dist/node/cjs/storage/blockchain/onchain-issuer.js +82 -0
- package/dist/node/cjs/storage/blockchain/onchain-zkp-verifier.js +90 -77
- package/dist/node/cjs/storage/interfaces/index.js +1 -0
- package/dist/node/cjs/storage/interfaces/onchain-issuer.js +2 -0
- package/dist/node/cjs/utils/did-helper.js +11 -6
- package/dist/node/cjs/verifiable/constants.js +2 -2
- package/dist/node/cjs/verifiable/credential.js +86 -0
- package/dist/node/esm/circuits/auth-v2.js +6 -0
- package/dist/node/esm/credentials/credential-wallet.js +12 -79
- package/dist/node/esm/credentials/index.js +1 -0
- package/dist/node/esm/credentials/status/did-resolver-revocation.js +17 -0
- package/dist/node/esm/iden3comm/handlers/contract-request.js +7 -1
- package/dist/node/esm/iden3comm/handlers/fetch.js +32 -0
- package/dist/node/esm/iden3comm/handlers/payment.js +30 -24
- package/dist/node/esm/iden3comm/utils/contract-request.utils.js +54 -0
- package/dist/node/esm/iden3comm/utils/index.js +1 -0
- package/dist/node/esm/proof/proof-service.js +6 -0
- package/dist/node/esm/storage/blockchain/abi/ERC20.json +1 -0
- package/dist/node/esm/storage/blockchain/did-resolver-readonly-storage.js +68 -0
- package/dist/node/esm/storage/blockchain/{erc20-permit-sig.js → erc20-helper.js} +14 -2
- package/dist/node/esm/storage/blockchain/index.js +3 -1
- package/dist/node/esm/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.js +241 -0
- package/dist/node/esm/storage/blockchain/onchain-issuer.js +78 -0
- package/dist/node/esm/storage/blockchain/onchain-zkp-verifier.js +92 -79
- package/dist/node/esm/storage/interfaces/index.js +1 -0
- package/dist/node/esm/storage/interfaces/onchain-issuer.js +1 -0
- package/dist/node/esm/utils/did-helper.js +11 -6
- package/dist/node/esm/verifiable/constants.js +2 -2
- package/dist/node/esm/verifiable/credential.js +88 -2
- package/dist/types/circuits/auth-v2.d.ts +3 -2
- package/dist/types/credentials/credential-wallet.d.ts +0 -6
- package/dist/types/credentials/index.d.ts +1 -0
- package/dist/types/credentials/models.d.ts +8 -0
- package/dist/types/credentials/status/did-resolver-revocation.d.ts +7 -0
- package/dist/types/iden3comm/handlers/fetch.d.ts +8 -0
- package/dist/types/iden3comm/handlers/payment.d.ts +7 -10
- package/dist/types/iden3comm/types/protocol/payment.d.ts +6 -5
- package/dist/types/iden3comm/utils/contract-request.utils.d.ts +20 -0
- package/dist/types/iden3comm/utils/index.d.ts +1 -0
- package/dist/types/proof/proof-service.d.ts +10 -0
- package/dist/types/storage/blockchain/did-resolver-readonly-storage.d.ts +16 -0
- package/dist/types/storage/blockchain/{erc20-permit-sig.d.ts → erc20-helper.d.ts} +8 -1
- package/dist/types/storage/blockchain/index.d.ts +3 -1
- package/dist/types/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.d.ts +66 -0
- package/dist/types/storage/blockchain/onchain-issuer.d.ts +40 -0
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts +13 -12
- package/dist/types/storage/entities/state.d.ts +2 -0
- package/dist/types/storage/interfaces/index.d.ts +1 -0
- package/dist/types/storage/interfaces/onchain-issuer.d.ts +12 -0
- package/dist/types/verifiable/constants.d.ts +2 -2
- package/dist/types/verifiable/credential.d.ts +15 -2
- package/package.json +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DID, buildDIDType, Id as Id$1, genesisFromEthAddress, BytesHelper, checkBigIntInField, Claim, SchemaHash, ClaimOptions, MerklizedRootPosition as MerklizedRootPosition$1, IdPosition,
|
|
1
|
+
import { DID, buildDIDType, Id as Id$1, genesisFromEthAddress, BytesHelper, checkBigIntInField, Claim, SchemaHash, getChainId, ClaimOptions, MerklizedRootPosition as MerklizedRootPosition$1, IdPosition, chainIDfromDID, getDateFromUnixTimestamp, getUnixTimestamp, ChainIds, DidMethod, Blockchain, NetworkId } from '@iden3/js-iden3-core';
|
|
2
2
|
import * as jsIden3Core from '@iden3/js-iden3-core';
|
|
3
3
|
export { jsIden3Core as core };
|
|
4
4
|
import { Path, Merklizer, getDocumentLoader } from '@iden3/js-jsonld-merklization';
|
|
@@ -1343,7 +1343,7 @@ const validateDIDDocumentAuth = async (did, resolverURL, state) => {
|
|
|
1343
1343
|
}
|
|
1344
1344
|
};
|
|
1345
1345
|
const resolveDIDDocumentAuth = async (did, resolveURL, state) => {
|
|
1346
|
-
let url = `${resolveURL}/${did.string()
|
|
1346
|
+
let url = `${resolveURL}/${encodeURIComponent(did.string())}`;
|
|
1347
1347
|
if (state) {
|
|
1348
1348
|
url += `?state=${state.hex()}`;
|
|
1349
1349
|
}
|
|
@@ -1359,11 +1359,11 @@ function emptyStateDID(did) {
|
|
|
1359
1359
|
return emptyDID;
|
|
1360
1360
|
}
|
|
1361
1361
|
const resolveDidDocument = async (did, resolverUrl, opts) => {
|
|
1362
|
-
let didString = did.string()
|
|
1362
|
+
let didString = encodeURIComponent(did.string());
|
|
1363
1363
|
// for gist resolve we have to `hide` user did (look into resolver implementation)
|
|
1364
1364
|
const isGistRequest = opts?.gist && !opts.state;
|
|
1365
1365
|
if (isGistRequest) {
|
|
1366
|
-
didString = emptyStateDID(did).string();
|
|
1366
|
+
didString = encodeURIComponent(emptyStateDID(did).string());
|
|
1367
1367
|
}
|
|
1368
1368
|
let url = `${resolverUrl}/1.0/identifiers/${didString}`;
|
|
1369
1369
|
if (opts?.signature) {
|
|
@@ -1375,9 +1375,14 @@ const resolveDidDocument = async (did, resolverUrl, opts) => {
|
|
|
1375
1375
|
if (opts?.gist) {
|
|
1376
1376
|
url += `${url.includes('?') ? '&' : '?'}gist=${opts.gist.hex()}`;
|
|
1377
1377
|
}
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1378
|
+
try {
|
|
1379
|
+
const resp = await fetch(url);
|
|
1380
|
+
const data = await resp.json();
|
|
1381
|
+
return data;
|
|
1382
|
+
}
|
|
1383
|
+
catch (e) {
|
|
1384
|
+
throw new Error(`Failed to resolve DID document for ${did} ${e}`);
|
|
1385
|
+
}
|
|
1381
1386
|
};
|
|
1382
1387
|
const buildDIDFromEthPubKey = (didType, pubKeyEth) => {
|
|
1383
1388
|
// Use Keccak-256 hash function to get public key hash
|
|
@@ -7819,6 +7824,7 @@ var SupportedPaymentProofType;
|
|
|
7819
7824
|
/**
|
|
7820
7825
|
* Media types for Payment supported currencies
|
|
7821
7826
|
* @beta
|
|
7827
|
+
* @deprecated
|
|
7822
7828
|
* @enum {string}
|
|
7823
7829
|
*/
|
|
7824
7830
|
var SupportedCurrencies;
|
|
@@ -7827,8 +7833,7 @@ var SupportedCurrencies;
|
|
|
7827
7833
|
SupportedCurrencies["ETH_WEI"] = "ETHWEI";
|
|
7828
7834
|
SupportedCurrencies["ETH_GWEI"] = "ETHGWEI";
|
|
7829
7835
|
SupportedCurrencies["MATIC"] = "MATIC";
|
|
7830
|
-
SupportedCurrencies["
|
|
7831
|
-
SupportedCurrencies["USDC"] = "USDC";
|
|
7836
|
+
SupportedCurrencies["POL"] = "POL";
|
|
7832
7837
|
})(SupportedCurrencies || (SupportedCurrencies = {}));
|
|
7833
7838
|
/**
|
|
7834
7839
|
* Supported features for payment-request
|
|
@@ -19899,6 +19904,92 @@ class W3CCredential {
|
|
|
19899
19904
|
this.credentialSubject = {};
|
|
19900
19905
|
this.issuer = '';
|
|
19901
19906
|
}
|
|
19907
|
+
/**
|
|
19908
|
+
*
|
|
19909
|
+
* @param issuer - DID of the issuer
|
|
19910
|
+
* @param request - Credential request
|
|
19911
|
+
* @returns - W3C Credential
|
|
19912
|
+
*/
|
|
19913
|
+
static fromCredentialRequest(issuer, request) {
|
|
19914
|
+
if (!request.id) {
|
|
19915
|
+
throw new Error('Credential id is required');
|
|
19916
|
+
}
|
|
19917
|
+
if (!request.context) {
|
|
19918
|
+
throw new Error('Credential context is required');
|
|
19919
|
+
}
|
|
19920
|
+
const context = [
|
|
19921
|
+
VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018,
|
|
19922
|
+
VerifiableConstants.JSONLD_SCHEMA.IDEN3_CREDENTIAL,
|
|
19923
|
+
...request.context
|
|
19924
|
+
];
|
|
19925
|
+
const credentialType = [
|
|
19926
|
+
VerifiableConstants.CREDENTIAL_TYPE.W3C_VERIFIABLE_CREDENTIAL,
|
|
19927
|
+
request.type
|
|
19928
|
+
];
|
|
19929
|
+
const credentialSubject = request.credentialSubject;
|
|
19930
|
+
credentialSubject['type'] = request.type;
|
|
19931
|
+
const cr = new W3CCredential();
|
|
19932
|
+
cr.id = request.id;
|
|
19933
|
+
cr['@context'] = context;
|
|
19934
|
+
cr.type = credentialType;
|
|
19935
|
+
cr.credentialSubject = credentialSubject;
|
|
19936
|
+
cr.issuer = issuer.string();
|
|
19937
|
+
cr.credentialSchema = {
|
|
19938
|
+
id: request.credentialSchema,
|
|
19939
|
+
type: VerifiableConstants.JSON_SCHEMA_VALIDATOR
|
|
19940
|
+
};
|
|
19941
|
+
cr.credentialStatus = W3CCredential.buildCredentialStatus(request, issuer);
|
|
19942
|
+
request.expiration && (cr.expirationDate = new Date(request.expiration).toISOString());
|
|
19943
|
+
request.refreshService && (cr.refreshService = request.refreshService);
|
|
19944
|
+
request.displayMethod && (cr.displayMethod = request.displayMethod);
|
|
19945
|
+
request.issuanceDate && (cr.issuanceDate = new Date(request.issuanceDate).toISOString());
|
|
19946
|
+
return cr;
|
|
19947
|
+
}
|
|
19948
|
+
/**
|
|
19949
|
+
* Builds credential status
|
|
19950
|
+
* @param {CredentialRequest} request
|
|
19951
|
+
* @returns `CredentialStatus`
|
|
19952
|
+
*/
|
|
19953
|
+
static buildCredentialStatus(request, issuer) {
|
|
19954
|
+
const credentialStatus = {
|
|
19955
|
+
id: request.revocationOpts.id,
|
|
19956
|
+
type: request.revocationOpts.type,
|
|
19957
|
+
revocationNonce: request.revocationOpts.nonce
|
|
19958
|
+
};
|
|
19959
|
+
switch (request.revocationOpts.type) {
|
|
19960
|
+
case CredentialStatusType.SparseMerkleTreeProof:
|
|
19961
|
+
return {
|
|
19962
|
+
...credentialStatus,
|
|
19963
|
+
id: `${credentialStatus.id.replace(/\/$/, '')}/${credentialStatus.revocationNonce}`
|
|
19964
|
+
};
|
|
19965
|
+
case CredentialStatusType.Iden3ReverseSparseMerkleTreeProof:
|
|
19966
|
+
return {
|
|
19967
|
+
...credentialStatus,
|
|
19968
|
+
id: request.revocationOpts.issuerState
|
|
19969
|
+
? `${credentialStatus.id.replace(/\/$/, '')}/node?state=${request.revocationOpts.issuerState}`
|
|
19970
|
+
: `${credentialStatus.id.replace(/\/$/, '')}`
|
|
19971
|
+
};
|
|
19972
|
+
case CredentialStatusType.Iden3OnchainSparseMerkleTreeProof2023: {
|
|
19973
|
+
const issuerId = DID.idFromDID(issuer);
|
|
19974
|
+
const chainId = getChainId(DID.blockchainFromId(issuerId), DID.networkIdFromId(issuerId));
|
|
19975
|
+
const searchParams = [
|
|
19976
|
+
['revocationNonce', request.revocationOpts.nonce?.toString() || ''],
|
|
19977
|
+
['contractAddress', `${chainId}:${request.revocationOpts.id}`],
|
|
19978
|
+
['state', request.revocationOpts.issuerState || '']
|
|
19979
|
+
]
|
|
19980
|
+
.filter(([, value]) => Boolean(value))
|
|
19981
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
19982
|
+
.join('&');
|
|
19983
|
+
return {
|
|
19984
|
+
...credentialStatus,
|
|
19985
|
+
// `[did]:[methodid]:[chain]:[network]:[id]/credentialStatus?(revocationNonce=value)&[contractAddress=[chainID]:[contractAddress]]&(state=issuerState)`
|
|
19986
|
+
id: `${issuer.string()}/credentialStatus?${searchParams}`
|
|
19987
|
+
};
|
|
19988
|
+
}
|
|
19989
|
+
default:
|
|
19990
|
+
return credentialStatus;
|
|
19991
|
+
}
|
|
19992
|
+
}
|
|
19902
19993
|
toJSON() {
|
|
19903
19994
|
return {
|
|
19904
19995
|
...this,
|
|
@@ -51143,6 +51234,12 @@ class AuthV2PubSignals {
|
|
|
51143
51234
|
this.GISTRoot = Hash$2.fromString(sVals[2]);
|
|
51144
51235
|
return this;
|
|
51145
51236
|
}
|
|
51237
|
+
getStatesInfo() {
|
|
51238
|
+
return {
|
|
51239
|
+
states: [],
|
|
51240
|
+
gists: [{ id: this.userID, root: this.GISTRoot }]
|
|
51241
|
+
};
|
|
51242
|
+
}
|
|
51146
51243
|
}
|
|
51147
51244
|
|
|
51148
51245
|
/**
|
|
@@ -53459,23 +53556,8 @@ class OnChainZKPVerifier {
|
|
|
53459
53556
|
constructor(_configs, _opts) {
|
|
53460
53557
|
this._configs = _configs;
|
|
53461
53558
|
this._opts = _opts;
|
|
53462
|
-
/**
|
|
53463
|
-
* supported circuits
|
|
53464
|
-
*/
|
|
53465
|
-
this._supportedCircuits = [
|
|
53466
|
-
CircuitId.AtomicQueryMTPV2OnChain,
|
|
53467
|
-
CircuitId.AtomicQuerySigV2OnChain,
|
|
53468
|
-
CircuitId.AtomicQueryV3OnChain
|
|
53469
|
-
];
|
|
53470
|
-
/**
|
|
53471
|
-
* abi coder to encode/decode structures to solidity bytes
|
|
53472
|
-
*/
|
|
53473
|
-
this._abiCoder = new AbiCoder();
|
|
53474
53559
|
}
|
|
53475
|
-
|
|
53476
|
-
* {@inheritDoc IOnChainZKPVerifier.prepareTxArgsSubmitV1}
|
|
53477
|
-
*/
|
|
53478
|
-
async prepareTxArgsSubmitV1(txData, zkProofResponse) {
|
|
53560
|
+
static async prepareTxArgsSubmitV1(txData, zkProofResponse) {
|
|
53479
53561
|
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
|
|
53480
53562
|
throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
|
|
53481
53563
|
}
|
|
@@ -53493,6 +53575,12 @@ class OnChainZKPVerifier {
|
|
|
53493
53575
|
];
|
|
53494
53576
|
return payload;
|
|
53495
53577
|
}
|
|
53578
|
+
/**
|
|
53579
|
+
* {@inheritDoc IOnChainZKPVerifier.prepareTxArgsSubmitV1}
|
|
53580
|
+
*/
|
|
53581
|
+
async prepareTxArgsSubmitV1(txData, zkProofResponse) {
|
|
53582
|
+
return OnChainZKPVerifier.prepareTxArgsSubmitV1(txData, zkProofResponse);
|
|
53583
|
+
}
|
|
53496
53584
|
/**
|
|
53497
53585
|
* {@inheritDoc IOnChainZKPVerifier.submitZKPResponse}
|
|
53498
53586
|
*/
|
|
@@ -53582,55 +53670,60 @@ class OnChainZKPVerifier {
|
|
|
53582
53670
|
const { txnHash } = await transactionService.sendTransactionRequest(ethSigner, request);
|
|
53583
53671
|
return new Map().set(txnHash, zkProofResponses);
|
|
53584
53672
|
}
|
|
53585
|
-
|
|
53673
|
+
static getCrossChainResolvers(source, txDataChainId, type, didResolverUrl) {
|
|
53674
|
+
return [
|
|
53675
|
+
...new Set(source.map((info) => JSON.stringify({
|
|
53676
|
+
id: info.id.string(),
|
|
53677
|
+
[type]: type === 'gist' ? info.root?.string() : info.state?.string()
|
|
53678
|
+
})))
|
|
53679
|
+
].reduce((acc, s) => {
|
|
53680
|
+
const info = JSON.parse(s);
|
|
53681
|
+
const id = Id$1.fromString(info.id);
|
|
53682
|
+
const chainId = chainIDfromDID(DID.parseFromId(id));
|
|
53683
|
+
if (txDataChainId === chainId) {
|
|
53684
|
+
return acc;
|
|
53685
|
+
}
|
|
53686
|
+
const promise = this.resolveDidDocumentEip712MessageAndSignature(DID.parseFromId(Id$1.fromString(info.id)), didResolverUrl, {
|
|
53687
|
+
[type]: Hash$2.fromString(info[type])
|
|
53688
|
+
});
|
|
53689
|
+
return [...acc, promise];
|
|
53690
|
+
}, []);
|
|
53691
|
+
}
|
|
53692
|
+
static async prepareTxArgsSubmitV2(resolverUrl, txData, zkProofResponses) {
|
|
53586
53693
|
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
|
|
53587
53694
|
throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
|
|
53588
53695
|
}
|
|
53589
|
-
|
|
53590
|
-
|
|
53591
|
-
}
|
|
53592
|
-
const gistUpdateArr = [];
|
|
53593
|
-
const stateUpdateArr = [];
|
|
53696
|
+
const gistUpdates = [];
|
|
53697
|
+
const stateUpdates = [];
|
|
53594
53698
|
const payload = [];
|
|
53595
|
-
|
|
53596
|
-
const gistUpdateResolutionsPending = [];
|
|
53597
|
-
const stateUpdateResolutionsPending = [];
|
|
53699
|
+
const emptyBytes = '0x';
|
|
53598
53700
|
for (const zkProof of zkProofResponses) {
|
|
53599
|
-
const
|
|
53600
|
-
const
|
|
53601
|
-
if (!this._supportedCircuits.includes(
|
|
53701
|
+
const { id: requestId, pub_signals: inputs } = zkProof;
|
|
53702
|
+
const proofCircuitId = zkProof.circuitId;
|
|
53703
|
+
if (!this._supportedCircuits.includes(proofCircuitId)) {
|
|
53602
53704
|
throw new Error(`Circuit ${zkProof.circuitId} not supported by OnChainZKPVerifier`);
|
|
53603
53705
|
}
|
|
53706
|
+
if (inputs.length === 0) {
|
|
53707
|
+
payload.push({
|
|
53708
|
+
requestId: requestId,
|
|
53709
|
+
zkProof: emptyBytes,
|
|
53710
|
+
data: emptyBytes
|
|
53711
|
+
});
|
|
53712
|
+
continue;
|
|
53713
|
+
}
|
|
53604
53714
|
const zkProofEncoded = this.packZkpProof(inputs, zkProof.proof.pi_a.slice(0, 2), [
|
|
53605
53715
|
[zkProof.proof.pi_b[0][1], zkProof.proof.pi_b[0][0]],
|
|
53606
53716
|
[zkProof.proof.pi_b[1][1], zkProof.proof.pi_b[1][0]]
|
|
53607
53717
|
], zkProof.proof.pi_c.slice(0, 2));
|
|
53608
|
-
const stateInfo = this.getOnChainGistRootStatePubSignals(
|
|
53609
|
-
const
|
|
53610
|
-
|
|
53611
|
-
|
|
53612
|
-
if (gistResolutionPending) {
|
|
53613
|
-
continue;
|
|
53614
|
-
}
|
|
53615
|
-
gistUpdateResolutionsPending.push(JSON.stringify(gist));
|
|
53616
|
-
gistUpdateResolutions.push(this.resolveDidDocumentEip712MessageAndSignature(DID.parseFromId(gist.id), this._opts.didResolverUrl, { gist: gist.root }));
|
|
53617
|
-
}
|
|
53618
|
-
const stateUpdateResolutions = [];
|
|
53619
|
-
for (const state of stateInfo.states) {
|
|
53620
|
-
const stateResolutionPending = stateUpdateResolutionsPending.find((s) => s == JSON.stringify(state));
|
|
53621
|
-
if (stateResolutionPending) {
|
|
53622
|
-
continue;
|
|
53623
|
-
}
|
|
53624
|
-
stateUpdateResolutionsPending.push(JSON.stringify(state));
|
|
53625
|
-
stateUpdateResolutions.push(this.resolveDidDocumentEip712MessageAndSignature(DID.parseFromId(state.id), this._opts.didResolverUrl, {
|
|
53626
|
-
state: state.state
|
|
53627
|
-
}));
|
|
53628
|
-
}
|
|
53718
|
+
const stateInfo = this.getOnChainGistRootStatePubSignals(proofCircuitId, inputs);
|
|
53719
|
+
const chainId = txData.chain_id;
|
|
53720
|
+
const gistUpdateResolutions = this.getCrossChainResolvers(stateInfo.gists, chainId, 'gist', resolverUrl);
|
|
53721
|
+
const stateUpdateResolutions = this.getCrossChainResolvers(stateInfo.states, chainId, 'state', resolverUrl);
|
|
53629
53722
|
if (gistUpdateResolutions.length > 0) {
|
|
53630
|
-
|
|
53723
|
+
gistUpdates.push(...(await Promise.all(gistUpdateResolutions)));
|
|
53631
53724
|
}
|
|
53632
53725
|
if (stateUpdateResolutions.length > 0) {
|
|
53633
|
-
|
|
53726
|
+
stateUpdates.push(...(await Promise.all(stateUpdateResolutions)));
|
|
53634
53727
|
}
|
|
53635
53728
|
const metadataArr = [];
|
|
53636
53729
|
if (zkProof.vp) {
|
|
@@ -53646,20 +53739,28 @@ class OnChainZKPVerifier {
|
|
|
53646
53739
|
});
|
|
53647
53740
|
}
|
|
53648
53741
|
}
|
|
53649
|
-
const metadata = metadataArr.length ? this.packMetadatas(metadataArr) :
|
|
53742
|
+
const metadata = metadataArr.length ? this.packMetadatas(metadataArr) : emptyBytes;
|
|
53650
53743
|
payload.push({
|
|
53651
|
-
requestId:
|
|
53744
|
+
requestId: requestId,
|
|
53652
53745
|
zkProof: zkProofEncoded,
|
|
53653
53746
|
data: metadata
|
|
53654
53747
|
});
|
|
53655
53748
|
}
|
|
53656
|
-
const crossChainProofs =
|
|
53749
|
+
const crossChainProofs = gistUpdates.length || stateUpdates.length
|
|
53750
|
+
? this.packCrossChainProofs(gistUpdates, stateUpdates)
|
|
53751
|
+
: emptyBytes;
|
|
53657
53752
|
return [payload, crossChainProofs];
|
|
53658
53753
|
}
|
|
53659
|
-
|
|
53660
|
-
|
|
53754
|
+
async prepareTxArgsSubmitV2(txData, zkProofResponses) {
|
|
53755
|
+
if (!this._opts?.didResolverUrl) {
|
|
53756
|
+
throw new Error(`did resolver url required for crosschain verification`);
|
|
53757
|
+
}
|
|
53758
|
+
return OnChainZKPVerifier.prepareTxArgsSubmitV2(this._opts.didResolverUrl, txData, zkProofResponses);
|
|
53759
|
+
}
|
|
53760
|
+
static packZkpProof(inputs, a, b, c) {
|
|
53761
|
+
return new AbiCoder().encode(['uint256[] inputs', 'uint256[2]', 'uint256[2][2]', 'uint256[2]'], [inputs, a, b, c]);
|
|
53661
53762
|
}
|
|
53662
|
-
packCrossChainProofs(gistUpdateArr, stateUpdateArr) {
|
|
53763
|
+
static packCrossChainProofs(gistUpdateArr, stateUpdateArr) {
|
|
53663
53764
|
const proofs = [];
|
|
53664
53765
|
for (const globalStateUpdate of gistUpdateArr) {
|
|
53665
53766
|
proofs.push({
|
|
@@ -53673,10 +53774,10 @@ class OnChainZKPVerifier {
|
|
|
53673
53774
|
proof: this.packIdentityStateMsg(stateUpdate)
|
|
53674
53775
|
});
|
|
53675
53776
|
}
|
|
53676
|
-
return
|
|
53777
|
+
return new AbiCoder().encode(['tuple(' + 'string proofType,' + 'bytes proof' + ')[]'], [proofs]);
|
|
53677
53778
|
}
|
|
53678
|
-
packGlobalStateMsg(msg) {
|
|
53679
|
-
return
|
|
53779
|
+
static packGlobalStateMsg(msg) {
|
|
53780
|
+
return new AbiCoder().encode([
|
|
53680
53781
|
'tuple(' +
|
|
53681
53782
|
'tuple(' +
|
|
53682
53783
|
'uint256 timestamp,' +
|
|
@@ -53688,8 +53789,8 @@ class OnChainZKPVerifier {
|
|
|
53688
53789
|
')'
|
|
53689
53790
|
], [msg]);
|
|
53690
53791
|
}
|
|
53691
|
-
packIdentityStateMsg(msg) {
|
|
53692
|
-
return
|
|
53792
|
+
static packIdentityStateMsg(msg) {
|
|
53793
|
+
return new AbiCoder().encode([
|
|
53693
53794
|
'tuple(' +
|
|
53694
53795
|
'tuple(' +
|
|
53695
53796
|
'uint256 timestamp,' +
|
|
@@ -53701,27 +53802,20 @@ class OnChainZKPVerifier {
|
|
|
53701
53802
|
')'
|
|
53702
53803
|
], [msg]);
|
|
53703
53804
|
}
|
|
53704
|
-
packMetadatas(metas) {
|
|
53705
|
-
return
|
|
53805
|
+
static packMetadatas(metas) {
|
|
53806
|
+
return new AbiCoder().encode(['tuple(' + 'string key,' + 'bytes value' + ')[]'], [metas]);
|
|
53706
53807
|
}
|
|
53707
|
-
getOnChainGistRootStatePubSignals(onChainCircuitId, inputs) {
|
|
53708
|
-
|
|
53709
|
-
|
|
53710
|
-
|
|
53711
|
-
atomicQueryPubSignals = new AtomicQueryMTPV2OnChainPubSignals();
|
|
53712
|
-
break;
|
|
53713
|
-
case CircuitId.AtomicQuerySigV2OnChain:
|
|
53714
|
-
atomicQueryPubSignals = new AtomicQuerySigV2OnChainPubSignals();
|
|
53715
|
-
break;
|
|
53716
|
-
case CircuitId.AtomicQueryV3OnChain:
|
|
53717
|
-
atomicQueryPubSignals = new AtomicQueryV3OnChainPubSignals();
|
|
53718
|
-
break;
|
|
53808
|
+
static getOnChainGistRootStatePubSignals(onChainCircuitId, inputs) {
|
|
53809
|
+
const PubSignals = this._supportedCircuitsPubSignalsMap[onChainCircuitId];
|
|
53810
|
+
if (!PubSignals) {
|
|
53811
|
+
throw new Error(`Circuit ${onChainCircuitId} not supported by OnChainZKPVerifier`);
|
|
53719
53812
|
}
|
|
53813
|
+
const atomicQueryPubSignals = new PubSignals();
|
|
53720
53814
|
const encodedInputs = byteEncoder.encode(JSON.stringify(inputs));
|
|
53721
53815
|
atomicQueryPubSignals.pubSignalsUnmarshal(encodedInputs);
|
|
53722
53816
|
return atomicQueryPubSignals.getStatesInfo();
|
|
53723
53817
|
}
|
|
53724
|
-
async resolveDidDocumentEip712MessageAndSignature(did, resolverUrl, opts) {
|
|
53818
|
+
static async resolveDidDocumentEip712MessageAndSignature(did, resolverUrl, opts) {
|
|
53725
53819
|
const didDoc = await resolveDidDocument(did, resolverUrl, {
|
|
53726
53820
|
...opts,
|
|
53727
53821
|
signature: DIDDocumentSignature.EthereumEip712Signature2021
|
|
@@ -53754,6 +53848,21 @@ class OnChainZKPVerifier {
|
|
|
53754
53848
|
};
|
|
53755
53849
|
}
|
|
53756
53850
|
}
|
|
53851
|
+
/**
|
|
53852
|
+
* supported circuits
|
|
53853
|
+
*/
|
|
53854
|
+
OnChainZKPVerifier._supportedCircuits = [
|
|
53855
|
+
CircuitId.AuthV2,
|
|
53856
|
+
CircuitId.AtomicQueryMTPV2OnChain,
|
|
53857
|
+
CircuitId.AtomicQuerySigV2OnChain,
|
|
53858
|
+
CircuitId.AtomicQueryV3OnChain
|
|
53859
|
+
];
|
|
53860
|
+
OnChainZKPVerifier._supportedCircuitsPubSignalsMap = {
|
|
53861
|
+
[CircuitId.AtomicQueryMTPV2OnChain]: AtomicQueryMTPV2OnChainPubSignals,
|
|
53862
|
+
[CircuitId.AtomicQuerySigV2OnChain]: AtomicQuerySigV2OnChainPubSignals,
|
|
53863
|
+
[CircuitId.AtomicQueryV3OnChain]: AtomicQueryV3OnChainPubSignals,
|
|
53864
|
+
[CircuitId.AuthV2]: AuthV2PubSignals
|
|
53865
|
+
};
|
|
53757
53866
|
|
|
53758
53867
|
var abi$1 = [
|
|
53759
53868
|
{
|
|
@@ -54127,31 +54236,2279 @@ class OnChainRevocationStorage {
|
|
|
54127
54236
|
var abi = [
|
|
54128
54237
|
{
|
|
54129
54238
|
inputs: [
|
|
54239
|
+
{
|
|
54240
|
+
internalType: "uint256",
|
|
54241
|
+
name: "_userId",
|
|
54242
|
+
type: "uint256"
|
|
54243
|
+
},
|
|
54244
|
+
{
|
|
54245
|
+
internalType: "uint256",
|
|
54246
|
+
name: "_credentialId",
|
|
54247
|
+
type: "uint256"
|
|
54248
|
+
}
|
|
54130
54249
|
],
|
|
54131
|
-
name: "
|
|
54132
|
-
|
|
54250
|
+
name: "getCredential",
|
|
54251
|
+
outputs: [
|
|
54252
|
+
{
|
|
54253
|
+
components: [
|
|
54254
|
+
{
|
|
54255
|
+
internalType: "uint256",
|
|
54256
|
+
name: "id",
|
|
54257
|
+
type: "uint256"
|
|
54258
|
+
},
|
|
54259
|
+
{
|
|
54260
|
+
internalType: "string[]",
|
|
54261
|
+
name: "context",
|
|
54262
|
+
type: "string[]"
|
|
54263
|
+
},
|
|
54264
|
+
{
|
|
54265
|
+
internalType: "string",
|
|
54266
|
+
name: "_type",
|
|
54267
|
+
type: "string"
|
|
54268
|
+
},
|
|
54269
|
+
{
|
|
54270
|
+
internalType: "uint64",
|
|
54271
|
+
name: "issuanceDate",
|
|
54272
|
+
type: "uint64"
|
|
54273
|
+
},
|
|
54274
|
+
{
|
|
54275
|
+
components: [
|
|
54276
|
+
{
|
|
54277
|
+
internalType: "string",
|
|
54278
|
+
name: "id",
|
|
54279
|
+
type: "string"
|
|
54280
|
+
},
|
|
54281
|
+
{
|
|
54282
|
+
internalType: "string",
|
|
54283
|
+
name: "_type",
|
|
54284
|
+
type: "string"
|
|
54285
|
+
}
|
|
54286
|
+
],
|
|
54287
|
+
internalType: "struct INonMerklizedIssuer.CredentialSchema",
|
|
54288
|
+
name: "credentialSchema",
|
|
54289
|
+
type: "tuple"
|
|
54290
|
+
},
|
|
54291
|
+
{
|
|
54292
|
+
components: [
|
|
54293
|
+
{
|
|
54294
|
+
internalType: "string",
|
|
54295
|
+
name: "id",
|
|
54296
|
+
type: "string"
|
|
54297
|
+
},
|
|
54298
|
+
{
|
|
54299
|
+
internalType: "string",
|
|
54300
|
+
name: "_type",
|
|
54301
|
+
type: "string"
|
|
54302
|
+
}
|
|
54303
|
+
],
|
|
54304
|
+
internalType: "struct INonMerklizedIssuer.DisplayMethod",
|
|
54305
|
+
name: "displayMethod",
|
|
54306
|
+
type: "tuple"
|
|
54307
|
+
}
|
|
54308
|
+
],
|
|
54309
|
+
internalType: "struct INonMerklizedIssuer.CredentialData",
|
|
54310
|
+
name: "",
|
|
54311
|
+
type: "tuple"
|
|
54312
|
+
},
|
|
54313
|
+
{
|
|
54314
|
+
internalType: "uint256[8]",
|
|
54315
|
+
name: "",
|
|
54316
|
+
type: "uint256[8]"
|
|
54317
|
+
},
|
|
54318
|
+
{
|
|
54319
|
+
components: [
|
|
54320
|
+
{
|
|
54321
|
+
internalType: "string",
|
|
54322
|
+
name: "key",
|
|
54323
|
+
type: "string"
|
|
54324
|
+
},
|
|
54325
|
+
{
|
|
54326
|
+
internalType: "uint256",
|
|
54327
|
+
name: "value",
|
|
54328
|
+
type: "uint256"
|
|
54329
|
+
},
|
|
54330
|
+
{
|
|
54331
|
+
internalType: "bytes",
|
|
54332
|
+
name: "rawValue",
|
|
54333
|
+
type: "bytes"
|
|
54334
|
+
}
|
|
54335
|
+
],
|
|
54336
|
+
internalType: "struct INonMerklizedIssuer.SubjectField[]",
|
|
54337
|
+
name: "",
|
|
54338
|
+
type: "tuple[]"
|
|
54339
|
+
}
|
|
54340
|
+
],
|
|
54341
|
+
stateMutability: "view",
|
|
54342
|
+
type: "function"
|
|
54133
54343
|
},
|
|
54134
54344
|
{
|
|
54135
54345
|
inputs: [
|
|
54346
|
+
],
|
|
54347
|
+
name: "getCredentialAdapterVersion",
|
|
54348
|
+
outputs: [
|
|
54136
54349
|
{
|
|
54137
|
-
internalType: "
|
|
54138
|
-
name: "
|
|
54139
|
-
type: "
|
|
54350
|
+
internalType: "string",
|
|
54351
|
+
name: "",
|
|
54352
|
+
type: "string"
|
|
54140
54353
|
}
|
|
54141
54354
|
],
|
|
54142
|
-
|
|
54143
|
-
type: "
|
|
54355
|
+
stateMutability: "view",
|
|
54356
|
+
type: "function"
|
|
54144
54357
|
},
|
|
54145
54358
|
{
|
|
54146
54359
|
inputs: [
|
|
54147
54360
|
{
|
|
54148
|
-
internalType: "
|
|
54149
|
-
name: "
|
|
54150
|
-
type: "
|
|
54361
|
+
internalType: "uint256",
|
|
54362
|
+
name: "_userId",
|
|
54363
|
+
type: "uint256"
|
|
54151
54364
|
}
|
|
54152
54365
|
],
|
|
54153
|
-
name: "
|
|
54154
|
-
|
|
54366
|
+
name: "getUserCredentialIds",
|
|
54367
|
+
outputs: [
|
|
54368
|
+
{
|
|
54369
|
+
internalType: "uint256[]",
|
|
54370
|
+
name: "",
|
|
54371
|
+
type: "uint256[]"
|
|
54372
|
+
}
|
|
54373
|
+
],
|
|
54374
|
+
stateMutability: "view",
|
|
54375
|
+
type: "function"
|
|
54376
|
+
}
|
|
54377
|
+
];
|
|
54378
|
+
|
|
54379
|
+
/* Autogenerated file. Do not edit manually. */
|
|
54380
|
+
/* tslint:disable */
|
|
54381
|
+
/* eslint-disable */
|
|
54382
|
+
const _abi = [
|
|
54383
|
+
{
|
|
54384
|
+
inputs: [],
|
|
54385
|
+
name: 'CREDENTIAL_ADAPTER_VERSION',
|
|
54386
|
+
outputs: [
|
|
54387
|
+
{
|
|
54388
|
+
internalType: 'string',
|
|
54389
|
+
name: '',
|
|
54390
|
+
type: 'string'
|
|
54391
|
+
}
|
|
54392
|
+
],
|
|
54393
|
+
stateMutability: 'view',
|
|
54394
|
+
type: 'function'
|
|
54395
|
+
},
|
|
54396
|
+
{
|
|
54397
|
+
inputs: [
|
|
54398
|
+
{
|
|
54399
|
+
internalType: 'uint256',
|
|
54400
|
+
name: 'claimIndexHash',
|
|
54401
|
+
type: 'uint256'
|
|
54402
|
+
}
|
|
54403
|
+
],
|
|
54404
|
+
name: 'getClaimProof',
|
|
54405
|
+
outputs: [
|
|
54406
|
+
{
|
|
54407
|
+
components: [
|
|
54408
|
+
{
|
|
54409
|
+
internalType: 'uint256',
|
|
54410
|
+
name: 'root',
|
|
54411
|
+
type: 'uint256'
|
|
54412
|
+
},
|
|
54413
|
+
{
|
|
54414
|
+
internalType: 'bool',
|
|
54415
|
+
name: 'existence',
|
|
54416
|
+
type: 'bool'
|
|
54417
|
+
},
|
|
54418
|
+
{
|
|
54419
|
+
internalType: 'uint256[]',
|
|
54420
|
+
name: 'siblings',
|
|
54421
|
+
type: 'uint256[]'
|
|
54422
|
+
},
|
|
54423
|
+
{
|
|
54424
|
+
internalType: 'uint256',
|
|
54425
|
+
name: 'index',
|
|
54426
|
+
type: 'uint256'
|
|
54427
|
+
},
|
|
54428
|
+
{
|
|
54429
|
+
internalType: 'uint256',
|
|
54430
|
+
name: 'value',
|
|
54431
|
+
type: 'uint256'
|
|
54432
|
+
},
|
|
54433
|
+
{
|
|
54434
|
+
internalType: 'bool',
|
|
54435
|
+
name: 'auxExistence',
|
|
54436
|
+
type: 'bool'
|
|
54437
|
+
},
|
|
54438
|
+
{
|
|
54439
|
+
internalType: 'uint256',
|
|
54440
|
+
name: 'auxIndex',
|
|
54441
|
+
type: 'uint256'
|
|
54442
|
+
},
|
|
54443
|
+
{
|
|
54444
|
+
internalType: 'uint256',
|
|
54445
|
+
name: 'auxValue',
|
|
54446
|
+
type: 'uint256'
|
|
54447
|
+
}
|
|
54448
|
+
],
|
|
54449
|
+
internalType: 'struct SmtLib.Proof',
|
|
54450
|
+
name: '',
|
|
54451
|
+
type: 'tuple'
|
|
54452
|
+
}
|
|
54453
|
+
],
|
|
54454
|
+
stateMutability: 'view',
|
|
54455
|
+
type: 'function'
|
|
54456
|
+
},
|
|
54457
|
+
{
|
|
54458
|
+
inputs: [
|
|
54459
|
+
{
|
|
54460
|
+
internalType: 'uint256',
|
|
54461
|
+
name: 'claimIndexHash',
|
|
54462
|
+
type: 'uint256'
|
|
54463
|
+
},
|
|
54464
|
+
{
|
|
54465
|
+
internalType: 'uint256',
|
|
54466
|
+
name: 'root',
|
|
54467
|
+
type: 'uint256'
|
|
54468
|
+
}
|
|
54469
|
+
],
|
|
54470
|
+
name: 'getClaimProofByRoot',
|
|
54471
|
+
outputs: [
|
|
54472
|
+
{
|
|
54473
|
+
components: [
|
|
54474
|
+
{
|
|
54475
|
+
internalType: 'uint256',
|
|
54476
|
+
name: 'root',
|
|
54477
|
+
type: 'uint256'
|
|
54478
|
+
},
|
|
54479
|
+
{
|
|
54480
|
+
internalType: 'bool',
|
|
54481
|
+
name: 'existence',
|
|
54482
|
+
type: 'bool'
|
|
54483
|
+
},
|
|
54484
|
+
{
|
|
54485
|
+
internalType: 'uint256[]',
|
|
54486
|
+
name: 'siblings',
|
|
54487
|
+
type: 'uint256[]'
|
|
54488
|
+
},
|
|
54489
|
+
{
|
|
54490
|
+
internalType: 'uint256',
|
|
54491
|
+
name: 'index',
|
|
54492
|
+
type: 'uint256'
|
|
54493
|
+
},
|
|
54494
|
+
{
|
|
54495
|
+
internalType: 'uint256',
|
|
54496
|
+
name: 'value',
|
|
54497
|
+
type: 'uint256'
|
|
54498
|
+
},
|
|
54499
|
+
{
|
|
54500
|
+
internalType: 'bool',
|
|
54501
|
+
name: 'auxExistence',
|
|
54502
|
+
type: 'bool'
|
|
54503
|
+
},
|
|
54504
|
+
{
|
|
54505
|
+
internalType: 'uint256',
|
|
54506
|
+
name: 'auxIndex',
|
|
54507
|
+
type: 'uint256'
|
|
54508
|
+
},
|
|
54509
|
+
{
|
|
54510
|
+
internalType: 'uint256',
|
|
54511
|
+
name: 'auxValue',
|
|
54512
|
+
type: 'uint256'
|
|
54513
|
+
}
|
|
54514
|
+
],
|
|
54515
|
+
internalType: 'struct SmtLib.Proof',
|
|
54516
|
+
name: '',
|
|
54517
|
+
type: 'tuple'
|
|
54518
|
+
}
|
|
54519
|
+
],
|
|
54520
|
+
stateMutability: 'view',
|
|
54521
|
+
type: 'function'
|
|
54522
|
+
},
|
|
54523
|
+
{
|
|
54524
|
+
inputs: [
|
|
54525
|
+
{
|
|
54526
|
+
internalType: 'uint256',
|
|
54527
|
+
name: 'claimIndexHash',
|
|
54528
|
+
type: 'uint256'
|
|
54529
|
+
}
|
|
54530
|
+
],
|
|
54531
|
+
name: 'getClaimProofWithStateInfo',
|
|
54532
|
+
outputs: [
|
|
54533
|
+
{
|
|
54534
|
+
components: [
|
|
54535
|
+
{
|
|
54536
|
+
internalType: 'uint256',
|
|
54537
|
+
name: 'root',
|
|
54538
|
+
type: 'uint256'
|
|
54539
|
+
},
|
|
54540
|
+
{
|
|
54541
|
+
internalType: 'bool',
|
|
54542
|
+
name: 'existence',
|
|
54543
|
+
type: 'bool'
|
|
54544
|
+
},
|
|
54545
|
+
{
|
|
54546
|
+
internalType: 'uint256[]',
|
|
54547
|
+
name: 'siblings',
|
|
54548
|
+
type: 'uint256[]'
|
|
54549
|
+
},
|
|
54550
|
+
{
|
|
54551
|
+
internalType: 'uint256',
|
|
54552
|
+
name: 'index',
|
|
54553
|
+
type: 'uint256'
|
|
54554
|
+
},
|
|
54555
|
+
{
|
|
54556
|
+
internalType: 'uint256',
|
|
54557
|
+
name: 'value',
|
|
54558
|
+
type: 'uint256'
|
|
54559
|
+
},
|
|
54560
|
+
{
|
|
54561
|
+
internalType: 'bool',
|
|
54562
|
+
name: 'auxExistence',
|
|
54563
|
+
type: 'bool'
|
|
54564
|
+
},
|
|
54565
|
+
{
|
|
54566
|
+
internalType: 'uint256',
|
|
54567
|
+
name: 'auxIndex',
|
|
54568
|
+
type: 'uint256'
|
|
54569
|
+
},
|
|
54570
|
+
{
|
|
54571
|
+
internalType: 'uint256',
|
|
54572
|
+
name: 'auxValue',
|
|
54573
|
+
type: 'uint256'
|
|
54574
|
+
}
|
|
54575
|
+
],
|
|
54576
|
+
internalType: 'struct SmtLib.Proof',
|
|
54577
|
+
name: '',
|
|
54578
|
+
type: 'tuple'
|
|
54579
|
+
},
|
|
54580
|
+
{
|
|
54581
|
+
components: [
|
|
54582
|
+
{
|
|
54583
|
+
internalType: 'uint256',
|
|
54584
|
+
name: 'state',
|
|
54585
|
+
type: 'uint256'
|
|
54586
|
+
},
|
|
54587
|
+
{
|
|
54588
|
+
internalType: 'uint256',
|
|
54589
|
+
name: 'claimsRoot',
|
|
54590
|
+
type: 'uint256'
|
|
54591
|
+
},
|
|
54592
|
+
{
|
|
54593
|
+
internalType: 'uint256',
|
|
54594
|
+
name: 'revocationsRoot',
|
|
54595
|
+
type: 'uint256'
|
|
54596
|
+
},
|
|
54597
|
+
{
|
|
54598
|
+
internalType: 'uint256',
|
|
54599
|
+
name: 'rootsRoot',
|
|
54600
|
+
type: 'uint256'
|
|
54601
|
+
}
|
|
54602
|
+
],
|
|
54603
|
+
internalType: 'struct IdentityLib.StateInfo',
|
|
54604
|
+
name: '',
|
|
54605
|
+
type: 'tuple'
|
|
54606
|
+
}
|
|
54607
|
+
],
|
|
54608
|
+
stateMutability: 'view',
|
|
54609
|
+
type: 'function'
|
|
54610
|
+
},
|
|
54611
|
+
{
|
|
54612
|
+
inputs: [],
|
|
54613
|
+
name: 'getClaimsTreeRoot',
|
|
54614
|
+
outputs: [
|
|
54615
|
+
{
|
|
54616
|
+
internalType: 'uint256',
|
|
54617
|
+
name: '',
|
|
54618
|
+
type: 'uint256'
|
|
54619
|
+
}
|
|
54620
|
+
],
|
|
54621
|
+
stateMutability: 'view',
|
|
54622
|
+
type: 'function'
|
|
54623
|
+
},
|
|
54624
|
+
{
|
|
54625
|
+
inputs: [
|
|
54626
|
+
{
|
|
54627
|
+
internalType: 'uint256',
|
|
54628
|
+
name: '_userId',
|
|
54629
|
+
type: 'uint256'
|
|
54630
|
+
},
|
|
54631
|
+
{
|
|
54632
|
+
internalType: 'uint256',
|
|
54633
|
+
name: '_credentialId',
|
|
54634
|
+
type: 'uint256'
|
|
54635
|
+
}
|
|
54636
|
+
],
|
|
54637
|
+
name: 'getCredential',
|
|
54638
|
+
outputs: [
|
|
54639
|
+
{
|
|
54640
|
+
components: [
|
|
54641
|
+
{
|
|
54642
|
+
internalType: 'uint256',
|
|
54643
|
+
name: 'id',
|
|
54644
|
+
type: 'uint256'
|
|
54645
|
+
},
|
|
54646
|
+
{
|
|
54647
|
+
internalType: 'string[]',
|
|
54648
|
+
name: 'context',
|
|
54649
|
+
type: 'string[]'
|
|
54650
|
+
},
|
|
54651
|
+
{
|
|
54652
|
+
internalType: 'string',
|
|
54653
|
+
name: '_type',
|
|
54654
|
+
type: 'string'
|
|
54655
|
+
},
|
|
54656
|
+
{
|
|
54657
|
+
internalType: 'uint64',
|
|
54658
|
+
name: 'issuanceDate',
|
|
54659
|
+
type: 'uint64'
|
|
54660
|
+
},
|
|
54661
|
+
{
|
|
54662
|
+
components: [
|
|
54663
|
+
{
|
|
54664
|
+
internalType: 'string',
|
|
54665
|
+
name: 'id',
|
|
54666
|
+
type: 'string'
|
|
54667
|
+
},
|
|
54668
|
+
{
|
|
54669
|
+
internalType: 'string',
|
|
54670
|
+
name: '_type',
|
|
54671
|
+
type: 'string'
|
|
54672
|
+
}
|
|
54673
|
+
],
|
|
54674
|
+
internalType: 'struct INonMerklizedIssuer.CredentialSchema',
|
|
54675
|
+
name: 'credentialSchema',
|
|
54676
|
+
type: 'tuple'
|
|
54677
|
+
},
|
|
54678
|
+
{
|
|
54679
|
+
components: [
|
|
54680
|
+
{
|
|
54681
|
+
internalType: 'string',
|
|
54682
|
+
name: 'id',
|
|
54683
|
+
type: 'string'
|
|
54684
|
+
},
|
|
54685
|
+
{
|
|
54686
|
+
internalType: 'string',
|
|
54687
|
+
name: '_type',
|
|
54688
|
+
type: 'string'
|
|
54689
|
+
}
|
|
54690
|
+
],
|
|
54691
|
+
internalType: 'struct INonMerklizedIssuer.DisplayMethod',
|
|
54692
|
+
name: 'displayMethod',
|
|
54693
|
+
type: 'tuple'
|
|
54694
|
+
}
|
|
54695
|
+
],
|
|
54696
|
+
internalType: 'struct INonMerklizedIssuer.CredentialData',
|
|
54697
|
+
name: '',
|
|
54698
|
+
type: 'tuple'
|
|
54699
|
+
},
|
|
54700
|
+
{
|
|
54701
|
+
internalType: 'uint256[8]',
|
|
54702
|
+
name: '',
|
|
54703
|
+
type: 'uint256[8]'
|
|
54704
|
+
},
|
|
54705
|
+
{
|
|
54706
|
+
components: [
|
|
54707
|
+
{
|
|
54708
|
+
internalType: 'string',
|
|
54709
|
+
name: 'key',
|
|
54710
|
+
type: 'string'
|
|
54711
|
+
},
|
|
54712
|
+
{
|
|
54713
|
+
internalType: 'uint256',
|
|
54714
|
+
name: 'value',
|
|
54715
|
+
type: 'uint256'
|
|
54716
|
+
},
|
|
54717
|
+
{
|
|
54718
|
+
internalType: 'bytes',
|
|
54719
|
+
name: 'rawValue',
|
|
54720
|
+
type: 'bytes'
|
|
54721
|
+
}
|
|
54722
|
+
],
|
|
54723
|
+
internalType: 'struct INonMerklizedIssuer.SubjectField[]',
|
|
54724
|
+
name: '',
|
|
54725
|
+
type: 'tuple[]'
|
|
54726
|
+
}
|
|
54727
|
+
],
|
|
54728
|
+
stateMutability: 'view',
|
|
54729
|
+
type: 'function'
|
|
54730
|
+
},
|
|
54731
|
+
{
|
|
54732
|
+
inputs: [],
|
|
54733
|
+
name: 'getCredentialAdapterVersion',
|
|
54734
|
+
outputs: [
|
|
54735
|
+
{
|
|
54736
|
+
internalType: 'string',
|
|
54737
|
+
name: '',
|
|
54738
|
+
type: 'string'
|
|
54739
|
+
}
|
|
54740
|
+
],
|
|
54741
|
+
stateMutability: 'pure',
|
|
54742
|
+
type: 'function'
|
|
54743
|
+
},
|
|
54744
|
+
{
|
|
54745
|
+
inputs: [],
|
|
54746
|
+
name: 'getId',
|
|
54747
|
+
outputs: [
|
|
54748
|
+
{
|
|
54749
|
+
internalType: 'uint256',
|
|
54750
|
+
name: '',
|
|
54751
|
+
type: 'uint256'
|
|
54752
|
+
}
|
|
54753
|
+
],
|
|
54754
|
+
stateMutability: 'view',
|
|
54755
|
+
type: 'function'
|
|
54756
|
+
},
|
|
54757
|
+
{
|
|
54758
|
+
inputs: [],
|
|
54759
|
+
name: 'getIsOldStateGenesis',
|
|
54760
|
+
outputs: [
|
|
54761
|
+
{
|
|
54762
|
+
internalType: 'bool',
|
|
54763
|
+
name: '',
|
|
54764
|
+
type: 'bool'
|
|
54765
|
+
}
|
|
54766
|
+
],
|
|
54767
|
+
stateMutability: 'view',
|
|
54768
|
+
type: 'function'
|
|
54769
|
+
},
|
|
54770
|
+
{
|
|
54771
|
+
inputs: [],
|
|
54772
|
+
name: 'getLatestPublishedClaimsRoot',
|
|
54773
|
+
outputs: [
|
|
54774
|
+
{
|
|
54775
|
+
internalType: 'uint256',
|
|
54776
|
+
name: '',
|
|
54777
|
+
type: 'uint256'
|
|
54778
|
+
}
|
|
54779
|
+
],
|
|
54780
|
+
stateMutability: 'view',
|
|
54781
|
+
type: 'function'
|
|
54782
|
+
},
|
|
54783
|
+
{
|
|
54784
|
+
inputs: [],
|
|
54785
|
+
name: 'getLatestPublishedRevocationsRoot',
|
|
54786
|
+
outputs: [
|
|
54787
|
+
{
|
|
54788
|
+
internalType: 'uint256',
|
|
54789
|
+
name: '',
|
|
54790
|
+
type: 'uint256'
|
|
54791
|
+
}
|
|
54792
|
+
],
|
|
54793
|
+
stateMutability: 'view',
|
|
54794
|
+
type: 'function'
|
|
54795
|
+
},
|
|
54796
|
+
{
|
|
54797
|
+
inputs: [],
|
|
54798
|
+
name: 'getLatestPublishedRootsRoot',
|
|
54799
|
+
outputs: [
|
|
54800
|
+
{
|
|
54801
|
+
internalType: 'uint256',
|
|
54802
|
+
name: '',
|
|
54803
|
+
type: 'uint256'
|
|
54804
|
+
}
|
|
54805
|
+
],
|
|
54806
|
+
stateMutability: 'view',
|
|
54807
|
+
type: 'function'
|
|
54808
|
+
},
|
|
54809
|
+
{
|
|
54810
|
+
inputs: [],
|
|
54811
|
+
name: 'getLatestPublishedState',
|
|
54812
|
+
outputs: [
|
|
54813
|
+
{
|
|
54814
|
+
internalType: 'uint256',
|
|
54815
|
+
name: '',
|
|
54816
|
+
type: 'uint256'
|
|
54817
|
+
}
|
|
54818
|
+
],
|
|
54819
|
+
stateMutability: 'view',
|
|
54820
|
+
type: 'function'
|
|
54821
|
+
},
|
|
54822
|
+
{
|
|
54823
|
+
inputs: [
|
|
54824
|
+
{
|
|
54825
|
+
internalType: 'uint64',
|
|
54826
|
+
name: 'revocationNonce',
|
|
54827
|
+
type: 'uint64'
|
|
54828
|
+
}
|
|
54829
|
+
],
|
|
54830
|
+
name: 'getRevocationProof',
|
|
54831
|
+
outputs: [
|
|
54832
|
+
{
|
|
54833
|
+
components: [
|
|
54834
|
+
{
|
|
54835
|
+
internalType: 'uint256',
|
|
54836
|
+
name: 'root',
|
|
54837
|
+
type: 'uint256'
|
|
54838
|
+
},
|
|
54839
|
+
{
|
|
54840
|
+
internalType: 'bool',
|
|
54841
|
+
name: 'existence',
|
|
54842
|
+
type: 'bool'
|
|
54843
|
+
},
|
|
54844
|
+
{
|
|
54845
|
+
internalType: 'uint256[]',
|
|
54846
|
+
name: 'siblings',
|
|
54847
|
+
type: 'uint256[]'
|
|
54848
|
+
},
|
|
54849
|
+
{
|
|
54850
|
+
internalType: 'uint256',
|
|
54851
|
+
name: 'index',
|
|
54852
|
+
type: 'uint256'
|
|
54853
|
+
},
|
|
54854
|
+
{
|
|
54855
|
+
internalType: 'uint256',
|
|
54856
|
+
name: 'value',
|
|
54857
|
+
type: 'uint256'
|
|
54858
|
+
},
|
|
54859
|
+
{
|
|
54860
|
+
internalType: 'bool',
|
|
54861
|
+
name: 'auxExistence',
|
|
54862
|
+
type: 'bool'
|
|
54863
|
+
},
|
|
54864
|
+
{
|
|
54865
|
+
internalType: 'uint256',
|
|
54866
|
+
name: 'auxIndex',
|
|
54867
|
+
type: 'uint256'
|
|
54868
|
+
},
|
|
54869
|
+
{
|
|
54870
|
+
internalType: 'uint256',
|
|
54871
|
+
name: 'auxValue',
|
|
54872
|
+
type: 'uint256'
|
|
54873
|
+
}
|
|
54874
|
+
],
|
|
54875
|
+
internalType: 'struct SmtLib.Proof',
|
|
54876
|
+
name: '',
|
|
54877
|
+
type: 'tuple'
|
|
54878
|
+
}
|
|
54879
|
+
],
|
|
54880
|
+
stateMutability: 'view',
|
|
54881
|
+
type: 'function'
|
|
54882
|
+
},
|
|
54883
|
+
{
|
|
54884
|
+
inputs: [
|
|
54885
|
+
{
|
|
54886
|
+
internalType: 'uint64',
|
|
54887
|
+
name: 'revocationNonce',
|
|
54888
|
+
type: 'uint64'
|
|
54889
|
+
},
|
|
54890
|
+
{
|
|
54891
|
+
internalType: 'uint256',
|
|
54892
|
+
name: 'root',
|
|
54893
|
+
type: 'uint256'
|
|
54894
|
+
}
|
|
54895
|
+
],
|
|
54896
|
+
name: 'getRevocationProofByRoot',
|
|
54897
|
+
outputs: [
|
|
54898
|
+
{
|
|
54899
|
+
components: [
|
|
54900
|
+
{
|
|
54901
|
+
internalType: 'uint256',
|
|
54902
|
+
name: 'root',
|
|
54903
|
+
type: 'uint256'
|
|
54904
|
+
},
|
|
54905
|
+
{
|
|
54906
|
+
internalType: 'bool',
|
|
54907
|
+
name: 'existence',
|
|
54908
|
+
type: 'bool'
|
|
54909
|
+
},
|
|
54910
|
+
{
|
|
54911
|
+
internalType: 'uint256[]',
|
|
54912
|
+
name: 'siblings',
|
|
54913
|
+
type: 'uint256[]'
|
|
54914
|
+
},
|
|
54915
|
+
{
|
|
54916
|
+
internalType: 'uint256',
|
|
54917
|
+
name: 'index',
|
|
54918
|
+
type: 'uint256'
|
|
54919
|
+
},
|
|
54920
|
+
{
|
|
54921
|
+
internalType: 'uint256',
|
|
54922
|
+
name: 'value',
|
|
54923
|
+
type: 'uint256'
|
|
54924
|
+
},
|
|
54925
|
+
{
|
|
54926
|
+
internalType: 'bool',
|
|
54927
|
+
name: 'auxExistence',
|
|
54928
|
+
type: 'bool'
|
|
54929
|
+
},
|
|
54930
|
+
{
|
|
54931
|
+
internalType: 'uint256',
|
|
54932
|
+
name: 'auxIndex',
|
|
54933
|
+
type: 'uint256'
|
|
54934
|
+
},
|
|
54935
|
+
{
|
|
54936
|
+
internalType: 'uint256',
|
|
54937
|
+
name: 'auxValue',
|
|
54938
|
+
type: 'uint256'
|
|
54939
|
+
}
|
|
54940
|
+
],
|
|
54941
|
+
internalType: 'struct SmtLib.Proof',
|
|
54942
|
+
name: '',
|
|
54943
|
+
type: 'tuple'
|
|
54944
|
+
}
|
|
54945
|
+
],
|
|
54946
|
+
stateMutability: 'view',
|
|
54947
|
+
type: 'function'
|
|
54948
|
+
},
|
|
54949
|
+
{
|
|
54950
|
+
inputs: [
|
|
54951
|
+
{
|
|
54952
|
+
internalType: 'uint64',
|
|
54953
|
+
name: 'revocationNonce',
|
|
54954
|
+
type: 'uint64'
|
|
54955
|
+
}
|
|
54956
|
+
],
|
|
54957
|
+
name: 'getRevocationProofWithStateInfo',
|
|
54958
|
+
outputs: [
|
|
54959
|
+
{
|
|
54960
|
+
components: [
|
|
54961
|
+
{
|
|
54962
|
+
internalType: 'uint256',
|
|
54963
|
+
name: 'root',
|
|
54964
|
+
type: 'uint256'
|
|
54965
|
+
},
|
|
54966
|
+
{
|
|
54967
|
+
internalType: 'bool',
|
|
54968
|
+
name: 'existence',
|
|
54969
|
+
type: 'bool'
|
|
54970
|
+
},
|
|
54971
|
+
{
|
|
54972
|
+
internalType: 'uint256[]',
|
|
54973
|
+
name: 'siblings',
|
|
54974
|
+
type: 'uint256[]'
|
|
54975
|
+
},
|
|
54976
|
+
{
|
|
54977
|
+
internalType: 'uint256',
|
|
54978
|
+
name: 'index',
|
|
54979
|
+
type: 'uint256'
|
|
54980
|
+
},
|
|
54981
|
+
{
|
|
54982
|
+
internalType: 'uint256',
|
|
54983
|
+
name: 'value',
|
|
54984
|
+
type: 'uint256'
|
|
54985
|
+
},
|
|
54986
|
+
{
|
|
54987
|
+
internalType: 'bool',
|
|
54988
|
+
name: 'auxExistence',
|
|
54989
|
+
type: 'bool'
|
|
54990
|
+
},
|
|
54991
|
+
{
|
|
54992
|
+
internalType: 'uint256',
|
|
54993
|
+
name: 'auxIndex',
|
|
54994
|
+
type: 'uint256'
|
|
54995
|
+
},
|
|
54996
|
+
{
|
|
54997
|
+
internalType: 'uint256',
|
|
54998
|
+
name: 'auxValue',
|
|
54999
|
+
type: 'uint256'
|
|
55000
|
+
}
|
|
55001
|
+
],
|
|
55002
|
+
internalType: 'struct SmtLib.Proof',
|
|
55003
|
+
name: '',
|
|
55004
|
+
type: 'tuple'
|
|
55005
|
+
},
|
|
55006
|
+
{
|
|
55007
|
+
components: [
|
|
55008
|
+
{
|
|
55009
|
+
internalType: 'uint256',
|
|
55010
|
+
name: 'state',
|
|
55011
|
+
type: 'uint256'
|
|
55012
|
+
},
|
|
55013
|
+
{
|
|
55014
|
+
internalType: 'uint256',
|
|
55015
|
+
name: 'claimsRoot',
|
|
55016
|
+
type: 'uint256'
|
|
55017
|
+
},
|
|
55018
|
+
{
|
|
55019
|
+
internalType: 'uint256',
|
|
55020
|
+
name: 'revocationsRoot',
|
|
55021
|
+
type: 'uint256'
|
|
55022
|
+
},
|
|
55023
|
+
{
|
|
55024
|
+
internalType: 'uint256',
|
|
55025
|
+
name: 'rootsRoot',
|
|
55026
|
+
type: 'uint256'
|
|
55027
|
+
}
|
|
55028
|
+
],
|
|
55029
|
+
internalType: 'struct IdentityLib.StateInfo',
|
|
55030
|
+
name: '',
|
|
55031
|
+
type: 'tuple'
|
|
55032
|
+
}
|
|
55033
|
+
],
|
|
55034
|
+
stateMutability: 'view',
|
|
55035
|
+
type: 'function'
|
|
55036
|
+
},
|
|
55037
|
+
{
|
|
55038
|
+
inputs: [
|
|
55039
|
+
{
|
|
55040
|
+
internalType: 'uint256',
|
|
55041
|
+
name: 'id',
|
|
55042
|
+
type: 'uint256'
|
|
55043
|
+
},
|
|
55044
|
+
{
|
|
55045
|
+
internalType: 'uint64',
|
|
55046
|
+
name: 'nonce',
|
|
55047
|
+
type: 'uint64'
|
|
55048
|
+
}
|
|
55049
|
+
],
|
|
55050
|
+
name: 'getRevocationStatus',
|
|
55051
|
+
outputs: [
|
|
55052
|
+
{
|
|
55053
|
+
components: [
|
|
55054
|
+
{
|
|
55055
|
+
components: [
|
|
55056
|
+
{
|
|
55057
|
+
internalType: 'uint256',
|
|
55058
|
+
name: 'state',
|
|
55059
|
+
type: 'uint256'
|
|
55060
|
+
},
|
|
55061
|
+
{
|
|
55062
|
+
internalType: 'uint256',
|
|
55063
|
+
name: 'claimsTreeRoot',
|
|
55064
|
+
type: 'uint256'
|
|
55065
|
+
},
|
|
55066
|
+
{
|
|
55067
|
+
internalType: 'uint256',
|
|
55068
|
+
name: 'revocationTreeRoot',
|
|
55069
|
+
type: 'uint256'
|
|
55070
|
+
},
|
|
55071
|
+
{
|
|
55072
|
+
internalType: 'uint256',
|
|
55073
|
+
name: 'rootOfRoots',
|
|
55074
|
+
type: 'uint256'
|
|
55075
|
+
}
|
|
55076
|
+
],
|
|
55077
|
+
internalType: 'struct IOnchainCredentialStatusResolver.IdentityStateRoots',
|
|
55078
|
+
name: 'issuer',
|
|
55079
|
+
type: 'tuple'
|
|
55080
|
+
},
|
|
55081
|
+
{
|
|
55082
|
+
components: [
|
|
55083
|
+
{
|
|
55084
|
+
internalType: 'uint256',
|
|
55085
|
+
name: 'root',
|
|
55086
|
+
type: 'uint256'
|
|
55087
|
+
},
|
|
55088
|
+
{
|
|
55089
|
+
internalType: 'bool',
|
|
55090
|
+
name: 'existence',
|
|
55091
|
+
type: 'bool'
|
|
55092
|
+
},
|
|
55093
|
+
{
|
|
55094
|
+
internalType: 'uint256[]',
|
|
55095
|
+
name: 'siblings',
|
|
55096
|
+
type: 'uint256[]'
|
|
55097
|
+
},
|
|
55098
|
+
{
|
|
55099
|
+
internalType: 'uint256',
|
|
55100
|
+
name: 'index',
|
|
55101
|
+
type: 'uint256'
|
|
55102
|
+
},
|
|
55103
|
+
{
|
|
55104
|
+
internalType: 'uint256',
|
|
55105
|
+
name: 'value',
|
|
55106
|
+
type: 'uint256'
|
|
55107
|
+
},
|
|
55108
|
+
{
|
|
55109
|
+
internalType: 'bool',
|
|
55110
|
+
name: 'auxExistence',
|
|
55111
|
+
type: 'bool'
|
|
55112
|
+
},
|
|
55113
|
+
{
|
|
55114
|
+
internalType: 'uint256',
|
|
55115
|
+
name: 'auxIndex',
|
|
55116
|
+
type: 'uint256'
|
|
55117
|
+
},
|
|
55118
|
+
{
|
|
55119
|
+
internalType: 'uint256',
|
|
55120
|
+
name: 'auxValue',
|
|
55121
|
+
type: 'uint256'
|
|
55122
|
+
}
|
|
55123
|
+
],
|
|
55124
|
+
internalType: 'struct IOnchainCredentialStatusResolver.Proof',
|
|
55125
|
+
name: 'mtp',
|
|
55126
|
+
type: 'tuple'
|
|
55127
|
+
}
|
|
55128
|
+
],
|
|
55129
|
+
internalType: 'struct IOnchainCredentialStatusResolver.CredentialStatus',
|
|
55130
|
+
name: '',
|
|
55131
|
+
type: 'tuple'
|
|
55132
|
+
}
|
|
55133
|
+
],
|
|
55134
|
+
stateMutability: 'view',
|
|
55135
|
+
type: 'function'
|
|
55136
|
+
},
|
|
55137
|
+
{
|
|
55138
|
+
inputs: [
|
|
55139
|
+
{
|
|
55140
|
+
internalType: 'uint256',
|
|
55141
|
+
name: 'id',
|
|
55142
|
+
type: 'uint256'
|
|
55143
|
+
},
|
|
55144
|
+
{
|
|
55145
|
+
internalType: 'uint256',
|
|
55146
|
+
name: 'state',
|
|
55147
|
+
type: 'uint256'
|
|
55148
|
+
},
|
|
55149
|
+
{
|
|
55150
|
+
internalType: 'uint64',
|
|
55151
|
+
name: 'nonce',
|
|
55152
|
+
type: 'uint64'
|
|
55153
|
+
}
|
|
55154
|
+
],
|
|
55155
|
+
name: 'getRevocationStatusByIdAndState',
|
|
55156
|
+
outputs: [
|
|
55157
|
+
{
|
|
55158
|
+
components: [
|
|
55159
|
+
{
|
|
55160
|
+
components: [
|
|
55161
|
+
{
|
|
55162
|
+
internalType: 'uint256',
|
|
55163
|
+
name: 'state',
|
|
55164
|
+
type: 'uint256'
|
|
55165
|
+
},
|
|
55166
|
+
{
|
|
55167
|
+
internalType: 'uint256',
|
|
55168
|
+
name: 'claimsTreeRoot',
|
|
55169
|
+
type: 'uint256'
|
|
55170
|
+
},
|
|
55171
|
+
{
|
|
55172
|
+
internalType: 'uint256',
|
|
55173
|
+
name: 'revocationTreeRoot',
|
|
55174
|
+
type: 'uint256'
|
|
55175
|
+
},
|
|
55176
|
+
{
|
|
55177
|
+
internalType: 'uint256',
|
|
55178
|
+
name: 'rootOfRoots',
|
|
55179
|
+
type: 'uint256'
|
|
55180
|
+
}
|
|
55181
|
+
],
|
|
55182
|
+
internalType: 'struct IOnchainCredentialStatusResolver.IdentityStateRoots',
|
|
55183
|
+
name: 'issuer',
|
|
55184
|
+
type: 'tuple'
|
|
55185
|
+
},
|
|
55186
|
+
{
|
|
55187
|
+
components: [
|
|
55188
|
+
{
|
|
55189
|
+
internalType: 'uint256',
|
|
55190
|
+
name: 'root',
|
|
55191
|
+
type: 'uint256'
|
|
55192
|
+
},
|
|
55193
|
+
{
|
|
55194
|
+
internalType: 'bool',
|
|
55195
|
+
name: 'existence',
|
|
55196
|
+
type: 'bool'
|
|
55197
|
+
},
|
|
55198
|
+
{
|
|
55199
|
+
internalType: 'uint256[]',
|
|
55200
|
+
name: 'siblings',
|
|
55201
|
+
type: 'uint256[]'
|
|
55202
|
+
},
|
|
55203
|
+
{
|
|
55204
|
+
internalType: 'uint256',
|
|
55205
|
+
name: 'index',
|
|
55206
|
+
type: 'uint256'
|
|
55207
|
+
},
|
|
55208
|
+
{
|
|
55209
|
+
internalType: 'uint256',
|
|
55210
|
+
name: 'value',
|
|
55211
|
+
type: 'uint256'
|
|
55212
|
+
},
|
|
55213
|
+
{
|
|
55214
|
+
internalType: 'bool',
|
|
55215
|
+
name: 'auxExistence',
|
|
55216
|
+
type: 'bool'
|
|
55217
|
+
},
|
|
55218
|
+
{
|
|
55219
|
+
internalType: 'uint256',
|
|
55220
|
+
name: 'auxIndex',
|
|
55221
|
+
type: 'uint256'
|
|
55222
|
+
},
|
|
55223
|
+
{
|
|
55224
|
+
internalType: 'uint256',
|
|
55225
|
+
name: 'auxValue',
|
|
55226
|
+
type: 'uint256'
|
|
55227
|
+
}
|
|
55228
|
+
],
|
|
55229
|
+
internalType: 'struct IOnchainCredentialStatusResolver.Proof',
|
|
55230
|
+
name: 'mtp',
|
|
55231
|
+
type: 'tuple'
|
|
55232
|
+
}
|
|
55233
|
+
],
|
|
55234
|
+
internalType: 'struct IOnchainCredentialStatusResolver.CredentialStatus',
|
|
55235
|
+
name: '',
|
|
55236
|
+
type: 'tuple'
|
|
55237
|
+
}
|
|
55238
|
+
],
|
|
55239
|
+
stateMutability: 'view',
|
|
55240
|
+
type: 'function'
|
|
55241
|
+
},
|
|
55242
|
+
{
|
|
55243
|
+
inputs: [],
|
|
55244
|
+
name: 'getRevocationsTreeRoot',
|
|
55245
|
+
outputs: [
|
|
55246
|
+
{
|
|
55247
|
+
internalType: 'uint256',
|
|
55248
|
+
name: '',
|
|
55249
|
+
type: 'uint256'
|
|
55250
|
+
}
|
|
55251
|
+
],
|
|
55252
|
+
stateMutability: 'view',
|
|
55253
|
+
type: 'function'
|
|
55254
|
+
},
|
|
55255
|
+
{
|
|
55256
|
+
inputs: [
|
|
55257
|
+
{
|
|
55258
|
+
internalType: 'uint256',
|
|
55259
|
+
name: 'rootsTreeRoot',
|
|
55260
|
+
type: 'uint256'
|
|
55261
|
+
}
|
|
55262
|
+
],
|
|
55263
|
+
name: 'getRootProof',
|
|
55264
|
+
outputs: [
|
|
55265
|
+
{
|
|
55266
|
+
components: [
|
|
55267
|
+
{
|
|
55268
|
+
internalType: 'uint256',
|
|
55269
|
+
name: 'root',
|
|
55270
|
+
type: 'uint256'
|
|
55271
|
+
},
|
|
55272
|
+
{
|
|
55273
|
+
internalType: 'bool',
|
|
55274
|
+
name: 'existence',
|
|
55275
|
+
type: 'bool'
|
|
55276
|
+
},
|
|
55277
|
+
{
|
|
55278
|
+
internalType: 'uint256[]',
|
|
55279
|
+
name: 'siblings',
|
|
55280
|
+
type: 'uint256[]'
|
|
55281
|
+
},
|
|
55282
|
+
{
|
|
55283
|
+
internalType: 'uint256',
|
|
55284
|
+
name: 'index',
|
|
55285
|
+
type: 'uint256'
|
|
55286
|
+
},
|
|
55287
|
+
{
|
|
55288
|
+
internalType: 'uint256',
|
|
55289
|
+
name: 'value',
|
|
55290
|
+
type: 'uint256'
|
|
55291
|
+
},
|
|
55292
|
+
{
|
|
55293
|
+
internalType: 'bool',
|
|
55294
|
+
name: 'auxExistence',
|
|
55295
|
+
type: 'bool'
|
|
55296
|
+
},
|
|
55297
|
+
{
|
|
55298
|
+
internalType: 'uint256',
|
|
55299
|
+
name: 'auxIndex',
|
|
55300
|
+
type: 'uint256'
|
|
55301
|
+
},
|
|
55302
|
+
{
|
|
55303
|
+
internalType: 'uint256',
|
|
55304
|
+
name: 'auxValue',
|
|
55305
|
+
type: 'uint256'
|
|
55306
|
+
}
|
|
55307
|
+
],
|
|
55308
|
+
internalType: 'struct SmtLib.Proof',
|
|
55309
|
+
name: '',
|
|
55310
|
+
type: 'tuple'
|
|
55311
|
+
}
|
|
55312
|
+
],
|
|
55313
|
+
stateMutability: 'view',
|
|
55314
|
+
type: 'function'
|
|
55315
|
+
},
|
|
55316
|
+
{
|
|
55317
|
+
inputs: [
|
|
55318
|
+
{
|
|
55319
|
+
internalType: 'uint256',
|
|
55320
|
+
name: 'claimsTreeRoot',
|
|
55321
|
+
type: 'uint256'
|
|
55322
|
+
},
|
|
55323
|
+
{
|
|
55324
|
+
internalType: 'uint256',
|
|
55325
|
+
name: 'root',
|
|
55326
|
+
type: 'uint256'
|
|
55327
|
+
}
|
|
55328
|
+
],
|
|
55329
|
+
name: 'getRootProofByRoot',
|
|
55330
|
+
outputs: [
|
|
55331
|
+
{
|
|
55332
|
+
components: [
|
|
55333
|
+
{
|
|
55334
|
+
internalType: 'uint256',
|
|
55335
|
+
name: 'root',
|
|
55336
|
+
type: 'uint256'
|
|
55337
|
+
},
|
|
55338
|
+
{
|
|
55339
|
+
internalType: 'bool',
|
|
55340
|
+
name: 'existence',
|
|
55341
|
+
type: 'bool'
|
|
55342
|
+
},
|
|
55343
|
+
{
|
|
55344
|
+
internalType: 'uint256[]',
|
|
55345
|
+
name: 'siblings',
|
|
55346
|
+
type: 'uint256[]'
|
|
55347
|
+
},
|
|
55348
|
+
{
|
|
55349
|
+
internalType: 'uint256',
|
|
55350
|
+
name: 'index',
|
|
55351
|
+
type: 'uint256'
|
|
55352
|
+
},
|
|
55353
|
+
{
|
|
55354
|
+
internalType: 'uint256',
|
|
55355
|
+
name: 'value',
|
|
55356
|
+
type: 'uint256'
|
|
55357
|
+
},
|
|
55358
|
+
{
|
|
55359
|
+
internalType: 'bool',
|
|
55360
|
+
name: 'auxExistence',
|
|
55361
|
+
type: 'bool'
|
|
55362
|
+
},
|
|
55363
|
+
{
|
|
55364
|
+
internalType: 'uint256',
|
|
55365
|
+
name: 'auxIndex',
|
|
55366
|
+
type: 'uint256'
|
|
55367
|
+
},
|
|
55368
|
+
{
|
|
55369
|
+
internalType: 'uint256',
|
|
55370
|
+
name: 'auxValue',
|
|
55371
|
+
type: 'uint256'
|
|
55372
|
+
}
|
|
55373
|
+
],
|
|
55374
|
+
internalType: 'struct SmtLib.Proof',
|
|
55375
|
+
name: '',
|
|
55376
|
+
type: 'tuple'
|
|
55377
|
+
}
|
|
55378
|
+
],
|
|
55379
|
+
stateMutability: 'view',
|
|
55380
|
+
type: 'function'
|
|
55381
|
+
},
|
|
55382
|
+
{
|
|
55383
|
+
inputs: [
|
|
55384
|
+
{
|
|
55385
|
+
internalType: 'uint256',
|
|
55386
|
+
name: 'rootsTreeRoot',
|
|
55387
|
+
type: 'uint256'
|
|
55388
|
+
}
|
|
55389
|
+
],
|
|
55390
|
+
name: 'getRootProofWithStateInfo',
|
|
55391
|
+
outputs: [
|
|
55392
|
+
{
|
|
55393
|
+
components: [
|
|
55394
|
+
{
|
|
55395
|
+
internalType: 'uint256',
|
|
55396
|
+
name: 'root',
|
|
55397
|
+
type: 'uint256'
|
|
55398
|
+
},
|
|
55399
|
+
{
|
|
55400
|
+
internalType: 'bool',
|
|
55401
|
+
name: 'existence',
|
|
55402
|
+
type: 'bool'
|
|
55403
|
+
},
|
|
55404
|
+
{
|
|
55405
|
+
internalType: 'uint256[]',
|
|
55406
|
+
name: 'siblings',
|
|
55407
|
+
type: 'uint256[]'
|
|
55408
|
+
},
|
|
55409
|
+
{
|
|
55410
|
+
internalType: 'uint256',
|
|
55411
|
+
name: 'index',
|
|
55412
|
+
type: 'uint256'
|
|
55413
|
+
},
|
|
55414
|
+
{
|
|
55415
|
+
internalType: 'uint256',
|
|
55416
|
+
name: 'value',
|
|
55417
|
+
type: 'uint256'
|
|
55418
|
+
},
|
|
55419
|
+
{
|
|
55420
|
+
internalType: 'bool',
|
|
55421
|
+
name: 'auxExistence',
|
|
55422
|
+
type: 'bool'
|
|
55423
|
+
},
|
|
55424
|
+
{
|
|
55425
|
+
internalType: 'uint256',
|
|
55426
|
+
name: 'auxIndex',
|
|
55427
|
+
type: 'uint256'
|
|
55428
|
+
},
|
|
55429
|
+
{
|
|
55430
|
+
internalType: 'uint256',
|
|
55431
|
+
name: 'auxValue',
|
|
55432
|
+
type: 'uint256'
|
|
55433
|
+
}
|
|
55434
|
+
],
|
|
55435
|
+
internalType: 'struct SmtLib.Proof',
|
|
55436
|
+
name: '',
|
|
55437
|
+
type: 'tuple'
|
|
55438
|
+
},
|
|
55439
|
+
{
|
|
55440
|
+
components: [
|
|
55441
|
+
{
|
|
55442
|
+
internalType: 'uint256',
|
|
55443
|
+
name: 'state',
|
|
55444
|
+
type: 'uint256'
|
|
55445
|
+
},
|
|
55446
|
+
{
|
|
55447
|
+
internalType: 'uint256',
|
|
55448
|
+
name: 'claimsRoot',
|
|
55449
|
+
type: 'uint256'
|
|
55450
|
+
},
|
|
55451
|
+
{
|
|
55452
|
+
internalType: 'uint256',
|
|
55453
|
+
name: 'revocationsRoot',
|
|
55454
|
+
type: 'uint256'
|
|
55455
|
+
},
|
|
55456
|
+
{
|
|
55457
|
+
internalType: 'uint256',
|
|
55458
|
+
name: 'rootsRoot',
|
|
55459
|
+
type: 'uint256'
|
|
55460
|
+
}
|
|
55461
|
+
],
|
|
55462
|
+
internalType: 'struct IdentityLib.StateInfo',
|
|
55463
|
+
name: '',
|
|
55464
|
+
type: 'tuple'
|
|
55465
|
+
}
|
|
55466
|
+
],
|
|
55467
|
+
stateMutability: 'view',
|
|
55468
|
+
type: 'function'
|
|
55469
|
+
},
|
|
55470
|
+
{
|
|
55471
|
+
inputs: [
|
|
55472
|
+
{
|
|
55473
|
+
internalType: 'uint256',
|
|
55474
|
+
name: 'state',
|
|
55475
|
+
type: 'uint256'
|
|
55476
|
+
}
|
|
55477
|
+
],
|
|
55478
|
+
name: 'getRootsByState',
|
|
55479
|
+
outputs: [
|
|
55480
|
+
{
|
|
55481
|
+
components: [
|
|
55482
|
+
{
|
|
55483
|
+
internalType: 'uint256',
|
|
55484
|
+
name: 'claimsRoot',
|
|
55485
|
+
type: 'uint256'
|
|
55486
|
+
},
|
|
55487
|
+
{
|
|
55488
|
+
internalType: 'uint256',
|
|
55489
|
+
name: 'revocationsRoot',
|
|
55490
|
+
type: 'uint256'
|
|
55491
|
+
},
|
|
55492
|
+
{
|
|
55493
|
+
internalType: 'uint256',
|
|
55494
|
+
name: 'rootsRoot',
|
|
55495
|
+
type: 'uint256'
|
|
55496
|
+
}
|
|
55497
|
+
],
|
|
55498
|
+
internalType: 'struct IdentityLib.Roots',
|
|
55499
|
+
name: '',
|
|
55500
|
+
type: 'tuple'
|
|
55501
|
+
}
|
|
55502
|
+
],
|
|
55503
|
+
stateMutability: 'view',
|
|
55504
|
+
type: 'function'
|
|
55505
|
+
},
|
|
55506
|
+
{
|
|
55507
|
+
inputs: [],
|
|
55508
|
+
name: 'getRootsTreeRoot',
|
|
55509
|
+
outputs: [
|
|
55510
|
+
{
|
|
55511
|
+
internalType: 'uint256',
|
|
55512
|
+
name: '',
|
|
55513
|
+
type: 'uint256'
|
|
55514
|
+
}
|
|
55515
|
+
],
|
|
55516
|
+
stateMutability: 'view',
|
|
55517
|
+
type: 'function'
|
|
55518
|
+
},
|
|
55519
|
+
{
|
|
55520
|
+
inputs: [],
|
|
55521
|
+
name: 'getSmtDepth',
|
|
55522
|
+
outputs: [
|
|
55523
|
+
{
|
|
55524
|
+
internalType: 'uint256',
|
|
55525
|
+
name: '',
|
|
55526
|
+
type: 'uint256'
|
|
55527
|
+
}
|
|
55528
|
+
],
|
|
55529
|
+
stateMutability: 'pure',
|
|
55530
|
+
type: 'function'
|
|
55531
|
+
},
|
|
55532
|
+
{
|
|
55533
|
+
inputs: [
|
|
55534
|
+
{
|
|
55535
|
+
internalType: 'uint256',
|
|
55536
|
+
name: '_userId',
|
|
55537
|
+
type: 'uint256'
|
|
55538
|
+
}
|
|
55539
|
+
],
|
|
55540
|
+
name: 'getUserCredentialIds',
|
|
55541
|
+
outputs: [
|
|
55542
|
+
{
|
|
55543
|
+
internalType: 'uint256[]',
|
|
55544
|
+
name: '',
|
|
55545
|
+
type: 'uint256[]'
|
|
55546
|
+
}
|
|
55547
|
+
],
|
|
55548
|
+
stateMutability: 'view',
|
|
55549
|
+
type: 'function'
|
|
55550
|
+
},
|
|
55551
|
+
{
|
|
55552
|
+
inputs: [
|
|
55553
|
+
{
|
|
55554
|
+
internalType: 'address',
|
|
55555
|
+
name: '_stateContractAddr',
|
|
55556
|
+
type: 'address'
|
|
55557
|
+
},
|
|
55558
|
+
{
|
|
55559
|
+
internalType: 'bytes2',
|
|
55560
|
+
name: 'idType',
|
|
55561
|
+
type: 'bytes2'
|
|
55562
|
+
}
|
|
55563
|
+
],
|
|
55564
|
+
name: 'initialize',
|
|
55565
|
+
outputs: [],
|
|
55566
|
+
stateMutability: 'nonpayable',
|
|
55567
|
+
type: 'function'
|
|
55568
|
+
},
|
|
55569
|
+
{
|
|
55570
|
+
inputs: [
|
|
55571
|
+
{
|
|
55572
|
+
internalType: 'bytes4',
|
|
55573
|
+
name: 'interfaceId',
|
|
55574
|
+
type: 'bytes4'
|
|
55575
|
+
}
|
|
55576
|
+
],
|
|
55577
|
+
name: 'supportsInterface',
|
|
55578
|
+
outputs: [
|
|
55579
|
+
{
|
|
55580
|
+
internalType: 'bool',
|
|
55581
|
+
name: '',
|
|
55582
|
+
type: 'bool'
|
|
55583
|
+
}
|
|
55584
|
+
],
|
|
55585
|
+
stateMutability: 'view',
|
|
55586
|
+
type: 'function'
|
|
55587
|
+
}
|
|
55588
|
+
];
|
|
55589
|
+
class NonMerklizedIssuerBase__factory {
|
|
55590
|
+
static abi = _abi;
|
|
55591
|
+
static createInterface() {
|
|
55592
|
+
return new Interface(_abi);
|
|
55593
|
+
}
|
|
55594
|
+
static connect(address, runner) {
|
|
55595
|
+
return new Contract(address, _abi, runner);
|
|
55596
|
+
}
|
|
55597
|
+
}
|
|
55598
|
+
|
|
55599
|
+
var NonMerklizedIssuerInterfaces;
|
|
55600
|
+
(function (NonMerklizedIssuerInterfaces) {
|
|
55601
|
+
NonMerklizedIssuerInterfaces["InterfaceDetection"] = "0x01ffc9a7";
|
|
55602
|
+
NonMerklizedIssuerInterfaces["InterfaceNonMerklizedIssuer"] = "0x58874949";
|
|
55603
|
+
NonMerklizedIssuerInterfaces["InterfaceGetCredential"] = "0x5d1ca631";
|
|
55604
|
+
})(NonMerklizedIssuerInterfaces || (NonMerklizedIssuerInterfaces = {}));
|
|
55605
|
+
var ValueHashes;
|
|
55606
|
+
(function (ValueHashes) {
|
|
55607
|
+
ValueHashes["BooleanTrue"] = "18586133768512220936620570745912940619677854269274689475585506675881198879027";
|
|
55608
|
+
ValueHashes["BooleanFalse"] = "19014214495641488759237505126948346942972912379615652741039992445865937985820";
|
|
55609
|
+
})(ValueHashes || (ValueHashes = {}));
|
|
55610
|
+
/**
|
|
55611
|
+
* `OnchainNonMerklizedIssuerAdapter` provides functionality to interact with a non-merklized on-chain credential issuer.
|
|
55612
|
+
* This adapter enables interface detection, credential retrieval, and conversion to the W3C Verifiable Credential format.
|
|
55613
|
+
*
|
|
55614
|
+
* @public
|
|
55615
|
+
* @beta
|
|
55616
|
+
* @class OnchainNonMerklizedIssuerAdapter
|
|
55617
|
+
*/
|
|
55618
|
+
class OnchainNonMerklizedIssuerAdapter {
|
|
55619
|
+
/**
|
|
55620
|
+
* Initializes an instance of `OnchainNonMerklizedIssuerAdapter`.
|
|
55621
|
+
*
|
|
55622
|
+
* @param ethConnectionConfig The configuration for the Ethereum connection.
|
|
55623
|
+
* @param issuerDid The decentralized identifier (DID) of the issuer.
|
|
55624
|
+
* @param merklizationOptions Optional settings for merklization.
|
|
55625
|
+
*/
|
|
55626
|
+
constructor(ethConnectionConfig, issuerDid, options) {
|
|
55627
|
+
if (!ethConnectionConfig.chainId) {
|
|
55628
|
+
throw new Error('Chain ID is required');
|
|
55629
|
+
}
|
|
55630
|
+
this._chainId = ethConnectionConfig.chainId;
|
|
55631
|
+
this._contractAddress = getAddress(hexlify(Id$1.ethAddressFromId(DID.idFromDID(issuerDid))));
|
|
55632
|
+
this._contract = NonMerklizedIssuerBase__factory.connect(this._contractAddress, new JsonRpcProvider(ethConnectionConfig.url));
|
|
55633
|
+
this._issuerDid = issuerDid;
|
|
55634
|
+
this._merklizationOptions = options?.merklizationOptions;
|
|
55635
|
+
}
|
|
55636
|
+
/**
|
|
55637
|
+
* Checks if the contract supports required interfaces.
|
|
55638
|
+
* Throws an error if any required interface is unsupported.
|
|
55639
|
+
*
|
|
55640
|
+
* @throws Error - If required interfaces are not supported.
|
|
55641
|
+
*/
|
|
55642
|
+
async isInterfaceSupported() {
|
|
55643
|
+
const supportedInterfaces = [
|
|
55644
|
+
{
|
|
55645
|
+
name: 'Interface detection ERC-165',
|
|
55646
|
+
value: NonMerklizedIssuerInterfaces.InterfaceDetection
|
|
55647
|
+
},
|
|
55648
|
+
{
|
|
55649
|
+
name: 'Interface non-merklized issuer',
|
|
55650
|
+
value: NonMerklizedIssuerInterfaces.InterfaceNonMerklizedIssuer
|
|
55651
|
+
},
|
|
55652
|
+
{
|
|
55653
|
+
name: 'Interface get credential',
|
|
55654
|
+
value: NonMerklizedIssuerInterfaces.InterfaceGetCredential
|
|
55655
|
+
}
|
|
55656
|
+
];
|
|
55657
|
+
const unsupportedInterfaces = await Promise.all(supportedInterfaces.map(async (interfaceObj) => {
|
|
55658
|
+
const isSupported = await this._contract.supportsInterface(interfaceObj.value);
|
|
55659
|
+
return isSupported ? null : interfaceObj.name;
|
|
55660
|
+
}));
|
|
55661
|
+
const unsupportedInterfacesFiltered = unsupportedInterfaces.filter((interfaceName) => interfaceName !== null);
|
|
55662
|
+
if (unsupportedInterfacesFiltered.length > 0) {
|
|
55663
|
+
throw new Error(`Unsupported interfaces: ${unsupportedInterfacesFiltered.join(', ')}`);
|
|
55664
|
+
}
|
|
55665
|
+
}
|
|
55666
|
+
/**
|
|
55667
|
+
* Retrieves a credential from the on-chain non-merklized contract.
|
|
55668
|
+
* @param userId The user's core.Id.
|
|
55669
|
+
* @param credentialId The unique identifier of the credential.
|
|
55670
|
+
*/
|
|
55671
|
+
async getCredential(userId, credentialId) {
|
|
55672
|
+
const [credentialData, coreClaimBigInts, credentialSubjectFields] = await this._contract.getCredential(userId.bigInt(), credentialId);
|
|
55673
|
+
return { credentialData, coreClaimBigInts, credentialSubjectFields };
|
|
55674
|
+
}
|
|
55675
|
+
/**
|
|
55676
|
+
* Retrieves the credential IDs of a user.
|
|
55677
|
+
* @param userId The user's core.Id.
|
|
55678
|
+
* @returns An array of credential IDs.
|
|
55679
|
+
*/
|
|
55680
|
+
async getUserCredentialsIds(userId) {
|
|
55681
|
+
return this._contract.getUserCredentialIds(userId.bigInt());
|
|
55682
|
+
}
|
|
55683
|
+
/**
|
|
55684
|
+
* Converts on-chain credential to a verifiable credential.
|
|
55685
|
+
*
|
|
55686
|
+
* @param credentialData Data structure of the credential from the contract.
|
|
55687
|
+
* @param coreClaimBigInts Claim data in bigint format.
|
|
55688
|
+
* @param credentialSubjectFields Subject fields of the credential.
|
|
55689
|
+
*/
|
|
55690
|
+
async convertOnChainInfoToW3CCredential(credentialData, coreClaimBigInts, credentialSubjectFields) {
|
|
55691
|
+
const c = new Claim().unMarshalJson(JSON.stringify(coreClaimBigInts.map((b) => b.toString())));
|
|
55692
|
+
const credentialSubject = await this.convertCredentialSubject(c, credentialData.context, credentialData._type, credentialSubjectFields);
|
|
55693
|
+
const credentialRequest = {
|
|
55694
|
+
id: this.credentialId(credentialData.id),
|
|
55695
|
+
credentialSchema: credentialData.credentialSchema.id,
|
|
55696
|
+
type: credentialData._type,
|
|
55697
|
+
credentialSubject: credentialSubject,
|
|
55698
|
+
expiration: c.getExpirationDate()?.getTime(),
|
|
55699
|
+
displayMethod: this.convertDisplayMethod(credentialData.displayMethod),
|
|
55700
|
+
context: credentialData.context,
|
|
55701
|
+
revocationOpts: {
|
|
55702
|
+
id: this._contractAddress,
|
|
55703
|
+
nonce: Number(c.getRevocationNonce()),
|
|
55704
|
+
type: CredentialStatusType.Iden3OnchainSparseMerkleTreeProof2023
|
|
55705
|
+
},
|
|
55706
|
+
issuanceDate: getDateFromUnixTimestamp(Number(credentialData.issuanceDate)).getTime()
|
|
55707
|
+
};
|
|
55708
|
+
const existenceProof = await this.existenceProof(c);
|
|
55709
|
+
const w3c = W3CCredential.fromCredentialRequest(this._issuerDid, credentialRequest);
|
|
55710
|
+
w3c.proof = [existenceProof];
|
|
55711
|
+
return w3c;
|
|
55712
|
+
}
|
|
55713
|
+
credentialId(id) {
|
|
55714
|
+
return `urn:iden3:onchain:${this._chainId}:${this._contractAddress}:${id}`;
|
|
55715
|
+
}
|
|
55716
|
+
async convertCredentialSubject(coreClaim, contractContexts, credentialType, credentialSubjectFields) {
|
|
55717
|
+
const contractContextsStr = JSON.stringify({
|
|
55718
|
+
'@context': contractContexts
|
|
55719
|
+
});
|
|
55720
|
+
const credentialSubject = {};
|
|
55721
|
+
for (const f of credentialSubjectFields) {
|
|
55722
|
+
const dataType = await Path.newTypeFromContext(contractContextsStr, `${credentialType}.${f.key}`, this._merklizationOptions);
|
|
55723
|
+
switch (dataType) {
|
|
55724
|
+
case XSDNS.Boolean: {
|
|
55725
|
+
switch (f.rawValue.toString()) {
|
|
55726
|
+
case ValueHashes.BooleanTrue:
|
|
55727
|
+
credentialSubject[f.key] = true;
|
|
55728
|
+
break;
|
|
55729
|
+
case ValueHashes.BooleanFalse:
|
|
55730
|
+
credentialSubject[f.key] = false;
|
|
55731
|
+
break;
|
|
55732
|
+
}
|
|
55733
|
+
break;
|
|
55734
|
+
}
|
|
55735
|
+
case (XSDNS.PositiveInteger):
|
|
55736
|
+
{
|
|
55737
|
+
credentialSubject[f.key] = f.value.toString();
|
|
55738
|
+
break;
|
|
55739
|
+
}
|
|
55740
|
+
case XSDNS.Integer: {
|
|
55741
|
+
credentialSubject[f.key] = Number(f.value);
|
|
55742
|
+
break;
|
|
55743
|
+
}
|
|
55744
|
+
case XSDNS.String: {
|
|
55745
|
+
this.validateSourceValue(dataType, f.value, f.rawValue);
|
|
55746
|
+
credentialSubject[f.key] = f.rawValue;
|
|
55747
|
+
break;
|
|
55748
|
+
}
|
|
55749
|
+
case XSDNS.DateTime: {
|
|
55750
|
+
const timestamp = BigInt(f.rawValue);
|
|
55751
|
+
const sourceTimestamp = getDateFromUnixTimestamp(Number(timestamp)).toISOString();
|
|
55752
|
+
this.validateSourceValue(dataType, f.value, sourceTimestamp);
|
|
55753
|
+
credentialSubject[f.key] = sourceTimestamp;
|
|
55754
|
+
break;
|
|
55755
|
+
}
|
|
55756
|
+
case XSDNS.Double: {
|
|
55757
|
+
const rawFloat = Number(f.rawValue);
|
|
55758
|
+
this.validateSourceValue(dataType, f.value, rawFloat);
|
|
55759
|
+
credentialSubject[f.key] = rawFloat;
|
|
55760
|
+
break;
|
|
55761
|
+
}
|
|
55762
|
+
default: {
|
|
55763
|
+
throw new Error(`Unsupported data type ${dataType}`);
|
|
55764
|
+
}
|
|
55765
|
+
}
|
|
55766
|
+
}
|
|
55767
|
+
credentialSubject['type'] = credentialType;
|
|
55768
|
+
const subjectId = coreClaim.getId();
|
|
55769
|
+
const subjectDid = DID.parseFromId(subjectId);
|
|
55770
|
+
credentialSubject['id'] = subjectDid.string();
|
|
55771
|
+
return credentialSubject;
|
|
55772
|
+
}
|
|
55773
|
+
async existenceProof(coreClaim) {
|
|
55774
|
+
const [mtpProof, stateInfo] = await this._contract.getClaimProofWithStateInfo(coreClaim.hIndex());
|
|
55775
|
+
if (!mtpProof.existence) {
|
|
55776
|
+
throw new Error('Claim does not exist');
|
|
55777
|
+
}
|
|
55778
|
+
const latestStateHash = Hash$2.fromBigInt(stateInfo.state);
|
|
55779
|
+
const latestClaimsOfRootHash = Hash$2.fromBigInt(stateInfo.claimsRoot);
|
|
55780
|
+
const latestRevocationOfRootHash = Hash$2.fromBigInt(stateInfo.revocationsRoot);
|
|
55781
|
+
const latestRootsOfRootHash = Hash$2.fromBigInt(stateInfo.rootsRoot);
|
|
55782
|
+
const p = new Proof({
|
|
55783
|
+
siblings: mtpProof.siblings.map((s) => Hash$2.fromBigInt(s)),
|
|
55784
|
+
existence: mtpProof.existence,
|
|
55785
|
+
nodeAux: mtpProof.auxExistence
|
|
55786
|
+
? {
|
|
55787
|
+
key: Hash$2.fromBigInt(mtpProof.auxIndex),
|
|
55788
|
+
value: Hash$2.fromBigInt(mtpProof.auxValue)
|
|
55789
|
+
}
|
|
55790
|
+
: undefined
|
|
55791
|
+
});
|
|
55792
|
+
return new Iden3SparseMerkleTreeProof({
|
|
55793
|
+
issuerData: {
|
|
55794
|
+
id: this._issuerDid,
|
|
55795
|
+
state: {
|
|
55796
|
+
value: latestStateHash,
|
|
55797
|
+
claimsTreeRoot: latestClaimsOfRootHash,
|
|
55798
|
+
revocationTreeRoot: latestRevocationOfRootHash,
|
|
55799
|
+
rootOfRoots: latestRootsOfRootHash
|
|
55800
|
+
}
|
|
55801
|
+
},
|
|
55802
|
+
mtp: p,
|
|
55803
|
+
coreClaim: coreClaim
|
|
55804
|
+
});
|
|
55805
|
+
}
|
|
55806
|
+
async validateSourceValue(dataType, originHash, source) {
|
|
55807
|
+
const sourceHash = await Merklizer.hashValue(dataType, source);
|
|
55808
|
+
if (sourceHash !== originHash) {
|
|
55809
|
+
throw new Error(`Invalid source value for ${dataType} type`);
|
|
55810
|
+
}
|
|
55811
|
+
}
|
|
55812
|
+
convertDisplayMethod(onchainDisplayMethod) {
|
|
55813
|
+
if (!onchainDisplayMethod.id || !onchainDisplayMethod._type) {
|
|
55814
|
+
return undefined;
|
|
55815
|
+
}
|
|
55816
|
+
switch (onchainDisplayMethod._type) {
|
|
55817
|
+
case DisplayMethodType.Iden3BasicDisplayMethodV1: {
|
|
55818
|
+
return {
|
|
55819
|
+
id: onchainDisplayMethod.id,
|
|
55820
|
+
type: DisplayMethodType.Iden3BasicDisplayMethodV1
|
|
55821
|
+
};
|
|
55822
|
+
}
|
|
55823
|
+
default: {
|
|
55824
|
+
throw new Error(`Unsupported display method type ${onchainDisplayMethod._type}`);
|
|
55825
|
+
}
|
|
55826
|
+
}
|
|
55827
|
+
}
|
|
55828
|
+
}
|
|
55829
|
+
|
|
55830
|
+
/**
|
|
55831
|
+
* Represents an adapter for interacting with on-chain issuers.
|
|
55832
|
+
*
|
|
55833
|
+
* @public
|
|
55834
|
+
* @beta
|
|
55835
|
+
* @class OnchainIssuer
|
|
55836
|
+
*/
|
|
55837
|
+
class OnchainIssuer {
|
|
55838
|
+
/**
|
|
55839
|
+
* Initializes an instance of `Adapter`.
|
|
55840
|
+
* @param config The configuration for the Ethereum connection.
|
|
55841
|
+
* @param merklizationOptions Optional settings for merklization.
|
|
55842
|
+
*/
|
|
55843
|
+
constructor(config, options) {
|
|
55844
|
+
this._ethConnectionConfig = config;
|
|
55845
|
+
this._onchainIssuerOptions = options;
|
|
55846
|
+
}
|
|
55847
|
+
/**
|
|
55848
|
+
* Retrieves a credential from the on-chain issuer.
|
|
55849
|
+
* @param issuerDID The issuer's core.DID.
|
|
55850
|
+
* @param userId The user's core.Id.
|
|
55851
|
+
* @param credentialId The unique identifier of the credential.
|
|
55852
|
+
*/
|
|
55853
|
+
async getCredential(issuerDID, userDID, credentialId) {
|
|
55854
|
+
const { contract, connection } = this.getContractConnection(issuerDID);
|
|
55855
|
+
const response = await contract.getCredentialAdapterVersion();
|
|
55856
|
+
switch (response) {
|
|
55857
|
+
case '0.0.1': {
|
|
55858
|
+
const adapter = new OnchainNonMerklizedIssuerAdapter(connection, issuerDID, {
|
|
55859
|
+
merklizationOptions: this._onchainIssuerOptions?.merklizationOptions
|
|
55860
|
+
});
|
|
55861
|
+
await adapter.isInterfaceSupported();
|
|
55862
|
+
const { credentialData, coreClaimBigInts, credentialSubjectFields } = await adapter.getCredential(DID.idFromDID(userDID), credentialId);
|
|
55863
|
+
return await adapter.convertOnChainInfoToW3CCredential(credentialData, coreClaimBigInts, credentialSubjectFields);
|
|
55864
|
+
}
|
|
55865
|
+
default:
|
|
55866
|
+
throw new Error(`Unsupported adapter version ${response}`);
|
|
55867
|
+
}
|
|
55868
|
+
}
|
|
55869
|
+
/**
|
|
55870
|
+
* Retrieves the credential identifiers for a user from the on-chain issuer.
|
|
55871
|
+
* @param issuerDID The issuer's core.DID.
|
|
55872
|
+
* @param userId The user's core.Id.
|
|
55873
|
+
*/
|
|
55874
|
+
async getUserCredentialIds(issuerDID, userDID) {
|
|
55875
|
+
const { contract, connection } = this.getContractConnection(issuerDID);
|
|
55876
|
+
const response = await contract.getCredentialAdapterVersion();
|
|
55877
|
+
switch (response) {
|
|
55878
|
+
case '0.0.1': {
|
|
55879
|
+
const adapter = new OnchainNonMerklizedIssuerAdapter(connection, issuerDID, {
|
|
55880
|
+
merklizationOptions: this._onchainIssuerOptions?.merklizationOptions
|
|
55881
|
+
});
|
|
55882
|
+
await adapter.isInterfaceSupported();
|
|
55883
|
+
return await adapter.getUserCredentialsIds(DID.idFromDID(userDID));
|
|
55884
|
+
}
|
|
55885
|
+
default:
|
|
55886
|
+
throw new Error(`Unsupported adapter version ${response}`);
|
|
55887
|
+
}
|
|
55888
|
+
}
|
|
55889
|
+
getContractConnection(did) {
|
|
55890
|
+
const issuerId = DID.idFromDID(did);
|
|
55891
|
+
const chainId = chainIDfromDID(did);
|
|
55892
|
+
const contractAddress = getAddress(hexlify(Id$1.ethAddressFromId(issuerId)));
|
|
55893
|
+
const connection = this._ethConnectionConfig.find((c) => c.chainId === chainId);
|
|
55894
|
+
if (!connection) {
|
|
55895
|
+
throw new Error(`No connection found for chain ID ${chainId}`);
|
|
55896
|
+
}
|
|
55897
|
+
if (!connection.url) {
|
|
55898
|
+
throw new Error(`No URL found for chain ID ${chainId}`);
|
|
55899
|
+
}
|
|
55900
|
+
const contract = new Contract(contractAddress, abi, new JsonRpcProvider(connection.url));
|
|
55901
|
+
return { contract, connection };
|
|
55902
|
+
}
|
|
55903
|
+
}
|
|
55904
|
+
|
|
55905
|
+
class DidResolverStateReadonlyStorage {
|
|
55906
|
+
constructor(resolverUrl) {
|
|
55907
|
+
this.resolverUrl = resolverUrl;
|
|
55908
|
+
}
|
|
55909
|
+
async getLatestStateById(id) {
|
|
55910
|
+
return this.getStateInfo(id);
|
|
55911
|
+
}
|
|
55912
|
+
async getStateInfoByIdAndState(id, state) {
|
|
55913
|
+
return this.getStateInfo(id, state);
|
|
55914
|
+
}
|
|
55915
|
+
async getGISTProof(id) {
|
|
55916
|
+
const { didDocument } = await resolveDidDocument(DID.parseFromId(Id$1.fromBigInt(id)), this.resolverUrl);
|
|
55917
|
+
const { global } = this.getIden3StateInfo2023(didDocument);
|
|
55918
|
+
if (!global) {
|
|
55919
|
+
throw new Error('GIST root not found');
|
|
55920
|
+
}
|
|
55921
|
+
const { proof } = global;
|
|
55922
|
+
if (!proof) {
|
|
55923
|
+
throw new Error('GIST proof not found');
|
|
55924
|
+
}
|
|
55925
|
+
return {
|
|
55926
|
+
root: global.root,
|
|
55927
|
+
existence: proof.existence,
|
|
55928
|
+
siblings: proof.siblings?.map((sibling) => BigInt(sibling)),
|
|
55929
|
+
index: BigInt(0),
|
|
55930
|
+
value: BigInt(0),
|
|
55931
|
+
auxExistence: !!proof.node_aux,
|
|
55932
|
+
auxIndex: proof.node_aux ? BigInt(proof.node_aux.key) : BigInt(0),
|
|
55933
|
+
auxValue: proof.node_aux ? BigInt(proof.node_aux.value) : BigInt(0)
|
|
55934
|
+
};
|
|
55935
|
+
}
|
|
55936
|
+
async getGISTRootInfo(root, userId) {
|
|
55937
|
+
const { didDocument } = await resolveDidDocument(DID.parseFromId(Id$1.fromBigInt(userId)), this.resolverUrl, {
|
|
55938
|
+
gist: Hash$2.fromBigInt(root)
|
|
55939
|
+
});
|
|
55940
|
+
const { global } = this.getIden3StateInfo2023(didDocument);
|
|
55941
|
+
if (!global) {
|
|
55942
|
+
throw new Error('GIST root not found');
|
|
55943
|
+
}
|
|
55944
|
+
return global;
|
|
55945
|
+
}
|
|
55946
|
+
getRpcProvider() {
|
|
55947
|
+
return new JsonRpcProvider();
|
|
55948
|
+
}
|
|
55949
|
+
publishState() {
|
|
55950
|
+
throw new Error('publishState method not implemented.');
|
|
55951
|
+
}
|
|
55952
|
+
publishStateGeneric() {
|
|
55953
|
+
throw new Error('publishStateGeneric method not implemented.');
|
|
55954
|
+
}
|
|
55955
|
+
async getStateInfo(id, state) {
|
|
55956
|
+
const opts = state ? { state: Hash$2.fromBigInt(state) } : undefined;
|
|
55957
|
+
const { didDocument } = await resolveDidDocument(DID.parseFromId(Id$1.fromBigInt(id)), this.resolverUrl, opts);
|
|
55958
|
+
const { info } = this.getIden3StateInfo2023(didDocument);
|
|
55959
|
+
return { ...info };
|
|
55960
|
+
}
|
|
55961
|
+
getIden3StateInfo2023(didDocument) {
|
|
55962
|
+
const vm = didDocument.verificationMethod?.find((i) => i.type === 'Iden3StateInfo2023');
|
|
55963
|
+
if (!vm) {
|
|
55964
|
+
throw new Error('Iden3StateInfo2023 verification method not found');
|
|
55965
|
+
}
|
|
55966
|
+
return vm;
|
|
55967
|
+
}
|
|
55968
|
+
}
|
|
55969
|
+
|
|
55970
|
+
var permitAbi = [
|
|
55971
|
+
{
|
|
55972
|
+
inputs: [
|
|
55973
|
+
],
|
|
55974
|
+
name: "ECDSAInvalidSignature",
|
|
55975
|
+
type: "error"
|
|
55976
|
+
},
|
|
55977
|
+
{
|
|
55978
|
+
inputs: [
|
|
55979
|
+
{
|
|
55980
|
+
internalType: "uint256",
|
|
55981
|
+
name: "length",
|
|
55982
|
+
type: "uint256"
|
|
55983
|
+
}
|
|
55984
|
+
],
|
|
55985
|
+
name: "ECDSAInvalidSignatureLength",
|
|
55986
|
+
type: "error"
|
|
55987
|
+
},
|
|
55988
|
+
{
|
|
55989
|
+
inputs: [
|
|
55990
|
+
{
|
|
55991
|
+
internalType: "bytes32",
|
|
55992
|
+
name: "s",
|
|
55993
|
+
type: "bytes32"
|
|
55994
|
+
}
|
|
55995
|
+
],
|
|
55996
|
+
name: "ECDSAInvalidSignatureS",
|
|
55997
|
+
type: "error"
|
|
55998
|
+
},
|
|
55999
|
+
{
|
|
56000
|
+
inputs: [
|
|
56001
|
+
{
|
|
56002
|
+
internalType: "address",
|
|
56003
|
+
name: "spender",
|
|
56004
|
+
type: "address"
|
|
56005
|
+
},
|
|
56006
|
+
{
|
|
56007
|
+
internalType: "uint256",
|
|
56008
|
+
name: "allowance",
|
|
56009
|
+
type: "uint256"
|
|
56010
|
+
},
|
|
56011
|
+
{
|
|
56012
|
+
internalType: "uint256",
|
|
56013
|
+
name: "needed",
|
|
56014
|
+
type: "uint256"
|
|
56015
|
+
}
|
|
56016
|
+
],
|
|
56017
|
+
name: "ERC20InsufficientAllowance",
|
|
56018
|
+
type: "error"
|
|
56019
|
+
},
|
|
56020
|
+
{
|
|
56021
|
+
inputs: [
|
|
56022
|
+
{
|
|
56023
|
+
internalType: "address",
|
|
56024
|
+
name: "sender",
|
|
56025
|
+
type: "address"
|
|
56026
|
+
},
|
|
56027
|
+
{
|
|
56028
|
+
internalType: "uint256",
|
|
56029
|
+
name: "balance",
|
|
56030
|
+
type: "uint256"
|
|
56031
|
+
},
|
|
56032
|
+
{
|
|
56033
|
+
internalType: "uint256",
|
|
56034
|
+
name: "needed",
|
|
56035
|
+
type: "uint256"
|
|
56036
|
+
}
|
|
56037
|
+
],
|
|
56038
|
+
name: "ERC20InsufficientBalance",
|
|
56039
|
+
type: "error"
|
|
56040
|
+
},
|
|
56041
|
+
{
|
|
56042
|
+
inputs: [
|
|
56043
|
+
{
|
|
56044
|
+
internalType: "address",
|
|
56045
|
+
name: "approver",
|
|
56046
|
+
type: "address"
|
|
56047
|
+
}
|
|
56048
|
+
],
|
|
56049
|
+
name: "ERC20InvalidApprover",
|
|
56050
|
+
type: "error"
|
|
56051
|
+
},
|
|
56052
|
+
{
|
|
56053
|
+
inputs: [
|
|
56054
|
+
{
|
|
56055
|
+
internalType: "address",
|
|
56056
|
+
name: "receiver",
|
|
56057
|
+
type: "address"
|
|
56058
|
+
}
|
|
56059
|
+
],
|
|
56060
|
+
name: "ERC20InvalidReceiver",
|
|
56061
|
+
type: "error"
|
|
56062
|
+
},
|
|
56063
|
+
{
|
|
56064
|
+
inputs: [
|
|
56065
|
+
{
|
|
56066
|
+
internalType: "address",
|
|
56067
|
+
name: "sender",
|
|
56068
|
+
type: "address"
|
|
56069
|
+
}
|
|
56070
|
+
],
|
|
56071
|
+
name: "ERC20InvalidSender",
|
|
56072
|
+
type: "error"
|
|
56073
|
+
},
|
|
56074
|
+
{
|
|
56075
|
+
inputs: [
|
|
56076
|
+
{
|
|
56077
|
+
internalType: "address",
|
|
56078
|
+
name: "spender",
|
|
56079
|
+
type: "address"
|
|
56080
|
+
}
|
|
56081
|
+
],
|
|
56082
|
+
name: "ERC20InvalidSpender",
|
|
56083
|
+
type: "error"
|
|
56084
|
+
},
|
|
56085
|
+
{
|
|
56086
|
+
inputs: [
|
|
56087
|
+
{
|
|
56088
|
+
internalType: "uint256",
|
|
56089
|
+
name: "deadline",
|
|
56090
|
+
type: "uint256"
|
|
56091
|
+
}
|
|
56092
|
+
],
|
|
56093
|
+
name: "ERC2612ExpiredSignature",
|
|
56094
|
+
type: "error"
|
|
56095
|
+
},
|
|
56096
|
+
{
|
|
56097
|
+
inputs: [
|
|
56098
|
+
{
|
|
56099
|
+
internalType: "address",
|
|
56100
|
+
name: "signer",
|
|
56101
|
+
type: "address"
|
|
56102
|
+
},
|
|
56103
|
+
{
|
|
56104
|
+
internalType: "address",
|
|
56105
|
+
name: "owner",
|
|
56106
|
+
type: "address"
|
|
56107
|
+
}
|
|
56108
|
+
],
|
|
56109
|
+
name: "ERC2612InvalidSigner",
|
|
56110
|
+
type: "error"
|
|
56111
|
+
},
|
|
56112
|
+
{
|
|
56113
|
+
inputs: [
|
|
56114
|
+
{
|
|
56115
|
+
internalType: "address",
|
|
56116
|
+
name: "account",
|
|
56117
|
+
type: "address"
|
|
56118
|
+
},
|
|
56119
|
+
{
|
|
56120
|
+
internalType: "uint256",
|
|
56121
|
+
name: "currentNonce",
|
|
56122
|
+
type: "uint256"
|
|
56123
|
+
}
|
|
56124
|
+
],
|
|
56125
|
+
name: "InvalidAccountNonce",
|
|
56126
|
+
type: "error"
|
|
56127
|
+
},
|
|
56128
|
+
{
|
|
56129
|
+
inputs: [
|
|
56130
|
+
],
|
|
56131
|
+
name: "InvalidShortString",
|
|
56132
|
+
type: "error"
|
|
56133
|
+
},
|
|
56134
|
+
{
|
|
56135
|
+
inputs: [
|
|
56136
|
+
{
|
|
56137
|
+
internalType: "string",
|
|
56138
|
+
name: "str",
|
|
56139
|
+
type: "string"
|
|
56140
|
+
}
|
|
56141
|
+
],
|
|
56142
|
+
name: "StringTooLong",
|
|
56143
|
+
type: "error"
|
|
56144
|
+
},
|
|
56145
|
+
{
|
|
56146
|
+
anonymous: false,
|
|
56147
|
+
inputs: [
|
|
56148
|
+
{
|
|
56149
|
+
indexed: true,
|
|
56150
|
+
internalType: "address",
|
|
56151
|
+
name: "owner",
|
|
56152
|
+
type: "address"
|
|
56153
|
+
},
|
|
56154
|
+
{
|
|
56155
|
+
indexed: true,
|
|
56156
|
+
internalType: "address",
|
|
56157
|
+
name: "spender",
|
|
56158
|
+
type: "address"
|
|
56159
|
+
},
|
|
56160
|
+
{
|
|
56161
|
+
indexed: false,
|
|
56162
|
+
internalType: "uint256",
|
|
56163
|
+
name: "value",
|
|
56164
|
+
type: "uint256"
|
|
56165
|
+
}
|
|
56166
|
+
],
|
|
56167
|
+
name: "Approval",
|
|
56168
|
+
type: "event"
|
|
56169
|
+
},
|
|
56170
|
+
{
|
|
56171
|
+
anonymous: false,
|
|
56172
|
+
inputs: [
|
|
56173
|
+
],
|
|
56174
|
+
name: "EIP712DomainChanged",
|
|
56175
|
+
type: "event"
|
|
56176
|
+
},
|
|
56177
|
+
{
|
|
56178
|
+
anonymous: false,
|
|
56179
|
+
inputs: [
|
|
56180
|
+
{
|
|
56181
|
+
indexed: true,
|
|
56182
|
+
internalType: "address",
|
|
56183
|
+
name: "from",
|
|
56184
|
+
type: "address"
|
|
56185
|
+
},
|
|
56186
|
+
{
|
|
56187
|
+
indexed: true,
|
|
56188
|
+
internalType: "address",
|
|
56189
|
+
name: "to",
|
|
56190
|
+
type: "address"
|
|
56191
|
+
},
|
|
56192
|
+
{
|
|
56193
|
+
indexed: false,
|
|
56194
|
+
internalType: "uint256",
|
|
56195
|
+
name: "value",
|
|
56196
|
+
type: "uint256"
|
|
56197
|
+
}
|
|
56198
|
+
],
|
|
56199
|
+
name: "Transfer",
|
|
56200
|
+
type: "event"
|
|
56201
|
+
},
|
|
56202
|
+
{
|
|
56203
|
+
inputs: [
|
|
56204
|
+
],
|
|
56205
|
+
name: "DOMAIN_SEPARATOR",
|
|
56206
|
+
outputs: [
|
|
56207
|
+
{
|
|
56208
|
+
internalType: "bytes32",
|
|
56209
|
+
name: "",
|
|
56210
|
+
type: "bytes32"
|
|
56211
|
+
}
|
|
56212
|
+
],
|
|
56213
|
+
stateMutability: "view",
|
|
56214
|
+
type: "function"
|
|
56215
|
+
},
|
|
56216
|
+
{
|
|
56217
|
+
inputs: [
|
|
56218
|
+
{
|
|
56219
|
+
internalType: "address",
|
|
56220
|
+
name: "owner",
|
|
56221
|
+
type: "address"
|
|
56222
|
+
},
|
|
56223
|
+
{
|
|
56224
|
+
internalType: "address",
|
|
56225
|
+
name: "spender",
|
|
56226
|
+
type: "address"
|
|
56227
|
+
}
|
|
56228
|
+
],
|
|
56229
|
+
name: "allowance",
|
|
56230
|
+
outputs: [
|
|
56231
|
+
{
|
|
56232
|
+
internalType: "uint256",
|
|
56233
|
+
name: "",
|
|
56234
|
+
type: "uint256"
|
|
56235
|
+
}
|
|
56236
|
+
],
|
|
56237
|
+
stateMutability: "view",
|
|
56238
|
+
type: "function"
|
|
56239
|
+
},
|
|
56240
|
+
{
|
|
56241
|
+
inputs: [
|
|
56242
|
+
{
|
|
56243
|
+
internalType: "address",
|
|
56244
|
+
name: "spender",
|
|
56245
|
+
type: "address"
|
|
56246
|
+
},
|
|
56247
|
+
{
|
|
56248
|
+
internalType: "uint256",
|
|
56249
|
+
name: "value",
|
|
56250
|
+
type: "uint256"
|
|
56251
|
+
}
|
|
56252
|
+
],
|
|
56253
|
+
name: "approve",
|
|
56254
|
+
outputs: [
|
|
56255
|
+
{
|
|
56256
|
+
internalType: "bool",
|
|
56257
|
+
name: "",
|
|
56258
|
+
type: "bool"
|
|
56259
|
+
}
|
|
56260
|
+
],
|
|
56261
|
+
stateMutability: "nonpayable",
|
|
56262
|
+
type: "function"
|
|
56263
|
+
},
|
|
56264
|
+
{
|
|
56265
|
+
inputs: [
|
|
56266
|
+
{
|
|
56267
|
+
internalType: "address",
|
|
56268
|
+
name: "account",
|
|
56269
|
+
type: "address"
|
|
56270
|
+
}
|
|
56271
|
+
],
|
|
56272
|
+
name: "balanceOf",
|
|
56273
|
+
outputs: [
|
|
56274
|
+
{
|
|
56275
|
+
internalType: "uint256",
|
|
56276
|
+
name: "",
|
|
56277
|
+
type: "uint256"
|
|
56278
|
+
}
|
|
56279
|
+
],
|
|
56280
|
+
stateMutability: "view",
|
|
56281
|
+
type: "function"
|
|
56282
|
+
},
|
|
56283
|
+
{
|
|
56284
|
+
inputs: [
|
|
56285
|
+
],
|
|
56286
|
+
name: "decimals",
|
|
56287
|
+
outputs: [
|
|
56288
|
+
{
|
|
56289
|
+
internalType: "uint8",
|
|
56290
|
+
name: "",
|
|
56291
|
+
type: "uint8"
|
|
56292
|
+
}
|
|
56293
|
+
],
|
|
56294
|
+
stateMutability: "view",
|
|
56295
|
+
type: "function"
|
|
56296
|
+
},
|
|
56297
|
+
{
|
|
56298
|
+
inputs: [
|
|
56299
|
+
],
|
|
56300
|
+
name: "eip712Domain",
|
|
56301
|
+
outputs: [
|
|
56302
|
+
{
|
|
56303
|
+
internalType: "bytes1",
|
|
56304
|
+
name: "fields",
|
|
56305
|
+
type: "bytes1"
|
|
56306
|
+
},
|
|
56307
|
+
{
|
|
56308
|
+
internalType: "string",
|
|
56309
|
+
name: "name",
|
|
56310
|
+
type: "string"
|
|
56311
|
+
},
|
|
56312
|
+
{
|
|
56313
|
+
internalType: "string",
|
|
56314
|
+
name: "version",
|
|
56315
|
+
type: "string"
|
|
56316
|
+
},
|
|
56317
|
+
{
|
|
56318
|
+
internalType: "uint256",
|
|
56319
|
+
name: "chainId",
|
|
56320
|
+
type: "uint256"
|
|
56321
|
+
},
|
|
56322
|
+
{
|
|
56323
|
+
internalType: "address",
|
|
56324
|
+
name: "verifyingContract",
|
|
56325
|
+
type: "address"
|
|
56326
|
+
},
|
|
56327
|
+
{
|
|
56328
|
+
internalType: "bytes32",
|
|
56329
|
+
name: "salt",
|
|
56330
|
+
type: "bytes32"
|
|
56331
|
+
},
|
|
56332
|
+
{
|
|
56333
|
+
internalType: "uint256[]",
|
|
56334
|
+
name: "extensions",
|
|
56335
|
+
type: "uint256[]"
|
|
56336
|
+
}
|
|
56337
|
+
],
|
|
56338
|
+
stateMutability: "view",
|
|
56339
|
+
type: "function"
|
|
56340
|
+
},
|
|
56341
|
+
{
|
|
56342
|
+
inputs: [
|
|
56343
|
+
],
|
|
56344
|
+
name: "name",
|
|
56345
|
+
outputs: [
|
|
56346
|
+
{
|
|
56347
|
+
internalType: "string",
|
|
56348
|
+
name: "",
|
|
56349
|
+
type: "string"
|
|
56350
|
+
}
|
|
56351
|
+
],
|
|
56352
|
+
stateMutability: "view",
|
|
56353
|
+
type: "function"
|
|
56354
|
+
},
|
|
56355
|
+
{
|
|
56356
|
+
inputs: [
|
|
56357
|
+
{
|
|
56358
|
+
internalType: "address",
|
|
56359
|
+
name: "owner",
|
|
56360
|
+
type: "address"
|
|
56361
|
+
}
|
|
56362
|
+
],
|
|
56363
|
+
name: "nonces",
|
|
56364
|
+
outputs: [
|
|
56365
|
+
{
|
|
56366
|
+
internalType: "uint256",
|
|
56367
|
+
name: "",
|
|
56368
|
+
type: "uint256"
|
|
56369
|
+
}
|
|
56370
|
+
],
|
|
56371
|
+
stateMutability: "view",
|
|
56372
|
+
type: "function"
|
|
56373
|
+
},
|
|
56374
|
+
{
|
|
56375
|
+
inputs: [
|
|
56376
|
+
{
|
|
56377
|
+
internalType: "address",
|
|
56378
|
+
name: "owner",
|
|
56379
|
+
type: "address"
|
|
56380
|
+
},
|
|
56381
|
+
{
|
|
56382
|
+
internalType: "address",
|
|
56383
|
+
name: "spender",
|
|
56384
|
+
type: "address"
|
|
56385
|
+
},
|
|
56386
|
+
{
|
|
56387
|
+
internalType: "uint256",
|
|
56388
|
+
name: "value",
|
|
56389
|
+
type: "uint256"
|
|
56390
|
+
},
|
|
56391
|
+
{
|
|
56392
|
+
internalType: "uint256",
|
|
56393
|
+
name: "deadline",
|
|
56394
|
+
type: "uint256"
|
|
56395
|
+
},
|
|
56396
|
+
{
|
|
56397
|
+
internalType: "uint8",
|
|
56398
|
+
name: "v",
|
|
56399
|
+
type: "uint8"
|
|
56400
|
+
},
|
|
56401
|
+
{
|
|
56402
|
+
internalType: "bytes32",
|
|
56403
|
+
name: "r",
|
|
56404
|
+
type: "bytes32"
|
|
56405
|
+
},
|
|
56406
|
+
{
|
|
56407
|
+
internalType: "bytes32",
|
|
56408
|
+
name: "s",
|
|
56409
|
+
type: "bytes32"
|
|
56410
|
+
}
|
|
56411
|
+
],
|
|
56412
|
+
name: "permit",
|
|
56413
|
+
outputs: [
|
|
56414
|
+
],
|
|
56415
|
+
stateMutability: "nonpayable",
|
|
56416
|
+
type: "function"
|
|
56417
|
+
},
|
|
56418
|
+
{
|
|
56419
|
+
inputs: [
|
|
56420
|
+
],
|
|
56421
|
+
name: "symbol",
|
|
56422
|
+
outputs: [
|
|
56423
|
+
{
|
|
56424
|
+
internalType: "string",
|
|
56425
|
+
name: "",
|
|
56426
|
+
type: "string"
|
|
56427
|
+
}
|
|
56428
|
+
],
|
|
56429
|
+
stateMutability: "view",
|
|
56430
|
+
type: "function"
|
|
56431
|
+
},
|
|
56432
|
+
{
|
|
56433
|
+
inputs: [
|
|
56434
|
+
],
|
|
56435
|
+
name: "totalSupply",
|
|
56436
|
+
outputs: [
|
|
56437
|
+
{
|
|
56438
|
+
internalType: "uint256",
|
|
56439
|
+
name: "",
|
|
56440
|
+
type: "uint256"
|
|
56441
|
+
}
|
|
56442
|
+
],
|
|
56443
|
+
stateMutability: "view",
|
|
56444
|
+
type: "function"
|
|
56445
|
+
},
|
|
56446
|
+
{
|
|
56447
|
+
inputs: [
|
|
56448
|
+
{
|
|
56449
|
+
internalType: "address",
|
|
56450
|
+
name: "to",
|
|
56451
|
+
type: "address"
|
|
56452
|
+
},
|
|
56453
|
+
{
|
|
56454
|
+
internalType: "uint256",
|
|
56455
|
+
name: "value",
|
|
56456
|
+
type: "uint256"
|
|
56457
|
+
}
|
|
56458
|
+
],
|
|
56459
|
+
name: "transfer",
|
|
56460
|
+
outputs: [
|
|
56461
|
+
{
|
|
56462
|
+
internalType: "bool",
|
|
56463
|
+
name: "",
|
|
56464
|
+
type: "bool"
|
|
56465
|
+
}
|
|
56466
|
+
],
|
|
56467
|
+
stateMutability: "nonpayable",
|
|
56468
|
+
type: "function"
|
|
56469
|
+
},
|
|
56470
|
+
{
|
|
56471
|
+
inputs: [
|
|
56472
|
+
{
|
|
56473
|
+
internalType: "address",
|
|
56474
|
+
name: "from",
|
|
56475
|
+
type: "address"
|
|
56476
|
+
},
|
|
56477
|
+
{
|
|
56478
|
+
internalType: "address",
|
|
56479
|
+
name: "to",
|
|
56480
|
+
type: "address"
|
|
56481
|
+
},
|
|
56482
|
+
{
|
|
56483
|
+
internalType: "uint256",
|
|
56484
|
+
name: "value",
|
|
56485
|
+
type: "uint256"
|
|
56486
|
+
}
|
|
56487
|
+
],
|
|
56488
|
+
name: "transferFrom",
|
|
56489
|
+
outputs: [
|
|
56490
|
+
{
|
|
56491
|
+
internalType: "bool",
|
|
56492
|
+
name: "",
|
|
56493
|
+
type: "bool"
|
|
56494
|
+
}
|
|
56495
|
+
],
|
|
56496
|
+
stateMutability: "nonpayable",
|
|
56497
|
+
type: "function"
|
|
56498
|
+
}
|
|
56499
|
+
];
|
|
56500
|
+
|
|
56501
|
+
var erc20Abi = [
|
|
56502
|
+
{
|
|
56503
|
+
inputs: [
|
|
56504
|
+
{
|
|
56505
|
+
internalType: "uint256",
|
|
56506
|
+
name: "initialSupply",
|
|
56507
|
+
type: "uint256"
|
|
56508
|
+
}
|
|
56509
|
+
],
|
|
56510
|
+
stateMutability: "nonpayable",
|
|
56511
|
+
type: "constructor"
|
|
54155
56512
|
},
|
|
54156
56513
|
{
|
|
54157
56514
|
inputs: [
|
|
@@ -54239,66 +56596,6 @@ var abi = [
|
|
|
54239
56596
|
name: "ERC20InvalidSpender",
|
|
54240
56597
|
type: "error"
|
|
54241
56598
|
},
|
|
54242
|
-
{
|
|
54243
|
-
inputs: [
|
|
54244
|
-
{
|
|
54245
|
-
internalType: "uint256",
|
|
54246
|
-
name: "deadline",
|
|
54247
|
-
type: "uint256"
|
|
54248
|
-
}
|
|
54249
|
-
],
|
|
54250
|
-
name: "ERC2612ExpiredSignature",
|
|
54251
|
-
type: "error"
|
|
54252
|
-
},
|
|
54253
|
-
{
|
|
54254
|
-
inputs: [
|
|
54255
|
-
{
|
|
54256
|
-
internalType: "address",
|
|
54257
|
-
name: "signer",
|
|
54258
|
-
type: "address"
|
|
54259
|
-
},
|
|
54260
|
-
{
|
|
54261
|
-
internalType: "address",
|
|
54262
|
-
name: "owner",
|
|
54263
|
-
type: "address"
|
|
54264
|
-
}
|
|
54265
|
-
],
|
|
54266
|
-
name: "ERC2612InvalidSigner",
|
|
54267
|
-
type: "error"
|
|
54268
|
-
},
|
|
54269
|
-
{
|
|
54270
|
-
inputs: [
|
|
54271
|
-
{
|
|
54272
|
-
internalType: "address",
|
|
54273
|
-
name: "account",
|
|
54274
|
-
type: "address"
|
|
54275
|
-
},
|
|
54276
|
-
{
|
|
54277
|
-
internalType: "uint256",
|
|
54278
|
-
name: "currentNonce",
|
|
54279
|
-
type: "uint256"
|
|
54280
|
-
}
|
|
54281
|
-
],
|
|
54282
|
-
name: "InvalidAccountNonce",
|
|
54283
|
-
type: "error"
|
|
54284
|
-
},
|
|
54285
|
-
{
|
|
54286
|
-
inputs: [
|
|
54287
|
-
],
|
|
54288
|
-
name: "InvalidShortString",
|
|
54289
|
-
type: "error"
|
|
54290
|
-
},
|
|
54291
|
-
{
|
|
54292
|
-
inputs: [
|
|
54293
|
-
{
|
|
54294
|
-
internalType: "string",
|
|
54295
|
-
name: "str",
|
|
54296
|
-
type: "string"
|
|
54297
|
-
}
|
|
54298
|
-
],
|
|
54299
|
-
name: "StringTooLong",
|
|
54300
|
-
type: "error"
|
|
54301
|
-
},
|
|
54302
56599
|
{
|
|
54303
56600
|
anonymous: false,
|
|
54304
56601
|
inputs: [
|
|
@@ -54324,13 +56621,6 @@ var abi = [
|
|
|
54324
56621
|
name: "Approval",
|
|
54325
56622
|
type: "event"
|
|
54326
56623
|
},
|
|
54327
|
-
{
|
|
54328
|
-
anonymous: false,
|
|
54329
|
-
inputs: [
|
|
54330
|
-
],
|
|
54331
|
-
name: "EIP712DomainChanged",
|
|
54332
|
-
type: "event"
|
|
54333
|
-
},
|
|
54334
56624
|
{
|
|
54335
56625
|
anonymous: false,
|
|
54336
56626
|
inputs: [
|
|
@@ -54356,20 +56646,6 @@ var abi = [
|
|
|
54356
56646
|
name: "Transfer",
|
|
54357
56647
|
type: "event"
|
|
54358
56648
|
},
|
|
54359
|
-
{
|
|
54360
|
-
inputs: [
|
|
54361
|
-
],
|
|
54362
|
-
name: "DOMAIN_SEPARATOR",
|
|
54363
|
-
outputs: [
|
|
54364
|
-
{
|
|
54365
|
-
internalType: "bytes32",
|
|
54366
|
-
name: "",
|
|
54367
|
-
type: "bytes32"
|
|
54368
|
-
}
|
|
54369
|
-
],
|
|
54370
|
-
stateMutability: "view",
|
|
54371
|
-
type: "function"
|
|
54372
|
-
},
|
|
54373
56649
|
{
|
|
54374
56650
|
inputs: [
|
|
54375
56651
|
{
|
|
@@ -54451,50 +56727,6 @@ var abi = [
|
|
|
54451
56727
|
stateMutability: "view",
|
|
54452
56728
|
type: "function"
|
|
54453
56729
|
},
|
|
54454
|
-
{
|
|
54455
|
-
inputs: [
|
|
54456
|
-
],
|
|
54457
|
-
name: "eip712Domain",
|
|
54458
|
-
outputs: [
|
|
54459
|
-
{
|
|
54460
|
-
internalType: "bytes1",
|
|
54461
|
-
name: "fields",
|
|
54462
|
-
type: "bytes1"
|
|
54463
|
-
},
|
|
54464
|
-
{
|
|
54465
|
-
internalType: "string",
|
|
54466
|
-
name: "name",
|
|
54467
|
-
type: "string"
|
|
54468
|
-
},
|
|
54469
|
-
{
|
|
54470
|
-
internalType: "string",
|
|
54471
|
-
name: "version",
|
|
54472
|
-
type: "string"
|
|
54473
|
-
},
|
|
54474
|
-
{
|
|
54475
|
-
internalType: "uint256",
|
|
54476
|
-
name: "chainId",
|
|
54477
|
-
type: "uint256"
|
|
54478
|
-
},
|
|
54479
|
-
{
|
|
54480
|
-
internalType: "address",
|
|
54481
|
-
name: "verifyingContract",
|
|
54482
|
-
type: "address"
|
|
54483
|
-
},
|
|
54484
|
-
{
|
|
54485
|
-
internalType: "bytes32",
|
|
54486
|
-
name: "salt",
|
|
54487
|
-
type: "bytes32"
|
|
54488
|
-
},
|
|
54489
|
-
{
|
|
54490
|
-
internalType: "uint256[]",
|
|
54491
|
-
name: "extensions",
|
|
54492
|
-
type: "uint256[]"
|
|
54493
|
-
}
|
|
54494
|
-
],
|
|
54495
|
-
stateMutability: "view",
|
|
54496
|
-
type: "function"
|
|
54497
|
-
},
|
|
54498
56730
|
{
|
|
54499
56731
|
inputs: [
|
|
54500
56732
|
],
|
|
@@ -54509,69 +56741,6 @@ var abi = [
|
|
|
54509
56741
|
stateMutability: "view",
|
|
54510
56742
|
type: "function"
|
|
54511
56743
|
},
|
|
54512
|
-
{
|
|
54513
|
-
inputs: [
|
|
54514
|
-
{
|
|
54515
|
-
internalType: "address",
|
|
54516
|
-
name: "owner",
|
|
54517
|
-
type: "address"
|
|
54518
|
-
}
|
|
54519
|
-
],
|
|
54520
|
-
name: "nonces",
|
|
54521
|
-
outputs: [
|
|
54522
|
-
{
|
|
54523
|
-
internalType: "uint256",
|
|
54524
|
-
name: "",
|
|
54525
|
-
type: "uint256"
|
|
54526
|
-
}
|
|
54527
|
-
],
|
|
54528
|
-
stateMutability: "view",
|
|
54529
|
-
type: "function"
|
|
54530
|
-
},
|
|
54531
|
-
{
|
|
54532
|
-
inputs: [
|
|
54533
|
-
{
|
|
54534
|
-
internalType: "address",
|
|
54535
|
-
name: "owner",
|
|
54536
|
-
type: "address"
|
|
54537
|
-
},
|
|
54538
|
-
{
|
|
54539
|
-
internalType: "address",
|
|
54540
|
-
name: "spender",
|
|
54541
|
-
type: "address"
|
|
54542
|
-
},
|
|
54543
|
-
{
|
|
54544
|
-
internalType: "uint256",
|
|
54545
|
-
name: "value",
|
|
54546
|
-
type: "uint256"
|
|
54547
|
-
},
|
|
54548
|
-
{
|
|
54549
|
-
internalType: "uint256",
|
|
54550
|
-
name: "deadline",
|
|
54551
|
-
type: "uint256"
|
|
54552
|
-
},
|
|
54553
|
-
{
|
|
54554
|
-
internalType: "uint8",
|
|
54555
|
-
name: "v",
|
|
54556
|
-
type: "uint8"
|
|
54557
|
-
},
|
|
54558
|
-
{
|
|
54559
|
-
internalType: "bytes32",
|
|
54560
|
-
name: "r",
|
|
54561
|
-
type: "bytes32"
|
|
54562
|
-
},
|
|
54563
|
-
{
|
|
54564
|
-
internalType: "bytes32",
|
|
54565
|
-
name: "s",
|
|
54566
|
-
type: "bytes32"
|
|
54567
|
-
}
|
|
54568
|
-
],
|
|
54569
|
-
name: "permit",
|
|
54570
|
-
outputs: [
|
|
54571
|
-
],
|
|
54572
|
-
stateMutability: "nonpayable",
|
|
54573
|
-
type: "function"
|
|
54574
|
-
},
|
|
54575
56744
|
{
|
|
54576
56745
|
inputs: [
|
|
54577
56746
|
],
|
|
@@ -54666,10 +56835,11 @@ var abi = [
|
|
|
54666
56835
|
* @returns {Promise<PaymentRequestMessage>}
|
|
54667
56836
|
*/
|
|
54668
56837
|
async function getPermitSignature(signer, tokenAddress, spender, value, deadline) {
|
|
54669
|
-
const erc20PermitContract = new Contract(tokenAddress,
|
|
56838
|
+
const erc20PermitContract = new Contract(tokenAddress, permitAbi, signer);
|
|
54670
56839
|
const nonce = await erc20PermitContract.nonces(await signer.getAddress());
|
|
54671
56840
|
const domainData = await erc20PermitContract.eip712Domain();
|
|
54672
56841
|
const domain = {
|
|
56842
|
+
name: domainData[1],
|
|
54673
56843
|
version: domainData[2],
|
|
54674
56844
|
chainId: domainData[3],
|
|
54675
56845
|
verifyingContract: tokenAddress
|
|
@@ -54692,6 +56862,16 @@ async function getPermitSignature(signer, tokenAddress, spender, value, deadline
|
|
|
54692
56862
|
};
|
|
54693
56863
|
return signer.signTypedData(domain, types, message);
|
|
54694
56864
|
}
|
|
56865
|
+
/**
|
|
56866
|
+
* @beta
|
|
56867
|
+
* getERC20Decimals is a function to retrieve the number of decimals of an ERC20 token
|
|
56868
|
+
* @param {string} tokenAddress - Token address
|
|
56869
|
+
* @param {ethers.ContractRunner} runner - Contract runner
|
|
56870
|
+
*/
|
|
56871
|
+
async function getERC20Decimals(tokenAddress, runner) {
|
|
56872
|
+
const erc20Contract = new Contract(tokenAddress, erc20Abi, runner);
|
|
56873
|
+
return erc20Contract.decimals();
|
|
56874
|
+
}
|
|
54695
56875
|
|
|
54696
56876
|
/**
|
|
54697
56877
|
* Type of MerkleTree
|
|
@@ -56370,6 +58550,24 @@ class Iden3SmtRhsCredentialStatusPublisher {
|
|
|
56370
58550
|
}
|
|
56371
58551
|
}
|
|
56372
58552
|
|
|
58553
|
+
class DidDocumentCredentialStatusResolver {
|
|
58554
|
+
constructor(didResolverUrl) {
|
|
58555
|
+
this.didResolverUrl = didResolverUrl;
|
|
58556
|
+
}
|
|
58557
|
+
async resolve(credentialStatus, opts) {
|
|
58558
|
+
if (!opts?.issuerDID) {
|
|
58559
|
+
throw new Error('IssuerDID is not set in options');
|
|
58560
|
+
}
|
|
58561
|
+
const url = `${this.didResolverUrl}/1.0/credential-status/${encodeURIComponent(opts.issuerDID.string())}`;
|
|
58562
|
+
const resp = await fetch(url, {
|
|
58563
|
+
method: 'POST',
|
|
58564
|
+
body: JSON.stringify(credentialStatus)
|
|
58565
|
+
});
|
|
58566
|
+
const data = await resp.json();
|
|
58567
|
+
return data;
|
|
58568
|
+
}
|
|
58569
|
+
}
|
|
58570
|
+
|
|
56373
58571
|
/**
|
|
56374
58572
|
*
|
|
56375
58573
|
* Wallet instance is a wrapper of CRUD logic for W3C credentials,
|
|
@@ -56396,40 +58594,18 @@ class CredentialWallet {
|
|
|
56396
58594
|
if (!schema.$metadata.uris['jsonLdContext']) {
|
|
56397
58595
|
throw new Error('jsonLdContext is missing is the schema');
|
|
56398
58596
|
}
|
|
56399
|
-
|
|
56400
|
-
|
|
56401
|
-
|
|
56402
|
-
|
|
56403
|
-
|
|
56404
|
-
|
|
56405
|
-
|
|
56406
|
-
|
|
56407
|
-
|
|
56408
|
-
|
|
56409
|
-
|
|
56410
|
-
|
|
56411
|
-
VerifiableConstants.CREDENTIAL_TYPE.W3C_VERIFIABLE_CREDENTIAL,
|
|
56412
|
-
request.type
|
|
56413
|
-
];
|
|
56414
|
-
const expirationDate = !request.expiration || request.expiration == 0 ? null : request.expiration;
|
|
56415
|
-
const credentialSubject = request.credentialSubject;
|
|
56416
|
-
credentialSubject['type'] = request.type;
|
|
56417
|
-
const cr = new W3CCredential();
|
|
56418
|
-
cr.id = `urn:${v4()}`;
|
|
56419
|
-
cr['@context'] = context;
|
|
56420
|
-
cr.type = credentialType;
|
|
56421
|
-
cr.expirationDate = expirationDate ? new Date(expirationDate * 1000).toISOString() : undefined;
|
|
56422
|
-
cr.refreshService = request.refreshService;
|
|
56423
|
-
cr.displayMethod = request.displayMethod;
|
|
56424
|
-
cr.issuanceDate = new Date().toISOString();
|
|
56425
|
-
cr.credentialSubject = credentialSubject;
|
|
56426
|
-
cr.issuer = issuer.string();
|
|
56427
|
-
cr.credentialSchema = {
|
|
56428
|
-
id: request.credentialSchema,
|
|
56429
|
-
type: VerifiableConstants.JSON_SCHEMA_VALIDATOR
|
|
56430
|
-
};
|
|
56431
|
-
cr.credentialStatus = this.buildCredentialStatus(request, issuer);
|
|
56432
|
-
return cr;
|
|
58597
|
+
// do copy of request to avoid mutation
|
|
58598
|
+
const r = { ...request };
|
|
58599
|
+
r.context = r.context ?? [];
|
|
58600
|
+
if (r.displayMethod?.type === DisplayMethodType.Iden3BasicDisplayMethodV1 &&
|
|
58601
|
+
!r.context.includes(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD)) {
|
|
58602
|
+
r.context.push(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD);
|
|
58603
|
+
}
|
|
58604
|
+
r.context.push(schema.$metadata.uris['jsonLdContext']);
|
|
58605
|
+
r.expiration = r.expiration ? r.expiration * 1000 : undefined;
|
|
58606
|
+
r.id = r.id ? r.id : `urn:${v4()}`;
|
|
58607
|
+
r.issuanceDate = r.issuanceDate ? r.issuanceDate * 1000 : Date.now();
|
|
58608
|
+
return W3CCredential.fromCredentialRequest(issuer, r);
|
|
56433
58609
|
};
|
|
56434
58610
|
// if no credential status resolvers are provided
|
|
56435
58611
|
// register default issuer resolver
|
|
@@ -56499,51 +58675,6 @@ class CredentialWallet {
|
|
|
56499
58675
|
}
|
|
56500
58676
|
return statusResolver.resolve(credStatus, credentialStatusResolveOptions);
|
|
56501
58677
|
}
|
|
56502
|
-
/**
|
|
56503
|
-
* Builds credential status
|
|
56504
|
-
* @param {CredentialRequest} request
|
|
56505
|
-
* @returns `CredentialStatus`
|
|
56506
|
-
*/
|
|
56507
|
-
buildCredentialStatus(request, issuer) {
|
|
56508
|
-
const credentialStatus = {
|
|
56509
|
-
id: request.revocationOpts.id,
|
|
56510
|
-
type: request.revocationOpts.type,
|
|
56511
|
-
revocationNonce: request.revocationOpts.nonce
|
|
56512
|
-
};
|
|
56513
|
-
switch (request.revocationOpts.type) {
|
|
56514
|
-
case CredentialStatusType.SparseMerkleTreeProof:
|
|
56515
|
-
return {
|
|
56516
|
-
...credentialStatus,
|
|
56517
|
-
id: `${credentialStatus.id.replace(/\/$/, '')}/${credentialStatus.revocationNonce}`
|
|
56518
|
-
};
|
|
56519
|
-
case CredentialStatusType.Iden3ReverseSparseMerkleTreeProof:
|
|
56520
|
-
return {
|
|
56521
|
-
...credentialStatus,
|
|
56522
|
-
id: request.revocationOpts.issuerState
|
|
56523
|
-
? `${credentialStatus.id.replace(/\/$/, '')}/node?state=${request.revocationOpts.issuerState}`
|
|
56524
|
-
: `${credentialStatus.id.replace(/\/$/, '')}`
|
|
56525
|
-
};
|
|
56526
|
-
case CredentialStatusType.Iden3OnchainSparseMerkleTreeProof2023: {
|
|
56527
|
-
const issuerId = DID.idFromDID(issuer);
|
|
56528
|
-
const chainId = getChainId(DID.blockchainFromId(issuerId), DID.networkIdFromId(issuerId));
|
|
56529
|
-
const searchParams = [
|
|
56530
|
-
['revocationNonce', request.revocationOpts.nonce?.toString() || ''],
|
|
56531
|
-
['contractAddress', `${chainId}:${request.revocationOpts.id}`],
|
|
56532
|
-
['state', request.revocationOpts.issuerState || '']
|
|
56533
|
-
]
|
|
56534
|
-
.filter(([, value]) => Boolean(value))
|
|
56535
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
56536
|
-
.join('&');
|
|
56537
|
-
return {
|
|
56538
|
-
...credentialStatus,
|
|
56539
|
-
// `[did]:[methodid]:[chain]:[network]:[id]/credentialStatus?(revocationNonce=value)&[contractAddress=[chainID]:[contractAddress]]&(state=issuerState)`
|
|
56540
|
-
id: `${issuer.string()}/credentialStatus?${searchParams}`
|
|
56541
|
-
};
|
|
56542
|
-
}
|
|
56543
|
-
default:
|
|
56544
|
-
return credentialStatus;
|
|
56545
|
-
}
|
|
56546
|
-
}
|
|
56547
58678
|
/**
|
|
56548
58679
|
* {@inheritDoc ICredentialWallet.findById}
|
|
56549
58680
|
*/
|
|
@@ -58520,10 +60651,34 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
58520
60651
|
return this.handleFetchRequest(message);
|
|
58521
60652
|
case PROTOCOL_MESSAGE_TYPE.CREDENTIAL_ISSUANCE_RESPONSE_MESSAGE_TYPE:
|
|
58522
60653
|
return this.handleIssuanceResponseMsg(message);
|
|
60654
|
+
case PROTOCOL_MESSAGE_TYPE.CREDENTIAL_ONCHAIN_OFFER_MESSAGE_TYPE: {
|
|
60655
|
+
const result = await this.handleOnchainOfferMessage(message);
|
|
60656
|
+
if (Array.isArray(result)) {
|
|
60657
|
+
const credWallet = this.opts?.credentialWallet;
|
|
60658
|
+
if (!credWallet)
|
|
60659
|
+
throw new Error('Credential wallet is not provided');
|
|
60660
|
+
await credWallet.saveAll(result);
|
|
60661
|
+
return null;
|
|
60662
|
+
}
|
|
60663
|
+
return result;
|
|
60664
|
+
}
|
|
58523
60665
|
default:
|
|
58524
60666
|
return super.handle(message, ctx);
|
|
58525
60667
|
}
|
|
58526
60668
|
}
|
|
60669
|
+
async handleOnchainOfferMessage(offerMessage) {
|
|
60670
|
+
if (!this.opts?.onchainIssuer) {
|
|
60671
|
+
throw new Error('onchain issuer is not provided');
|
|
60672
|
+
}
|
|
60673
|
+
const credentials = [];
|
|
60674
|
+
for (const credentialInfo of offerMessage.body.credentials) {
|
|
60675
|
+
const issuerDID = DID.parse(offerMessage.from);
|
|
60676
|
+
const userDID = DID.parse(offerMessage.to);
|
|
60677
|
+
const credential = await this.opts.onchainIssuer.getCredential(issuerDID, userDID, BigInt(credentialInfo.id));
|
|
60678
|
+
credentials.push(credential);
|
|
60679
|
+
}
|
|
60680
|
+
return credentials;
|
|
60681
|
+
}
|
|
58527
60682
|
async handleOfferMessage(offerMessage, ctx) {
|
|
58528
60683
|
if (!ctx.mediaType) {
|
|
58529
60684
|
ctx.mediaType = MediaType.ZKPMessage;
|
|
@@ -58608,6 +60763,14 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
58608
60763
|
}
|
|
58609
60764
|
throw new Error('invalid protocol message response');
|
|
58610
60765
|
}
|
|
60766
|
+
/**
|
|
60767
|
+
* Handles only messages with credentials/1.0/onchain-offer type
|
|
60768
|
+
* @beta
|
|
60769
|
+
*/
|
|
60770
|
+
async handleOnchainOffer(offer) {
|
|
60771
|
+
const offerMessage = await FetchHandler.unpackMessage(this._packerMgr, offer, PROTOCOL_MESSAGE_TYPE.CREDENTIAL_ONCHAIN_OFFER_MESSAGE_TYPE);
|
|
60772
|
+
return this.handleOnchainOfferMessage(offerMessage);
|
|
60773
|
+
}
|
|
58611
60774
|
async handleFetchRequest(msgRequest) {
|
|
58612
60775
|
if (!msgRequest.to) {
|
|
58613
60776
|
throw new Error("failed request. empty 'to' field");
|
|
@@ -58710,6 +60873,7 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
58710
60873
|
this._proofService = _proofService;
|
|
58711
60874
|
this._zkpVerifier = _zkpVerifier;
|
|
58712
60875
|
this._supportedCircuits = [
|
|
60876
|
+
CircuitId.AuthV2,
|
|
58713
60877
|
CircuitId.AtomicQueryMTPV2OnChain,
|
|
58714
60878
|
CircuitId.AtomicQuerySigV2OnChain,
|
|
58715
60879
|
CircuitId.AtomicQueryV3OnChain
|
|
@@ -58740,7 +60904,12 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
58740
60904
|
throw new Error(`Invalid chain id ${chain_id}`);
|
|
58741
60905
|
}
|
|
58742
60906
|
const verifierDid = message.from ? DID.parse(message.from) : undefined;
|
|
58743
|
-
const
|
|
60907
|
+
const { scope = [] } = message.body;
|
|
60908
|
+
const zkpResponses = await processZeroKnowledgeProofRequests(did, scope, verifierDid, this._proofService, {
|
|
60909
|
+
ethSigner,
|
|
60910
|
+
challenge,
|
|
60911
|
+
supportedCircuits: this._supportedCircuits
|
|
60912
|
+
});
|
|
58744
60913
|
const methodId = message.body.transaction_data.method_id.replace('0x', '');
|
|
58745
60914
|
switch (methodId) {
|
|
58746
60915
|
case FunctionSignatures.SubmitZKPResponseV2:
|
|
@@ -59265,7 +61434,7 @@ async function verifyEIP712TypedData(data, resolver) {
|
|
|
59265
61434
|
? {
|
|
59266
61435
|
recipient: data.recipient,
|
|
59267
61436
|
amount: data.amount,
|
|
59268
|
-
expirationDate: new Date(data.expirationDate)
|
|
61437
|
+
expirationDate: getUnixTimestamp(new Date(data.expirationDate)),
|
|
59269
61438
|
nonce: data.nonce,
|
|
59270
61439
|
metadata: '0x'
|
|
59271
61440
|
}
|
|
@@ -59273,7 +61442,7 @@ async function verifyEIP712TypedData(data, resolver) {
|
|
|
59273
61442
|
tokenAddress: data.tokenAddress,
|
|
59274
61443
|
recipient: data.recipient,
|
|
59275
61444
|
amount: data.amount,
|
|
59276
|
-
expirationDate: new Date(data.expirationDate)
|
|
61445
|
+
expirationDate: getUnixTimestamp(new Date(data.expirationDate)),
|
|
59277
61446
|
nonce: data.nonce,
|
|
59278
61447
|
metadata: '0x'
|
|
59279
61448
|
};
|
|
@@ -59482,37 +61651,39 @@ class PaymentHandler extends AbstractMessageHandler {
|
|
|
59482
61651
|
for (let i = 0; i < payments.length; i++) {
|
|
59483
61652
|
const { credentials, description } = payments[i];
|
|
59484
61653
|
const dataArr = [];
|
|
59485
|
-
for (let j = 0; j < payments[i].
|
|
59486
|
-
const {
|
|
61654
|
+
for (let j = 0; j < payments[i].options.length; j++) {
|
|
61655
|
+
const { nonce, amount, chainId, optionId, expirationDate } = payments[i].options[j];
|
|
59487
61656
|
const multiChainConfig = this._params.multiChainPaymentConfig?.find((c) => c.chainId === chainId);
|
|
59488
61657
|
if (!multiChainConfig) {
|
|
59489
61658
|
throw new Error(`failed request. no config for chain ${chainId}`);
|
|
59490
61659
|
}
|
|
59491
|
-
const { recipient,
|
|
59492
|
-
const
|
|
59493
|
-
if (
|
|
59494
|
-
throw new Error(`failed request. no
|
|
61660
|
+
const { recipient, paymentRails, options } = multiChainConfig;
|
|
61661
|
+
const option = options.find((t) => t.id === optionId);
|
|
61662
|
+
if (!option) {
|
|
61663
|
+
throw new Error(`failed request. no option for id ${optionId}`);
|
|
59495
61664
|
}
|
|
59496
|
-
|
|
59497
|
-
|
|
59498
|
-
|
|
59499
|
-
|
|
61665
|
+
if (option.type === PaymentRequestDataType.Iden3PaymentRailsERC20RequestV1 &&
|
|
61666
|
+
!option.contractAddress) {
|
|
61667
|
+
throw new Error(`failed request. no token address for option id ${optionId}`);
|
|
61668
|
+
}
|
|
61669
|
+
const expirationDateRequired = expirationDate ?? new Date(new Date().setHours(new Date().getHours() + 1));
|
|
61670
|
+
const typeUrl = `https://schema.iden3.io/core/json/${option.type}.json`;
|
|
59500
61671
|
const typesFetchResult = await fetch(typeUrl);
|
|
59501
61672
|
const types = await typesFetchResult.json();
|
|
59502
61673
|
delete types.EIP712Domain;
|
|
59503
|
-
const paymentData = type === PaymentRequestDataType.Iden3PaymentRailsRequestV1
|
|
61674
|
+
const paymentData = option.type === PaymentRequestDataType.Iden3PaymentRailsRequestV1
|
|
59504
61675
|
? {
|
|
59505
61676
|
recipient,
|
|
59506
|
-
amount,
|
|
59507
|
-
expirationDate:
|
|
61677
|
+
amount: amount,
|
|
61678
|
+
expirationDate: getUnixTimestamp(expirationDateRequired),
|
|
59508
61679
|
nonce,
|
|
59509
61680
|
metadata: '0x'
|
|
59510
61681
|
}
|
|
59511
61682
|
: {
|
|
59512
|
-
tokenAddress,
|
|
61683
|
+
tokenAddress: option.contractAddress,
|
|
59513
61684
|
recipient,
|
|
59514
|
-
amount,
|
|
59515
|
-
expirationDate:
|
|
61685
|
+
amount: amount,
|
|
61686
|
+
expirationDate: getUnixTimestamp(expirationDateRequired),
|
|
59516
61687
|
nonce,
|
|
59517
61688
|
metadata: '0x'
|
|
59518
61689
|
};
|
|
@@ -59520,7 +61691,7 @@ class PaymentHandler extends AbstractMessageHandler {
|
|
|
59520
61691
|
name: 'MCPayment',
|
|
59521
61692
|
version: '1.0.0',
|
|
59522
61693
|
chainId,
|
|
59523
|
-
verifyingContract:
|
|
61694
|
+
verifyingContract: paymentRails
|
|
59524
61695
|
};
|
|
59525
61696
|
const signature = await signer.signTypedData(domain, types, paymentData);
|
|
59526
61697
|
const proof = [
|
|
@@ -59540,20 +61711,24 @@ class PaymentHandler extends AbstractMessageHandler {
|
|
|
59540
61711
|
const d = {
|
|
59541
61712
|
type: PaymentRequestDataType.Iden3PaymentRailsRequestV1,
|
|
59542
61713
|
'@context': [
|
|
59543
|
-
`https://schema.iden3.io/core/jsonld/payment.jsonld#${type}`,
|
|
61714
|
+
`https://schema.iden3.io/core/jsonld/payment.jsonld#${option.type}`,
|
|
59544
61715
|
'https://w3id.org/security/suites/eip712sig-2021/v1'
|
|
59545
61716
|
],
|
|
59546
61717
|
recipient,
|
|
59547
61718
|
amount: amount.toString(),
|
|
59548
|
-
|
|
59549
|
-
expirationDate: new Date(expirationTime).toISOString(),
|
|
61719
|
+
expirationDate: expirationDateRequired.toISOString(),
|
|
59550
61720
|
nonce: nonce.toString(),
|
|
59551
61721
|
metadata: '0x',
|
|
59552
61722
|
proof
|
|
59553
61723
|
};
|
|
59554
|
-
dataArr.push(type === PaymentRequestDataType.Iden3PaymentRailsRequestV1
|
|
61724
|
+
dataArr.push(option.type === PaymentRequestDataType.Iden3PaymentRailsRequestV1
|
|
59555
61725
|
? d
|
|
59556
|
-
: {
|
|
61726
|
+
: {
|
|
61727
|
+
...d,
|
|
61728
|
+
type: option.type,
|
|
61729
|
+
tokenAddress: option.contractAddress || '',
|
|
61730
|
+
features: option.features || []
|
|
61731
|
+
});
|
|
59557
61732
|
}
|
|
59558
61733
|
paymentRequestInfo.push({
|
|
59559
61734
|
data: dataArr,
|
|
@@ -60908,6 +63083,12 @@ class ProofService {
|
|
|
60908
63083
|
authInputs.gistProof = gistProof;
|
|
60909
63084
|
return authInputs.inputsMarshal();
|
|
60910
63085
|
}
|
|
63086
|
+
/** {@inheritdoc IProofService.generateAuthV2Proof} */
|
|
63087
|
+
async generateAuthV2Proof(challenge, did) {
|
|
63088
|
+
const authInputs = await this.generateAuthV2Inputs(challenge, did, CircuitId.AuthV2);
|
|
63089
|
+
const zkProof = await this._prover.generate(authInputs, CircuitId.AuthV2);
|
|
63090
|
+
return zkProof;
|
|
63091
|
+
}
|
|
60911
63092
|
async verifyState(circuitId, pubSignals, opts = {
|
|
60912
63093
|
acceptedStateTransitionDelay: DEFAULT_AUTH_VERIFY_DELAY
|
|
60913
63094
|
}) {
|
|
@@ -61672,5 +63853,5 @@ class IdentityWallet {
|
|
|
61672
63853
|
}
|
|
61673
63854
|
}
|
|
61674
63855
|
|
|
61675
|
-
export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialOfferStatus, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DIDDocumentSignature, DataPrepareHandlerFunc, DisplayMethodType, Ed25519Provider, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, FunctionSignatures, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, MessageHandler, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PaymentFeatures, PaymentHandler, PaymentRequestDataType, PaymentType, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, SupportedCurrencies, SupportedPaymentProofType, TransactionService, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes$1 as base58ToBytes, base64ToBytes$1 as base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildAccept, buildDIDFromEthPubKey, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58$1 as bytesToBase58, bytesToBase64, bytesToBase64url$1 as bytesToBase64url, bytesToHex$3 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkCircuitOperator, checkCircuitQueriesLength, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createPayment, createPaymentRequest, createProposal, createProposalRequest, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url$1 as decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getOperatorNameByValue, getPermitSignature, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$3 as hexToBytes, isEthereumIdentity, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseAcceptProfile, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolveDidDocument, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateDisclosureNativeSDSupport, validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit, validateOperators, validateTreeState, verifyEIP712TypedData, verifyExpiresTime, verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2, witnessBuilder };
|
|
63856
|
+
export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialOfferStatus, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DIDDocumentSignature, DataPrepareHandlerFunc, DidDocumentCredentialStatusResolver, DidResolverStateReadonlyStorage, DisplayMethodType, Ed25519Provider, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, FunctionSignatures, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, MessageHandler, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, OnchainIssuer, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PaymentFeatures, PaymentHandler, PaymentRequestDataType, PaymentType, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, SupportedCurrencies, SupportedPaymentProofType, TransactionService, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes$1 as base58ToBytes, base64ToBytes$1 as base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildAccept, buildDIDFromEthPubKey, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58$1 as bytesToBase58, bytesToBase64, bytesToBase64url$1 as bytesToBase64url, bytesToHex$3 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkCircuitOperator, checkCircuitQueriesLength, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createPayment, createPaymentRequest, createProposal, createProposalRequest, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url$1 as decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getERC20Decimals, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getOperatorNameByValue, getPermitSignature, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$3 as hexToBytes, isEthereumIdentity, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseAcceptProfile, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolveDidDocument, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateDisclosureNativeSDSupport, validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit, validateOperators, validateTreeState, verifyEIP712TypedData, verifyExpiresTime, verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2, witnessBuilder };
|
|
61676
63857
|
//# sourceMappingURL=index.js.map
|