@0xpolygonid/js-sdk 1.28.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser/esm/index.js +1288 -405
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +24155 -23269
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/constants.js +3 -1
- package/dist/node/cjs/iden3comm/handlers/common.js +63 -1
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +64 -7
- package/dist/node/cjs/iden3comm/handlers/index.js +1 -0
- package/dist/node/cjs/iden3comm/handlers/problem-report.js +55 -0
- package/dist/node/cjs/iden3comm/types/index.js +1 -0
- package/dist/node/cjs/iden3comm/types/protocol/contract-request.js +6 -0
- package/dist/node/cjs/iden3comm/types/protocol/problem-report.js +2 -0
- package/dist/node/cjs/iden3comm/utils/contract-request.utils.js +16 -1
- package/dist/node/cjs/proof/proof-service.js +26 -0
- package/dist/node/cjs/schema-processor/jsonld/cache.js +15 -0
- package/dist/node/cjs/storage/blockchain/onchain-zkp-verifier.js +107 -16
- package/dist/node/cjs/storage/blockchain/state.js +5 -6
- package/dist/node/cjs/verifiable/constants.js +5 -2
- package/dist/node/esm/iden3comm/constants.js +3 -1
- package/dist/node/esm/iden3comm/handlers/common.js +62 -2
- package/dist/node/esm/iden3comm/handlers/contract-request.js +66 -9
- package/dist/node/esm/iden3comm/handlers/index.js +1 -0
- package/dist/node/esm/iden3comm/handlers/problem-report.js +28 -0
- package/dist/node/esm/iden3comm/types/index.js +1 -0
- package/dist/node/esm/iden3comm/types/protocol/contract-request.js +5 -1
- package/dist/node/esm/iden3comm/types/protocol/problem-report.js +1 -0
- package/dist/node/esm/iden3comm/utils/contract-request.utils.js +14 -1
- package/dist/node/esm/proof/proof-service.js +26 -0
- package/dist/node/esm/schema-processor/jsonld/cache.js +15 -0
- package/dist/node/esm/storage/blockchain/onchain-zkp-verifier.js +107 -16
- package/dist/node/esm/storage/blockchain/state.js +5 -6
- package/dist/node/esm/verifiable/constants.js +5 -2
- package/dist/types/iden3comm/constants.d.ts +1 -0
- package/dist/types/iden3comm/handlers/common.d.ts +16 -1
- package/dist/types/iden3comm/handlers/contract-request.d.ts +3 -1
- package/dist/types/iden3comm/handlers/index.d.ts +1 -0
- package/dist/types/iden3comm/handlers/problem-report.d.ts +17 -0
- package/dist/types/iden3comm/types/index.d.ts +1 -0
- package/dist/types/iden3comm/types/protocol/auth.d.ts +8 -0
- package/dist/types/iden3comm/types/protocol/contract-request.d.ts +12 -0
- package/dist/types/iden3comm/types/protocol/problem-report.d.ts +16 -0
- package/dist/types/iden3comm/utils/contract-request.utils.d.ts +7 -0
- package/dist/types/proof/proof-service.d.ts +14 -2
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts +10 -3
- package/dist/types/storage/interfaces/onchain-zkp-verifier.d.ts +18 -1
- package/dist/types/verifiable/constants.d.ts +3 -0
- package/package.json +3 -2
|
@@ -7698,7 +7698,9 @@ const VerifiableConstants = Object.freeze({
|
|
|
7698
7698
|
IDEN3_DISPLAY_METHOD: 'https://schema.iden3.io/core/jsonld/displayMethod.jsonld',
|
|
7699
7699
|
// JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type
|
|
7700
7700
|
W3C_CREDENTIAL_2018: 'https://www.w3.org/2018/credentials/v1',
|
|
7701
|
-
W3C_VC_DOCUMENT_2018: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}
|
|
7701
|
+
W3C_VC_DOCUMENT_2018: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}`,
|
|
7702
|
+
IDEN3_PROOFS_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"@propagate":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","@vocab":"https://schema.iden3.io/core/vocab/Iden3SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"state":{"@id":"state","@context":{"txId":{"@id":"txId","@type":"xsd:string"},"blockTimestamp":{"@id":"blockTimestamp","@type":"xsd:integer"},"blockNumber":{"@id":"blockNumber","@type":"xsd:integer"},"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}}}},"SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","smt-proof-vocab":"https://schema.iden3.io/core/vocab/SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","existence":{"@id":"smt-proof-vocab:existence","@type":"xsd:boolean"},"revocationNonce":{"@id":"smt-proof-vocab:revocationNonce","@type":"xsd:number"},"siblings":{"@id":"smt-proof-vocab:siblings","@container":"@list"},"nodeAux":"@nest","hIndex":{"@id":"smt-proof-vocab:hIndex","@nest":"nodeAux","@type":"xsd:string"},"hValue":{"@id":"smt-proof-vocab:hValue","@nest":"nodeAux","@type":"xsd:string"}}},"BJJSignature2021":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#BJJSignature2021","@context":{"@version":1.1,"@protected":true,"id":"@id","@vocab":"https://schema.iden3.io/core/vocab/BJJSignature2021.md#","@propagate":true,"type":"@type","xsd":"http://www.w3.org/2001/XMLSchema#","coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"revocationStatus":{"@id":"revocationStatus","@type":"@id"},"state":{"@id":"state","@context":{"@version":1.1,"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}},"signature":{"@id":"signature","@type":"https://w3id.org/security#multibase"},"domain":"https://w3id.org/security#domain","creator":{"@id":"creator","@type":"http://www.w3.org/2001/XMLSchema#string"},"challenge":"https://w3id.org/security#challenge","created":{"@id":"created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},"verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"Iden3ReverseSparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3ReverseSparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-reverse-sparse-merkle-tree-proof-vocab":"https://schema.iden3.io/core/vocab/Iden3ReverseSparseMerkleTreeProof.md#","revocationNonce":"iden3-reverse-sparse-merkle-tree-proof-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-reverse-sparse-merkle-tree-proof-vocab:statusIssuer"}}},"Iden3commRevocationStatusV1.0":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3commRevocationStatusV1.0","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-comm-revocation-statusV1.0-vocab":"https://schema.iden3.io/core/vocab/Iden3commRevocationStatusV1.0.md#","revocationNonce":"iden3-comm-revocation-statusV1.0-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-comm-revocation-statusV1.0-vocab:statusIssuer"}}},"Iden3OnchainSparseMerkleTreeProof2023":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3OnchainSparseMerkleTreeProof2023","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-onchain-sparse-merkle-tree-proof-2023-vocab":"https://schema.iden3.io/core/vocab/Iden3OnchainSparseMerkleTreeProof2023.md#","revocationNonce":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:statusIssuer"}}},"JsonSchema2023":"https://www.w3.org/ns/credentials#JsonSchema2023","Iden3RefreshService2023":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3RefreshService2023"}}`,
|
|
7703
|
+
IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","displayMethod":{"@id":"https://schema.iden3.io/core/vocab/displayMethod.md#displayMethod","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3BasicDisplayMethodV1":"https://schema.iden3.io/core/vocab/displayMethod.md#Iden3BasicDisplayMethodV1"}}}}`
|
|
7702
7704
|
},
|
|
7703
7705
|
// JsonSchema2023 JSON schema for verification of Iden3Credential
|
|
7704
7706
|
JSON_SCHEMA_VALIDATOR: 'JsonSchema2023',
|
|
@@ -7713,7 +7715,8 @@ const VerifiableConstants = Object.freeze({
|
|
|
7713
7715
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: 'https://schema.iden3.io/core/json/auth.json',
|
|
7714
7716
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: 'https://schema.iden3.io/core/jsonld/auth.jsonld',
|
|
7715
7717
|
AUTH_BJJ_CREDENTIAL_TYPE: 'AuthBJJCredential',
|
|
7716
|
-
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: `{"$schema":"http://json-schema.org/draft-07/schema#","$metadata":{"uris":{"jsonLdContext":"https://schema.iden3.io/core/jsonld/auth.jsonld","jsonSchema":"https://schema.iden3.io/core/json/auth.json"},"serialization":{"indexDataSlotA":"x","indexDataSlotB":"y"}},"type":"object","required":["@context","id","type","issuanceDate","credentialSubject","credentialSchema","credentialStatus","issuer"],"properties":{"@context":{"type":["string","array","object"]},"id":{"type":"string"},"type":{"type":["string","array"],"items":{"type":"string"}},"issuer":{"type":["string","object"],"format":"uri","required":["id"],"properties":{"id":{"type":"string","format":"uri"}}},"issuanceDate":{"type":"string","format":"date-time"},"expirationDate":{"type":"string","format":"date-time"},"credentialSchema":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","format":"uri"},"type":{"type":"string"}}},"credentialSubject":{"type":"object","required":["x","y"],"properties":{"id":{"title":"Credential Subject ID","type":"string","format":"uri"},"x":{"type":"string"},"y":{"type":"string"}}}}}
|
|
7718
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: `{"$schema":"http://json-schema.org/draft-07/schema#","$metadata":{"uris":{"jsonLdContext":"https://schema.iden3.io/core/jsonld/auth.jsonld","jsonSchema":"https://schema.iden3.io/core/json/auth.json"},"serialization":{"indexDataSlotA":"x","indexDataSlotB":"y"}},"type":"object","required":["@context","id","type","issuanceDate","credentialSubject","credentialSchema","credentialStatus","issuer"],"properties":{"@context":{"type":["string","array","object"]},"id":{"type":"string"},"type":{"type":["string","array"],"items":{"type":"string"}},"issuer":{"type":["string","object"],"format":"uri","required":["id"],"properties":{"id":{"type":"string","format":"uri"}}},"issuanceDate":{"type":"string","format":"date-time"},"expirationDate":{"type":"string","format":"date-time"},"credentialSchema":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","format":"uri"},"type":{"type":"string"}}},"credentialSubject":{"type":"object","required":["x","y"],"properties":{"id":{"title":"Credential Subject ID","type":"string","format":"uri"},"x":{"type":"string"},"y":{"type":"string"}}}}}`,
|
|
7719
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD: `{"@context":[{"@version":1.1,"@protected":true,"id":"@id","type":"@type","AuthBJJCredential":{"@id":"https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3_serialization":"iden3:v1:slotIndexA=x&slotIndexB=y","xsd":"http://www.w3.org/2001/XMLSchema#","auth-vocab":"https://schema.iden3.io/core/vocab/auth.md#","x":{"@id":"auth-vocab:x","@type":"xsd:positiveInteger"},"y":{"@id":"auth-vocab:y","@type":"xsd:positiveInteger"}}},"Iden3StateInfo2023":{"@id":"https://schema.iden3.io/core/jsonld/auth.jsonld#Iden3StateInfo2023","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","xsd":"http://www.w3.org/2001/XMLSchema#","@vocab":"https://schema.iden3.io/core/vocab/state-info.md#","@propagate":true,"stateContractAddress":{"@id":"stateContractAddress","@type":"xsd:string"},"published":{"@id":"published","@type":"xsd:boolean"},"info":{"@id":"info","@type":"@id","@context":{"@protected":true,"id":{"@id":"id","@type":"xsd:string"},"state":{"@id":"state","@type":"xsd:string"},"replacedByState":{"@id":"replacedByState","@type":"xsd:string"},"createdAtTimestamp":{"@id":"createdAtTimestamp","@type":"xsd:string"},"replacedAtTimestamp":{"@id":"replacedAtTimestamp","@type":"xsd:string"},"createdAtBlock":{"@id":"createdAtBlock","@type":"xsd:string"},"replacedAtBlock":{"@id":"replacedAtBlock","@type":"xsd:string"}}},"global":{"@id":"global","@type":"@id","@context":{"@protected":true,"sec":"https://w3id.org/security#","root":{"@id":"root","@type":"xsd:string"},"replacedByRoot":{"@id":"replacedByRoot","@type":"xsd:string"},"createdAtTimestamp":{"@id":"createdAtTimestamp","@type":"xsd:string"},"replacedAtTimestamp":{"@id":"replacedAtTimestamp","@type":"xsd:string"},"createdAtBlock":{"@id":"createdAtBlock","@type":"xsd:string"},"replacedAtBlock":{"@id":"replacedAtBlock","@type":"xsd:string"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"}}}}}}]}`
|
|
7717
7720
|
}
|
|
7718
7721
|
});
|
|
7719
7722
|
/**
|
|
@@ -30381,12 +30384,27 @@ class LDParser {
|
|
|
30381
30384
|
* @returns Promise<DocumentLoader>
|
|
30382
30385
|
*/
|
|
30383
30386
|
const doc = JSON.parse(VerifiableConstants.JSONLD_SCHEMA.W3C_VC_DOCUMENT_2018);
|
|
30387
|
+
const docIden3Proofs = JSON.parse(VerifiableConstants.JSONLD_SCHEMA.IDEN3_PROOFS_DEFINITION_DOCUMENT);
|
|
30388
|
+
const docIden3DisplayMethod = JSON.parse(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT);
|
|
30389
|
+
const docIden3AuthBJJ = JSON.parse(VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD);
|
|
30384
30390
|
const cacheLoader = (opts) => {
|
|
30385
30391
|
const cache = new Map();
|
|
30386
30392
|
cache.set(VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018, {
|
|
30387
30393
|
document: doc,
|
|
30388
30394
|
documentUrl: VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018
|
|
30389
30395
|
});
|
|
30396
|
+
cache.set(VerifiableConstants.JSONLD_SCHEMA.IDEN3_CREDENTIAL, {
|
|
30397
|
+
document: docIden3Proofs,
|
|
30398
|
+
documentUrl: VerifiableConstants.JSONLD_SCHEMA.IDEN3_PROOFS_DEFINITION_DOCUMENT
|
|
30399
|
+
});
|
|
30400
|
+
cache.set(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD, {
|
|
30401
|
+
document: docIden3DisplayMethod,
|
|
30402
|
+
documentUrl: VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT
|
|
30403
|
+
});
|
|
30404
|
+
cache.set(VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL, {
|
|
30405
|
+
document: docIden3AuthBJJ,
|
|
30406
|
+
documentUrl: VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD
|
|
30407
|
+
});
|
|
30390
30408
|
return async (url) => {
|
|
30391
30409
|
let remoteDoc = cache.get(url);
|
|
30392
30410
|
if (remoteDoc) {
|
|
@@ -52529,6 +52547,395 @@ class TransactionService {
|
|
|
52529
52547
|
}
|
|
52530
52548
|
}
|
|
52531
52549
|
|
|
52550
|
+
/**
|
|
52551
|
+
* creates empty basic message
|
|
52552
|
+
*
|
|
52553
|
+
* @returns BasicMessage
|
|
52554
|
+
*/
|
|
52555
|
+
const basicMessageFactory = () => {
|
|
52556
|
+
return {
|
|
52557
|
+
id: '',
|
|
52558
|
+
typ: '',
|
|
52559
|
+
thid: '',
|
|
52560
|
+
type: '',
|
|
52561
|
+
body: {},
|
|
52562
|
+
from: '',
|
|
52563
|
+
to: ''
|
|
52564
|
+
};
|
|
52565
|
+
};
|
|
52566
|
+
/**
|
|
52567
|
+
* create empty header stub
|
|
52568
|
+
*
|
|
52569
|
+
* @returns {HeaderStub}
|
|
52570
|
+
*/
|
|
52571
|
+
const headerStubFactory = () => {
|
|
52572
|
+
return {
|
|
52573
|
+
typ: ''
|
|
52574
|
+
};
|
|
52575
|
+
};
|
|
52576
|
+
|
|
52577
|
+
// Envelope Errors
|
|
52578
|
+
// Token Errors
|
|
52579
|
+
const ErrUnknownCircuitID = "unknown circuit ID. can't verify msg sender";
|
|
52580
|
+
const ErrSenderNotUsedTokenCreation = 'sender of message is not used for jwz token creation';
|
|
52581
|
+
// ZKP-Packer Errors
|
|
52582
|
+
const ErrPackedWithUnsupportedCircuit = 'message was packed with unsupported circuit';
|
|
52583
|
+
const ErrProofIsInvalid = 'message proof is invalid';
|
|
52584
|
+
const ErrStateVerificationFailed = 'message state verification failed';
|
|
52585
|
+
const ErrNoProvingMethodAlg = 'unknown proving method algorithm';
|
|
52586
|
+
|
|
52587
|
+
const objectIs = (obj, //eslint-disable-line @typescript-eslint/no-explicit-any
|
|
52588
|
+
targetObj //eslint-disable-line @typescript-eslint/no-explicit-any
|
|
52589
|
+
) => {
|
|
52590
|
+
Object.keys(targetObj).forEach((prop) => {
|
|
52591
|
+
if (!obj[prop]) {
|
|
52592
|
+
return false;
|
|
52593
|
+
}
|
|
52594
|
+
if (typeof targetObj[prop] !== typeof obj[prop]) {
|
|
52595
|
+
return false;
|
|
52596
|
+
}
|
|
52597
|
+
});
|
|
52598
|
+
return true;
|
|
52599
|
+
};
|
|
52600
|
+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52601
|
+
const isProtocolMessage = (message) => {
|
|
52602
|
+
const basicMessage = basicMessageFactory();
|
|
52603
|
+
Object.keys(basicMessage).forEach((prop) => {
|
|
52604
|
+
if (!message[prop]) {
|
|
52605
|
+
return false;
|
|
52606
|
+
}
|
|
52607
|
+
if (prop !== 'body') {
|
|
52608
|
+
const res = typeof basicMessage[prop] ===
|
|
52609
|
+
typeof message[prop]; //eslint-disable-line @typescript-eslint/no-explicit-any
|
|
52610
|
+
if (!res) {
|
|
52611
|
+
return false;
|
|
52612
|
+
}
|
|
52613
|
+
}
|
|
52614
|
+
});
|
|
52615
|
+
return true;
|
|
52616
|
+
};
|
|
52617
|
+
/**
|
|
52618
|
+
* helper function to convert serialized JSON bytes to protocol message
|
|
52619
|
+
*
|
|
52620
|
+
* @param {Uint8Array} bytes
|
|
52621
|
+
* @returns {BasicMessage}
|
|
52622
|
+
*/
|
|
52623
|
+
const bytesToProtocolMessage = (bytes) => {
|
|
52624
|
+
const str = byteDecoder.decode(bytes);
|
|
52625
|
+
const message = JSON.parse(str);
|
|
52626
|
+
if (!isProtocolMessage(message)) ;
|
|
52627
|
+
return message;
|
|
52628
|
+
};
|
|
52629
|
+
/**
|
|
52630
|
+
* helper function to convert serialized JSON bytes to header stub
|
|
52631
|
+
* so we can work with know the media type of the message
|
|
52632
|
+
*
|
|
52633
|
+
* @param {Uint8Array} envelope
|
|
52634
|
+
* @returns {HeaderStub}
|
|
52635
|
+
*/
|
|
52636
|
+
const bytesToHeaderStub = (envelope) => {
|
|
52637
|
+
const tmpObj = headerStubFactory();
|
|
52638
|
+
const str = byteDecoder.decode(envelope);
|
|
52639
|
+
const message = JSON.parse(str);
|
|
52640
|
+
if (!objectIs(message, tmpObj)) ;
|
|
52641
|
+
return message;
|
|
52642
|
+
};
|
|
52643
|
+
|
|
52644
|
+
const IDEN3_PROTOCOL = 'https://iden3-communication.io/';
|
|
52645
|
+
const DIDCOMM_PROTOCOL = 'https://didcomm.org/';
|
|
52646
|
+
/**
|
|
52647
|
+
* Constants for Iden3 protocol
|
|
52648
|
+
*/
|
|
52649
|
+
const PROTOCOL_MESSAGE_TYPE = Object.freeze({
|
|
52650
|
+
// AuthorizationV2RequestMessageType defines auth request type of the communication protocol
|
|
52651
|
+
AUTHORIZATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/request`,
|
|
52652
|
+
// AuthorizationResponseMessageType defines auth response type of the communication protocol
|
|
52653
|
+
AUTHORIZATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/response`,
|
|
52654
|
+
// CredentialIssuanceRequestMessageType accepts request for credential creation
|
|
52655
|
+
CREDENTIAL_ISSUANCE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-request`,
|
|
52656
|
+
// CredentialFetchRequestMessageType is type for request of credential generation
|
|
52657
|
+
CREDENTIAL_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/fetch-request`,
|
|
52658
|
+
// CredentialOfferMessageType is type of message with credential offering
|
|
52659
|
+
CREDENTIAL_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/offer`,
|
|
52660
|
+
// CredentialIssuanceResponseMessageType is type for message with a credential issuance
|
|
52661
|
+
CREDENTIAL_ISSUANCE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-response`,
|
|
52662
|
+
// CredentialRefreshMessageType is type for message with a credential issuance
|
|
52663
|
+
CREDENTIAL_REFRESH_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/refresh`,
|
|
52664
|
+
// DeviceRegistrationRequestMessageType defines device registration request type of the communication protocol
|
|
52665
|
+
DEVICE_REGISTRATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}devices/1.0/registration`,
|
|
52666
|
+
// MessageFetMessageFetchRequestMessageType defines message fetch request type of the communication protocol.
|
|
52667
|
+
MESSAGE_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}messages/1.0/fetch`,
|
|
52668
|
+
// ProofGenerationRequestMessageType is type for request of proof generation
|
|
52669
|
+
PROOF_GENERATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/request`,
|
|
52670
|
+
// ProofGenerationResponseMessageType is type for response of proof generation
|
|
52671
|
+
PROOF_GENERATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/response`,
|
|
52672
|
+
// RevocationStatusRequestMessageType is type for request of revocation status
|
|
52673
|
+
REVOCATION_STATUS_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/request-status`,
|
|
52674
|
+
// RevocationStatusResponseMessageType is type for response with a revocation status
|
|
52675
|
+
REVOCATION_STATUS_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/status`,
|
|
52676
|
+
// ContractInvokeRequestMessageType is type for request of contract invoke request
|
|
52677
|
+
CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-request`,
|
|
52678
|
+
// ContractInvokeResponseMessageType is type for response of contract invoke request
|
|
52679
|
+
CONTRACT_INVOKE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-response`,
|
|
52680
|
+
// CredentialOnchainOfferMessageType is type of message with credential onchain offering
|
|
52681
|
+
CREDENTIAL_ONCHAIN_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/onchain-offer`,
|
|
52682
|
+
// ProposalRequestMessageType is type for proposal-request message
|
|
52683
|
+
PROPOSAL_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal-request`,
|
|
52684
|
+
// ProposalMessageType is type for proposal message
|
|
52685
|
+
PROPOSAL_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal`,
|
|
52686
|
+
// PaymentRequestMessageType is type for payment-request message
|
|
52687
|
+
PAYMENT_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment-request`,
|
|
52688
|
+
// PaymentMessageType is type for payment message
|
|
52689
|
+
PAYMENT_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment`,
|
|
52690
|
+
// DiscoveryProtocolQueriesMessageType is type for didcomm discovery protocol queries
|
|
52691
|
+
DISCOVERY_PROTOCOL_QUERIES_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/queries`,
|
|
52692
|
+
// DiscoveryProtocolDiscloseMessageType is type for didcomm discovery protocol disclose
|
|
52693
|
+
DISCOVERY_PROTOCOL_DISCLOSE_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/disclose`,
|
|
52694
|
+
// ProblemReportMessageType is type for didcomm problem report
|
|
52695
|
+
PROBLEM_REPORT_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}report-problem/2.0/problem-report`
|
|
52696
|
+
});
|
|
52697
|
+
/**
|
|
52698
|
+
* Media types for iden3 comm communication protocol
|
|
52699
|
+
*
|
|
52700
|
+
* @enum {number}
|
|
52701
|
+
*/
|
|
52702
|
+
var MediaType;
|
|
52703
|
+
(function (MediaType) {
|
|
52704
|
+
MediaType["ZKPMessage"] = "application/iden3-zkp-json";
|
|
52705
|
+
MediaType["PlainMessage"] = "application/iden3comm-plain-json";
|
|
52706
|
+
MediaType["SignedMessage"] = "application/iden3comm-signed-json";
|
|
52707
|
+
})(MediaType || (MediaType = {}));
|
|
52708
|
+
const SUPPORTED_PUBLIC_KEY_TYPES = {
|
|
52709
|
+
ES256K: [
|
|
52710
|
+
'EcdsaSecp256k1VerificationKey2019',
|
|
52711
|
+
/**
|
|
52712
|
+
* Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
|
|
52713
|
+
*/
|
|
52714
|
+
'EcdsaSecp256k1RecoveryMethod2020',
|
|
52715
|
+
'JsonWebKey2020'
|
|
52716
|
+
],
|
|
52717
|
+
'ES256K-R': [
|
|
52718
|
+
'EcdsaSecp256k1VerificationKey2019',
|
|
52719
|
+
/**
|
|
52720
|
+
* Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
|
|
52721
|
+
*/
|
|
52722
|
+
'EcdsaSecp256k1RecoveryMethod2020',
|
|
52723
|
+
'JsonWebKey2020'
|
|
52724
|
+
]
|
|
52725
|
+
};
|
|
52726
|
+
var ProtocolVersion;
|
|
52727
|
+
(function (ProtocolVersion) {
|
|
52728
|
+
ProtocolVersion["V1"] = "iden3comm/v1";
|
|
52729
|
+
})(ProtocolVersion || (ProtocolVersion = {}));
|
|
52730
|
+
var AcceptAuthCircuits;
|
|
52731
|
+
(function (AcceptAuthCircuits) {
|
|
52732
|
+
AcceptAuthCircuits["AuthV2"] = "authV2";
|
|
52733
|
+
AcceptAuthCircuits["AuthV3"] = "authV3";
|
|
52734
|
+
})(AcceptAuthCircuits || (AcceptAuthCircuits = {}));
|
|
52735
|
+
var AcceptJwzAlgorithms;
|
|
52736
|
+
(function (AcceptJwzAlgorithms) {
|
|
52737
|
+
AcceptJwzAlgorithms["Groth16"] = "groth16";
|
|
52738
|
+
})(AcceptJwzAlgorithms || (AcceptJwzAlgorithms = {}));
|
|
52739
|
+
var AcceptJwsAlgorithms;
|
|
52740
|
+
(function (AcceptJwsAlgorithms) {
|
|
52741
|
+
AcceptJwsAlgorithms["ES256K"] = "ES256K";
|
|
52742
|
+
AcceptJwsAlgorithms["ES256KR"] = "ES256K-R";
|
|
52743
|
+
})(AcceptJwsAlgorithms || (AcceptJwsAlgorithms = {}));
|
|
52744
|
+
const defaultAcceptProfile = {
|
|
52745
|
+
protocolVersion: ProtocolVersion.V1,
|
|
52746
|
+
env: MediaType.ZKPMessage,
|
|
52747
|
+
circuits: [AcceptAuthCircuits.AuthV2],
|
|
52748
|
+
alg: [AcceptJwzAlgorithms.Groth16]
|
|
52749
|
+
};
|
|
52750
|
+
const DEFAULT_PROOF_VERIFY_DELAY = 1 * 60 * 60 * 1000; // 1 hour
|
|
52751
|
+
const DEFAULT_AUTH_VERIFY_DELAY = 5 * 60 * 1000; // 5 minutes
|
|
52752
|
+
|
|
52753
|
+
var constants = /*#__PURE__*/Object.freeze({
|
|
52754
|
+
__proto__: null,
|
|
52755
|
+
get AcceptAuthCircuits () { return AcceptAuthCircuits; },
|
|
52756
|
+
get AcceptJwsAlgorithms () { return AcceptJwsAlgorithms; },
|
|
52757
|
+
get AcceptJwzAlgorithms () { return AcceptJwzAlgorithms; },
|
|
52758
|
+
DEFAULT_AUTH_VERIFY_DELAY: DEFAULT_AUTH_VERIFY_DELAY,
|
|
52759
|
+
DEFAULT_PROOF_VERIFY_DELAY: DEFAULT_PROOF_VERIFY_DELAY,
|
|
52760
|
+
get MediaType () { return MediaType; },
|
|
52761
|
+
PROTOCOL_MESSAGE_TYPE: PROTOCOL_MESSAGE_TYPE,
|
|
52762
|
+
get ProtocolVersion () { return ProtocolVersion; },
|
|
52763
|
+
SUPPORTED_PUBLIC_KEY_TYPES: SUPPORTED_PUBLIC_KEY_TYPES,
|
|
52764
|
+
defaultAcceptProfile: defaultAcceptProfile
|
|
52765
|
+
});
|
|
52766
|
+
|
|
52767
|
+
const DIDAuthenticationSection = 'authentication';
|
|
52768
|
+
const resolveVerificationMethods = (didDocument) => {
|
|
52769
|
+
const vms = didDocument.verificationMethod || [];
|
|
52770
|
+
// prioritize: first verification methods to be chosen are from `authentication` section.
|
|
52771
|
+
const sortedVerificationMethods = (didDocument[DIDAuthenticationSection] || [])
|
|
52772
|
+
.map((verificationMethod) => {
|
|
52773
|
+
if (typeof verificationMethod === 'string') {
|
|
52774
|
+
return vms.find((i) => i.id === verificationMethod);
|
|
52775
|
+
}
|
|
52776
|
+
return verificationMethod;
|
|
52777
|
+
})
|
|
52778
|
+
.filter((key) => key);
|
|
52779
|
+
// add all other verification methods
|
|
52780
|
+
for (let index = 0; index < vms.length; index++) {
|
|
52781
|
+
const id = vms[index].id;
|
|
52782
|
+
if (sortedVerificationMethods.findIndex((vm) => vm.id === id) === -1) {
|
|
52783
|
+
sortedVerificationMethods.push(vms[index]);
|
|
52784
|
+
}
|
|
52785
|
+
}
|
|
52786
|
+
return sortedVerificationMethods;
|
|
52787
|
+
};
|
|
52788
|
+
const extractPublicKeyBytes = (vm) => {
|
|
52789
|
+
const isSupportedVmType = Object.keys(SUPPORTED_PUBLIC_KEY_TYPES).some((key) => SUPPORTED_PUBLIC_KEY_TYPES[key].includes(vm.type));
|
|
52790
|
+
if (vm.publicKeyBase58 && isSupportedVmType) {
|
|
52791
|
+
return { publicKeyBytes: base58ToBytes$1(vm.publicKeyBase58), kmsKeyType: KmsKeyType.Secp256k1 };
|
|
52792
|
+
}
|
|
52793
|
+
if (vm.publicKeyBase64 && isSupportedVmType) {
|
|
52794
|
+
return {
|
|
52795
|
+
publicKeyBytes: base64UrlToBytes(vm.publicKeyBase64),
|
|
52796
|
+
kmsKeyType: KmsKeyType.Secp256k1
|
|
52797
|
+
};
|
|
52798
|
+
}
|
|
52799
|
+
if (vm.publicKeyHex && isSupportedVmType) {
|
|
52800
|
+
return { publicKeyBytes: hexToBytes$3(vm.publicKeyHex), kmsKeyType: KmsKeyType.Secp256k1 };
|
|
52801
|
+
}
|
|
52802
|
+
if (vm.publicKeyJwk &&
|
|
52803
|
+
vm.publicKeyJwk.crv === 'secp256k1' &&
|
|
52804
|
+
vm.publicKeyJwk.x &&
|
|
52805
|
+
vm.publicKeyJwk.y) {
|
|
52806
|
+
const [xHex, yHex] = [
|
|
52807
|
+
base64UrlToBytes(vm.publicKeyJwk.x),
|
|
52808
|
+
base64UrlToBytes(vm.publicKeyJwk.y)
|
|
52809
|
+
].map(bytesToHex$3);
|
|
52810
|
+
const x = xHex.includes('0x') ? BigInt(xHex) : BigInt(`0x${xHex}`);
|
|
52811
|
+
const y = yHex.includes('0x') ? BigInt(yHex) : BigInt(`0x${yHex}`);
|
|
52812
|
+
return {
|
|
52813
|
+
publicKeyBytes: secp256k1$1.ProjectivePoint.fromAffine({
|
|
52814
|
+
x,
|
|
52815
|
+
y
|
|
52816
|
+
}).toRawBytes(false),
|
|
52817
|
+
kmsKeyType: KmsKeyType.Secp256k1
|
|
52818
|
+
};
|
|
52819
|
+
}
|
|
52820
|
+
return { publicKeyBytes: null };
|
|
52821
|
+
};
|
|
52822
|
+
|
|
52823
|
+
const packZkpProof = (inputs, a, b, c) => {
|
|
52824
|
+
return new AbiCoder().encode(['uint256[] inputs', 'uint256[2]', 'uint256[2][2]', 'uint256[2]'], [inputs, a, b, c]);
|
|
52825
|
+
};
|
|
52826
|
+
const prepareZkpProof = (proof) => {
|
|
52827
|
+
return {
|
|
52828
|
+
a: proof.pi_a.slice(0, 2),
|
|
52829
|
+
b: [
|
|
52830
|
+
[proof.pi_b[0][1], proof.pi_b[0][0]],
|
|
52831
|
+
[proof.pi_b[1][1], proof.pi_b[1][0]]
|
|
52832
|
+
],
|
|
52833
|
+
c: proof.pi_c.slice(0, 2)
|
|
52834
|
+
};
|
|
52835
|
+
};
|
|
52836
|
+
|
|
52837
|
+
function isProtocolVersion(value) {
|
|
52838
|
+
return Object.values(ProtocolVersion).includes(value);
|
|
52839
|
+
}
|
|
52840
|
+
function isMediaType(value) {
|
|
52841
|
+
return Object.values(MediaType).includes(value);
|
|
52842
|
+
}
|
|
52843
|
+
function isAcceptAuthCircuits(value) {
|
|
52844
|
+
return Object.values(AcceptAuthCircuits).includes(value);
|
|
52845
|
+
}
|
|
52846
|
+
function isAcceptJwsAlgorithms(value) {
|
|
52847
|
+
return Object.values(AcceptJwsAlgorithms).includes(value);
|
|
52848
|
+
}
|
|
52849
|
+
function isAcceptJwzAlgorithms(value) {
|
|
52850
|
+
return Object.values(AcceptJwzAlgorithms).includes(value);
|
|
52851
|
+
}
|
|
52852
|
+
const buildAccept = (profiles) => {
|
|
52853
|
+
const result = [];
|
|
52854
|
+
for (const profile of profiles) {
|
|
52855
|
+
let accept = `${profile.protocolVersion};env=${profile.env}`;
|
|
52856
|
+
if (profile.circuits?.length) {
|
|
52857
|
+
accept += `;circuitId=${profile.circuits.join(',')}`;
|
|
52858
|
+
}
|
|
52859
|
+
if (profile.alg?.length) {
|
|
52860
|
+
accept += `;alg=${profile.alg.join(',')}`;
|
|
52861
|
+
}
|
|
52862
|
+
result.push(accept);
|
|
52863
|
+
}
|
|
52864
|
+
return result;
|
|
52865
|
+
};
|
|
52866
|
+
const parseAcceptProfile = (profile) => {
|
|
52867
|
+
const params = profile.split(';');
|
|
52868
|
+
if (params.length < 2) {
|
|
52869
|
+
throw new Error('Invalid accept profile');
|
|
52870
|
+
}
|
|
52871
|
+
const protocolVersion = params[0].trim();
|
|
52872
|
+
if (!isProtocolVersion(protocolVersion)) {
|
|
52873
|
+
throw new Error(`Protocol version '${protocolVersion}' not supported`);
|
|
52874
|
+
}
|
|
52875
|
+
const envParam = params[1].split('=');
|
|
52876
|
+
if (envParam.length !== 2) {
|
|
52877
|
+
throw new Error(`Invalid accept profile 'env' parameter`);
|
|
52878
|
+
}
|
|
52879
|
+
const env = params[1].split('=')[1].trim();
|
|
52880
|
+
if (!isMediaType(env)) {
|
|
52881
|
+
throw new Error(`Envelop '${env}' not supported`);
|
|
52882
|
+
}
|
|
52883
|
+
const circuitsIndex = params.findIndex((i) => i.includes('circuitId='));
|
|
52884
|
+
if (env !== MediaType.ZKPMessage && circuitsIndex > 0) {
|
|
52885
|
+
throw new Error(`Circuits not supported for env '${env}'`);
|
|
52886
|
+
}
|
|
52887
|
+
let circuits = undefined;
|
|
52888
|
+
if (circuitsIndex > 0) {
|
|
52889
|
+
circuits = params[circuitsIndex]
|
|
52890
|
+
.split('=')[1]
|
|
52891
|
+
.split(',')
|
|
52892
|
+
.map((i) => i.trim())
|
|
52893
|
+
.map((i) => {
|
|
52894
|
+
if (!isAcceptAuthCircuits(i)) {
|
|
52895
|
+
throw new Error(`Circuit '${i}' not supported`);
|
|
52896
|
+
}
|
|
52897
|
+
return i;
|
|
52898
|
+
});
|
|
52899
|
+
}
|
|
52900
|
+
const algIndex = params.findIndex((i) => i.includes('alg='));
|
|
52901
|
+
let alg = undefined;
|
|
52902
|
+
if (algIndex > 0) {
|
|
52903
|
+
if (env === MediaType.ZKPMessage) {
|
|
52904
|
+
alg = params[algIndex]
|
|
52905
|
+
.split('=')[1]
|
|
52906
|
+
.split(',')
|
|
52907
|
+
.map((i) => {
|
|
52908
|
+
i = i.trim();
|
|
52909
|
+
if (!isAcceptJwzAlgorithms(i)) {
|
|
52910
|
+
throw new Error(`Algorithm '${i}' not supported for '${env}'`);
|
|
52911
|
+
}
|
|
52912
|
+
return i;
|
|
52913
|
+
});
|
|
52914
|
+
}
|
|
52915
|
+
else if (env === MediaType.SignedMessage) {
|
|
52916
|
+
alg = params[algIndex]
|
|
52917
|
+
.split('=')[1]
|
|
52918
|
+
.split(',')
|
|
52919
|
+
.map((i) => {
|
|
52920
|
+
i = i.trim();
|
|
52921
|
+
if (!isAcceptJwsAlgorithms(i)) {
|
|
52922
|
+
throw new Error(`Algorithm '${i}' not supported for '${env}'`);
|
|
52923
|
+
}
|
|
52924
|
+
return i;
|
|
52925
|
+
});
|
|
52926
|
+
}
|
|
52927
|
+
else {
|
|
52928
|
+
throw new Error(`Algorithm not supported for '${env}'`);
|
|
52929
|
+
}
|
|
52930
|
+
}
|
|
52931
|
+
return {
|
|
52932
|
+
protocolVersion,
|
|
52933
|
+
env,
|
|
52934
|
+
circuits,
|
|
52935
|
+
alg
|
|
52936
|
+
};
|
|
52937
|
+
};
|
|
52938
|
+
|
|
52532
52939
|
const defaultEthConnectionConfig = {
|
|
52533
52940
|
url: 'http://localhost:8545',
|
|
52534
52941
|
defaultGasLimit: 600000,
|
|
@@ -52598,17 +53005,15 @@ class EthStateStorage {
|
|
|
52598
53005
|
const { userId, oldUserState, newUserState, isOldStateGenesis } = stateTransitionPubSig;
|
|
52599
53006
|
const { stateContract, provider } = this.getStateContractAndProviderForId(userId.bigInt());
|
|
52600
53007
|
const contract = stateContract.connect(signer);
|
|
53008
|
+
const preparedZkpProof = prepareZkpProof(proof.proof);
|
|
52601
53009
|
const payload = [
|
|
52602
53010
|
userId.bigInt().toString(),
|
|
52603
53011
|
oldUserState.bigInt().toString(),
|
|
52604
53012
|
newUserState.bigInt().toString(),
|
|
52605
53013
|
isOldStateGenesis,
|
|
52606
|
-
|
|
52607
|
-
|
|
52608
|
-
|
|
52609
|
-
[proof.proof.pi_b[1][1], proof.proof.pi_b[1][0]]
|
|
52610
|
-
],
|
|
52611
|
-
proof.proof.pi_c.slice(0, 2)
|
|
53014
|
+
preparedZkpProof.a,
|
|
53015
|
+
preparedZkpProof.b,
|
|
53016
|
+
preparedZkpProof.c
|
|
52612
53017
|
];
|
|
52613
53018
|
const feeData = await provider.getFeeData();
|
|
52614
53019
|
const maxFeePerGas = defaultEthConnectionConfig.maxFeePerGas
|
|
@@ -53524,6 +53929,598 @@ var abi$2 = [
|
|
|
53524
53929
|
}
|
|
53525
53930
|
];
|
|
53526
53931
|
|
|
53932
|
+
var IVerifierABI = [
|
|
53933
|
+
{
|
|
53934
|
+
inputs: [
|
|
53935
|
+
{
|
|
53936
|
+
internalType: "uint256",
|
|
53937
|
+
name: "multiRequestId",
|
|
53938
|
+
type: "uint256"
|
|
53939
|
+
},
|
|
53940
|
+
{
|
|
53941
|
+
internalType: "address",
|
|
53942
|
+
name: "userAddress",
|
|
53943
|
+
type: "address"
|
|
53944
|
+
}
|
|
53945
|
+
],
|
|
53946
|
+
name: "areMultiRequestProofsVerified",
|
|
53947
|
+
outputs: [
|
|
53948
|
+
{
|
|
53949
|
+
internalType: "bool",
|
|
53950
|
+
name: "",
|
|
53951
|
+
type: "bool"
|
|
53952
|
+
}
|
|
53953
|
+
],
|
|
53954
|
+
stateMutability: "view",
|
|
53955
|
+
type: "function"
|
|
53956
|
+
},
|
|
53957
|
+
{
|
|
53958
|
+
inputs: [
|
|
53959
|
+
{
|
|
53960
|
+
internalType: "uint256",
|
|
53961
|
+
name: "groupID",
|
|
53962
|
+
type: "uint256"
|
|
53963
|
+
}
|
|
53964
|
+
],
|
|
53965
|
+
name: "getGroupedRequests",
|
|
53966
|
+
outputs: [
|
|
53967
|
+
{
|
|
53968
|
+
components: [
|
|
53969
|
+
{
|
|
53970
|
+
internalType: "uint256",
|
|
53971
|
+
name: "requestId",
|
|
53972
|
+
type: "uint256"
|
|
53973
|
+
},
|
|
53974
|
+
{
|
|
53975
|
+
internalType: "string",
|
|
53976
|
+
name: "metadata",
|
|
53977
|
+
type: "string"
|
|
53978
|
+
},
|
|
53979
|
+
{
|
|
53980
|
+
internalType: "contract IRequestValidator",
|
|
53981
|
+
name: "validator",
|
|
53982
|
+
type: "address"
|
|
53983
|
+
},
|
|
53984
|
+
{
|
|
53985
|
+
internalType: "bytes",
|
|
53986
|
+
name: "params",
|
|
53987
|
+
type: "bytes"
|
|
53988
|
+
},
|
|
53989
|
+
{
|
|
53990
|
+
internalType: "address",
|
|
53991
|
+
name: "creator",
|
|
53992
|
+
type: "address"
|
|
53993
|
+
}
|
|
53994
|
+
],
|
|
53995
|
+
internalType: "struct IVerifier.RequestInfo[]",
|
|
53996
|
+
name: "",
|
|
53997
|
+
type: "tuple[]"
|
|
53998
|
+
}
|
|
53999
|
+
],
|
|
54000
|
+
stateMutability: "view",
|
|
54001
|
+
type: "function"
|
|
54002
|
+
},
|
|
54003
|
+
{
|
|
54004
|
+
inputs: [
|
|
54005
|
+
],
|
|
54006
|
+
name: "getGroupsCount",
|
|
54007
|
+
outputs: [
|
|
54008
|
+
{
|
|
54009
|
+
internalType: "uint256",
|
|
54010
|
+
name: "",
|
|
54011
|
+
type: "uint256"
|
|
54012
|
+
}
|
|
54013
|
+
],
|
|
54014
|
+
stateMutability: "view",
|
|
54015
|
+
type: "function"
|
|
54016
|
+
},
|
|
54017
|
+
{
|
|
54018
|
+
inputs: [
|
|
54019
|
+
{
|
|
54020
|
+
internalType: "uint256",
|
|
54021
|
+
name: "multiRequestId",
|
|
54022
|
+
type: "uint256"
|
|
54023
|
+
}
|
|
54024
|
+
],
|
|
54025
|
+
name: "getMultiRequest",
|
|
54026
|
+
outputs: [
|
|
54027
|
+
{
|
|
54028
|
+
components: [
|
|
54029
|
+
{
|
|
54030
|
+
internalType: "uint256",
|
|
54031
|
+
name: "multiRequestId",
|
|
54032
|
+
type: "uint256"
|
|
54033
|
+
},
|
|
54034
|
+
{
|
|
54035
|
+
internalType: "uint256[]",
|
|
54036
|
+
name: "requestIds",
|
|
54037
|
+
type: "uint256[]"
|
|
54038
|
+
},
|
|
54039
|
+
{
|
|
54040
|
+
internalType: "uint256[]",
|
|
54041
|
+
name: "groupIds",
|
|
54042
|
+
type: "uint256[]"
|
|
54043
|
+
},
|
|
54044
|
+
{
|
|
54045
|
+
internalType: "bytes",
|
|
54046
|
+
name: "metadata",
|
|
54047
|
+
type: "bytes"
|
|
54048
|
+
}
|
|
54049
|
+
],
|
|
54050
|
+
internalType: "struct IVerifier.MultiRequest",
|
|
54051
|
+
name: "multiRequest",
|
|
54052
|
+
type: "tuple"
|
|
54053
|
+
}
|
|
54054
|
+
],
|
|
54055
|
+
stateMutability: "view",
|
|
54056
|
+
type: "function"
|
|
54057
|
+
},
|
|
54058
|
+
{
|
|
54059
|
+
inputs: [
|
|
54060
|
+
{
|
|
54061
|
+
internalType: "uint256",
|
|
54062
|
+
name: "multiRequestId",
|
|
54063
|
+
type: "uint256"
|
|
54064
|
+
},
|
|
54065
|
+
{
|
|
54066
|
+
internalType: "address",
|
|
54067
|
+
name: "userAddress",
|
|
54068
|
+
type: "address"
|
|
54069
|
+
}
|
|
54070
|
+
],
|
|
54071
|
+
name: "getMultiRequestProofsStatus",
|
|
54072
|
+
outputs: [
|
|
54073
|
+
{
|
|
54074
|
+
components: [
|
|
54075
|
+
{
|
|
54076
|
+
internalType: "uint256",
|
|
54077
|
+
name: "requestId",
|
|
54078
|
+
type: "uint256"
|
|
54079
|
+
},
|
|
54080
|
+
{
|
|
54081
|
+
internalType: "bool",
|
|
54082
|
+
name: "isVerified",
|
|
54083
|
+
type: "bool"
|
|
54084
|
+
},
|
|
54085
|
+
{
|
|
54086
|
+
internalType: "string",
|
|
54087
|
+
name: "validatorVersion",
|
|
54088
|
+
type: "string"
|
|
54089
|
+
},
|
|
54090
|
+
{
|
|
54091
|
+
internalType: "uint256",
|
|
54092
|
+
name: "timestamp",
|
|
54093
|
+
type: "uint256"
|
|
54094
|
+
}
|
|
54095
|
+
],
|
|
54096
|
+
internalType: "struct IVerifier.RequestProofStatus[]",
|
|
54097
|
+
name: "",
|
|
54098
|
+
type: "tuple[]"
|
|
54099
|
+
}
|
|
54100
|
+
],
|
|
54101
|
+
stateMutability: "view",
|
|
54102
|
+
type: "function"
|
|
54103
|
+
},
|
|
54104
|
+
{
|
|
54105
|
+
inputs: [
|
|
54106
|
+
{
|
|
54107
|
+
internalType: "uint256",
|
|
54108
|
+
name: "requestId",
|
|
54109
|
+
type: "uint256"
|
|
54110
|
+
}
|
|
54111
|
+
],
|
|
54112
|
+
name: "getRequest",
|
|
54113
|
+
outputs: [
|
|
54114
|
+
{
|
|
54115
|
+
components: [
|
|
54116
|
+
{
|
|
54117
|
+
internalType: "uint256",
|
|
54118
|
+
name: "requestId",
|
|
54119
|
+
type: "uint256"
|
|
54120
|
+
},
|
|
54121
|
+
{
|
|
54122
|
+
internalType: "string",
|
|
54123
|
+
name: "metadata",
|
|
54124
|
+
type: "string"
|
|
54125
|
+
},
|
|
54126
|
+
{
|
|
54127
|
+
internalType: "contract IRequestValidator",
|
|
54128
|
+
name: "validator",
|
|
54129
|
+
type: "address"
|
|
54130
|
+
},
|
|
54131
|
+
{
|
|
54132
|
+
internalType: "bytes",
|
|
54133
|
+
name: "params",
|
|
54134
|
+
type: "bytes"
|
|
54135
|
+
},
|
|
54136
|
+
{
|
|
54137
|
+
internalType: "address",
|
|
54138
|
+
name: "creator",
|
|
54139
|
+
type: "address"
|
|
54140
|
+
}
|
|
54141
|
+
],
|
|
54142
|
+
internalType: "struct IVerifier.RequestInfo",
|
|
54143
|
+
name: "request",
|
|
54144
|
+
type: "tuple"
|
|
54145
|
+
}
|
|
54146
|
+
],
|
|
54147
|
+
stateMutability: "view",
|
|
54148
|
+
type: "function"
|
|
54149
|
+
},
|
|
54150
|
+
{
|
|
54151
|
+
inputs: [
|
|
54152
|
+
{
|
|
54153
|
+
internalType: "address",
|
|
54154
|
+
name: "sender",
|
|
54155
|
+
type: "address"
|
|
54156
|
+
},
|
|
54157
|
+
{
|
|
54158
|
+
internalType: "uint256",
|
|
54159
|
+
name: "requestId",
|
|
54160
|
+
type: "uint256"
|
|
54161
|
+
}
|
|
54162
|
+
],
|
|
54163
|
+
name: "getRequestProofStatus",
|
|
54164
|
+
outputs: [
|
|
54165
|
+
{
|
|
54166
|
+
components: [
|
|
54167
|
+
{
|
|
54168
|
+
internalType: "uint256",
|
|
54169
|
+
name: "requestId",
|
|
54170
|
+
type: "uint256"
|
|
54171
|
+
},
|
|
54172
|
+
{
|
|
54173
|
+
internalType: "bool",
|
|
54174
|
+
name: "isVerified",
|
|
54175
|
+
type: "bool"
|
|
54176
|
+
},
|
|
54177
|
+
{
|
|
54178
|
+
internalType: "string",
|
|
54179
|
+
name: "validatorVersion",
|
|
54180
|
+
type: "string"
|
|
54181
|
+
},
|
|
54182
|
+
{
|
|
54183
|
+
internalType: "uint256",
|
|
54184
|
+
name: "timestamp",
|
|
54185
|
+
type: "uint256"
|
|
54186
|
+
}
|
|
54187
|
+
],
|
|
54188
|
+
internalType: "struct IVerifier.RequestProofStatus",
|
|
54189
|
+
name: "",
|
|
54190
|
+
type: "tuple"
|
|
54191
|
+
}
|
|
54192
|
+
],
|
|
54193
|
+
stateMutability: "view",
|
|
54194
|
+
type: "function"
|
|
54195
|
+
},
|
|
54196
|
+
{
|
|
54197
|
+
inputs: [
|
|
54198
|
+
],
|
|
54199
|
+
name: "getRequestsCount",
|
|
54200
|
+
outputs: [
|
|
54201
|
+
{
|
|
54202
|
+
internalType: "uint256",
|
|
54203
|
+
name: "",
|
|
54204
|
+
type: "uint256"
|
|
54205
|
+
}
|
|
54206
|
+
],
|
|
54207
|
+
stateMutability: "view",
|
|
54208
|
+
type: "function"
|
|
54209
|
+
},
|
|
54210
|
+
{
|
|
54211
|
+
inputs: [
|
|
54212
|
+
{
|
|
54213
|
+
internalType: "uint256",
|
|
54214
|
+
name: "requestId",
|
|
54215
|
+
type: "uint256"
|
|
54216
|
+
},
|
|
54217
|
+
{
|
|
54218
|
+
internalType: "address",
|
|
54219
|
+
name: "sender",
|
|
54220
|
+
type: "address"
|
|
54221
|
+
},
|
|
54222
|
+
{
|
|
54223
|
+
internalType: "string",
|
|
54224
|
+
name: "responseFieldName",
|
|
54225
|
+
type: "string"
|
|
54226
|
+
}
|
|
54227
|
+
],
|
|
54228
|
+
name: "getResponseFieldValue",
|
|
54229
|
+
outputs: [
|
|
54230
|
+
{
|
|
54231
|
+
internalType: "uint256",
|
|
54232
|
+
name: "",
|
|
54233
|
+
type: "uint256"
|
|
54234
|
+
}
|
|
54235
|
+
],
|
|
54236
|
+
stateMutability: "view",
|
|
54237
|
+
type: "function"
|
|
54238
|
+
},
|
|
54239
|
+
{
|
|
54240
|
+
inputs: [
|
|
54241
|
+
{
|
|
54242
|
+
internalType: "uint256",
|
|
54243
|
+
name: "requestId",
|
|
54244
|
+
type: "uint256"
|
|
54245
|
+
},
|
|
54246
|
+
{
|
|
54247
|
+
internalType: "address",
|
|
54248
|
+
name: "sender",
|
|
54249
|
+
type: "address"
|
|
54250
|
+
}
|
|
54251
|
+
],
|
|
54252
|
+
name: "getResponseFields",
|
|
54253
|
+
outputs: [
|
|
54254
|
+
{
|
|
54255
|
+
components: [
|
|
54256
|
+
{
|
|
54257
|
+
internalType: "string",
|
|
54258
|
+
name: "name",
|
|
54259
|
+
type: "string"
|
|
54260
|
+
},
|
|
54261
|
+
{
|
|
54262
|
+
internalType: "uint256",
|
|
54263
|
+
name: "value",
|
|
54264
|
+
type: "uint256"
|
|
54265
|
+
},
|
|
54266
|
+
{
|
|
54267
|
+
internalType: "bytes",
|
|
54268
|
+
name: "rawValue",
|
|
54269
|
+
type: "bytes"
|
|
54270
|
+
}
|
|
54271
|
+
],
|
|
54272
|
+
internalType: "struct IRequestValidator.ResponseField[]",
|
|
54273
|
+
name: "",
|
|
54274
|
+
type: "tuple[]"
|
|
54275
|
+
}
|
|
54276
|
+
],
|
|
54277
|
+
stateMutability: "view",
|
|
54278
|
+
type: "function"
|
|
54279
|
+
},
|
|
54280
|
+
{
|
|
54281
|
+
inputs: [
|
|
54282
|
+
{
|
|
54283
|
+
internalType: "uint256",
|
|
54284
|
+
name: "groupId",
|
|
54285
|
+
type: "uint256"
|
|
54286
|
+
}
|
|
54287
|
+
],
|
|
54288
|
+
name: "groupIdExists",
|
|
54289
|
+
outputs: [
|
|
54290
|
+
{
|
|
54291
|
+
internalType: "bool",
|
|
54292
|
+
name: "",
|
|
54293
|
+
type: "bool"
|
|
54294
|
+
}
|
|
54295
|
+
],
|
|
54296
|
+
stateMutability: "view",
|
|
54297
|
+
type: "function"
|
|
54298
|
+
},
|
|
54299
|
+
{
|
|
54300
|
+
inputs: [
|
|
54301
|
+
{
|
|
54302
|
+
internalType: "address",
|
|
54303
|
+
name: "sender",
|
|
54304
|
+
type: "address"
|
|
54305
|
+
},
|
|
54306
|
+
{
|
|
54307
|
+
internalType: "uint256",
|
|
54308
|
+
name: "requestId",
|
|
54309
|
+
type: "uint256"
|
|
54310
|
+
}
|
|
54311
|
+
],
|
|
54312
|
+
name: "isRequestProofVerified",
|
|
54313
|
+
outputs: [
|
|
54314
|
+
{
|
|
54315
|
+
internalType: "bool",
|
|
54316
|
+
name: "",
|
|
54317
|
+
type: "bool"
|
|
54318
|
+
}
|
|
54319
|
+
],
|
|
54320
|
+
stateMutability: "view",
|
|
54321
|
+
type: "function"
|
|
54322
|
+
},
|
|
54323
|
+
{
|
|
54324
|
+
inputs: [
|
|
54325
|
+
{
|
|
54326
|
+
internalType: "uint256",
|
|
54327
|
+
name: "multiRequestId",
|
|
54328
|
+
type: "uint256"
|
|
54329
|
+
}
|
|
54330
|
+
],
|
|
54331
|
+
name: "multiRequestIdExists",
|
|
54332
|
+
outputs: [
|
|
54333
|
+
{
|
|
54334
|
+
internalType: "bool",
|
|
54335
|
+
name: "",
|
|
54336
|
+
type: "bool"
|
|
54337
|
+
}
|
|
54338
|
+
],
|
|
54339
|
+
stateMutability: "view",
|
|
54340
|
+
type: "function"
|
|
54341
|
+
},
|
|
54342
|
+
{
|
|
54343
|
+
inputs: [
|
|
54344
|
+
{
|
|
54345
|
+
internalType: "uint256",
|
|
54346
|
+
name: "requestId",
|
|
54347
|
+
type: "uint256"
|
|
54348
|
+
}
|
|
54349
|
+
],
|
|
54350
|
+
name: "requestIdExists",
|
|
54351
|
+
outputs: [
|
|
54352
|
+
{
|
|
54353
|
+
internalType: "bool",
|
|
54354
|
+
name: "",
|
|
54355
|
+
type: "bool"
|
|
54356
|
+
}
|
|
54357
|
+
],
|
|
54358
|
+
stateMutability: "view",
|
|
54359
|
+
type: "function"
|
|
54360
|
+
},
|
|
54361
|
+
{
|
|
54362
|
+
inputs: [
|
|
54363
|
+
{
|
|
54364
|
+
components: [
|
|
54365
|
+
{
|
|
54366
|
+
internalType: "string",
|
|
54367
|
+
name: "authMethod",
|
|
54368
|
+
type: "string"
|
|
54369
|
+
},
|
|
54370
|
+
{
|
|
54371
|
+
internalType: "contract IAuthValidator",
|
|
54372
|
+
name: "validator",
|
|
54373
|
+
type: "address"
|
|
54374
|
+
},
|
|
54375
|
+
{
|
|
54376
|
+
internalType: "bytes",
|
|
54377
|
+
name: "params",
|
|
54378
|
+
type: "bytes"
|
|
54379
|
+
}
|
|
54380
|
+
],
|
|
54381
|
+
internalType: "struct IVerifier.AuthMethod",
|
|
54382
|
+
name: "authMethod",
|
|
54383
|
+
type: "tuple"
|
|
54384
|
+
}
|
|
54385
|
+
],
|
|
54386
|
+
name: "setAuthMethod",
|
|
54387
|
+
outputs: [
|
|
54388
|
+
],
|
|
54389
|
+
stateMutability: "nonpayable",
|
|
54390
|
+
type: "function"
|
|
54391
|
+
},
|
|
54392
|
+
{
|
|
54393
|
+
inputs: [
|
|
54394
|
+
{
|
|
54395
|
+
components: [
|
|
54396
|
+
{
|
|
54397
|
+
internalType: "uint256",
|
|
54398
|
+
name: "multiRequestId",
|
|
54399
|
+
type: "uint256"
|
|
54400
|
+
},
|
|
54401
|
+
{
|
|
54402
|
+
internalType: "uint256[]",
|
|
54403
|
+
name: "requestIds",
|
|
54404
|
+
type: "uint256[]"
|
|
54405
|
+
},
|
|
54406
|
+
{
|
|
54407
|
+
internalType: "uint256[]",
|
|
54408
|
+
name: "groupIds",
|
|
54409
|
+
type: "uint256[]"
|
|
54410
|
+
},
|
|
54411
|
+
{
|
|
54412
|
+
internalType: "bytes",
|
|
54413
|
+
name: "metadata",
|
|
54414
|
+
type: "bytes"
|
|
54415
|
+
}
|
|
54416
|
+
],
|
|
54417
|
+
internalType: "struct IVerifier.MultiRequest",
|
|
54418
|
+
name: "multiRequest",
|
|
54419
|
+
type: "tuple"
|
|
54420
|
+
}
|
|
54421
|
+
],
|
|
54422
|
+
name: "setMultiRequest",
|
|
54423
|
+
outputs: [
|
|
54424
|
+
],
|
|
54425
|
+
stateMutability: "nonpayable",
|
|
54426
|
+
type: "function"
|
|
54427
|
+
},
|
|
54428
|
+
{
|
|
54429
|
+
inputs: [
|
|
54430
|
+
{
|
|
54431
|
+
components: [
|
|
54432
|
+
{
|
|
54433
|
+
internalType: "uint256",
|
|
54434
|
+
name: "requestId",
|
|
54435
|
+
type: "uint256"
|
|
54436
|
+
},
|
|
54437
|
+
{
|
|
54438
|
+
internalType: "string",
|
|
54439
|
+
name: "metadata",
|
|
54440
|
+
type: "string"
|
|
54441
|
+
},
|
|
54442
|
+
{
|
|
54443
|
+
internalType: "contract IRequestValidator",
|
|
54444
|
+
name: "validator",
|
|
54445
|
+
type: "address"
|
|
54446
|
+
},
|
|
54447
|
+
{
|
|
54448
|
+
internalType: "bytes",
|
|
54449
|
+
name: "params",
|
|
54450
|
+
type: "bytes"
|
|
54451
|
+
},
|
|
54452
|
+
{
|
|
54453
|
+
internalType: "address",
|
|
54454
|
+
name: "owner",
|
|
54455
|
+
type: "address"
|
|
54456
|
+
}
|
|
54457
|
+
],
|
|
54458
|
+
internalType: "struct IVerifier.Request[]",
|
|
54459
|
+
name: "requests",
|
|
54460
|
+
type: "tuple[]"
|
|
54461
|
+
}
|
|
54462
|
+
],
|
|
54463
|
+
name: "setRequests",
|
|
54464
|
+
outputs: [
|
|
54465
|
+
],
|
|
54466
|
+
stateMutability: "nonpayable",
|
|
54467
|
+
type: "function"
|
|
54468
|
+
},
|
|
54469
|
+
{
|
|
54470
|
+
inputs: [
|
|
54471
|
+
{
|
|
54472
|
+
components: [
|
|
54473
|
+
{
|
|
54474
|
+
internalType: "string",
|
|
54475
|
+
name: "authMethod",
|
|
54476
|
+
type: "string"
|
|
54477
|
+
},
|
|
54478
|
+
{
|
|
54479
|
+
internalType: "bytes",
|
|
54480
|
+
name: "proof",
|
|
54481
|
+
type: "bytes"
|
|
54482
|
+
}
|
|
54483
|
+
],
|
|
54484
|
+
internalType: "struct IVerifier.AuthResponse",
|
|
54485
|
+
name: "authResponse",
|
|
54486
|
+
type: "tuple"
|
|
54487
|
+
},
|
|
54488
|
+
{
|
|
54489
|
+
components: [
|
|
54490
|
+
{
|
|
54491
|
+
internalType: "uint256",
|
|
54492
|
+
name: "requestId",
|
|
54493
|
+
type: "uint256"
|
|
54494
|
+
},
|
|
54495
|
+
{
|
|
54496
|
+
internalType: "bytes",
|
|
54497
|
+
name: "proof",
|
|
54498
|
+
type: "bytes"
|
|
54499
|
+
},
|
|
54500
|
+
{
|
|
54501
|
+
internalType: "bytes",
|
|
54502
|
+
name: "metadata",
|
|
54503
|
+
type: "bytes"
|
|
54504
|
+
}
|
|
54505
|
+
],
|
|
54506
|
+
internalType: "struct IVerifier.Response[]",
|
|
54507
|
+
name: "responses",
|
|
54508
|
+
type: "tuple[]"
|
|
54509
|
+
},
|
|
54510
|
+
{
|
|
54511
|
+
internalType: "bytes",
|
|
54512
|
+
name: "crossChainProofs",
|
|
54513
|
+
type: "bytes"
|
|
54514
|
+
}
|
|
54515
|
+
],
|
|
54516
|
+
name: "submitResponse",
|
|
54517
|
+
outputs: [
|
|
54518
|
+
],
|
|
54519
|
+
stateMutability: "nonpayable",
|
|
54520
|
+
type: "function"
|
|
54521
|
+
}
|
|
54522
|
+
];
|
|
54523
|
+
|
|
53527
54524
|
const maxGasLimit = 10000000n;
|
|
53528
54525
|
/**
|
|
53529
54526
|
* Supported function signature for SubmitZKPResponse
|
|
@@ -53538,6 +54535,8 @@ var FunctionSignatures;
|
|
|
53538
54535
|
FunctionSignatures["SubmitZKPResponseV1"] = "b68967e2";
|
|
53539
54536
|
//function submitZKPResponseV2(tuple[](uint64 requestId,bytes zkProof,bytes data),bytes crossChainProof)
|
|
53540
54537
|
FunctionSignatures["SubmitZKPResponseV2"] = "ade09fcd";
|
|
54538
|
+
//function submitResponse(tuple(string authMethod,bytes proof),tuple(uint256 requestId,bytes proof,bytes metadata)[],bytes crossChainProof)
|
|
54539
|
+
FunctionSignatures["SubmitResponse"] = "06c86a91";
|
|
53541
54540
|
})(FunctionSignatures || (FunctionSignatures = {}));
|
|
53542
54541
|
/**
|
|
53543
54542
|
* OnChainZKPVerifier is a class that allows to interact with the OnChainZKPVerifier contract
|
|
@@ -53563,16 +54562,8 @@ class OnChainZKPVerifier {
|
|
|
53563
54562
|
}
|
|
53564
54563
|
const requestID = zkProofResponse.id;
|
|
53565
54564
|
const inputs = zkProofResponse.pub_signals;
|
|
53566
|
-
const
|
|
53567
|
-
|
|
53568
|
-
inputs,
|
|
53569
|
-
zkProofResponse.proof.pi_a.slice(0, 2),
|
|
53570
|
-
[
|
|
53571
|
-
[zkProofResponse.proof.pi_b[0][1], zkProofResponse.proof.pi_b[0][0]],
|
|
53572
|
-
[zkProofResponse.proof.pi_b[1][1], zkProofResponse.proof.pi_b[1][0]]
|
|
53573
|
-
],
|
|
53574
|
-
zkProofResponse.proof.pi_c.slice(0, 2)
|
|
53575
|
-
];
|
|
54565
|
+
const preparedZkpProof = prepareZkpProof(zkProofResponse.proof);
|
|
54566
|
+
const payload = [requestID, inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c];
|
|
53576
54567
|
return payload;
|
|
53577
54568
|
}
|
|
53578
54569
|
/**
|
|
@@ -53670,6 +54661,80 @@ class OnChainZKPVerifier {
|
|
|
53670
54661
|
const { txnHash } = await transactionService.sendTransactionRequest(ethSigner, request);
|
|
53671
54662
|
return new Map().set(txnHash, zkProofResponses);
|
|
53672
54663
|
}
|
|
54664
|
+
/**
|
|
54665
|
+
* {@inheritDoc IOnChainVerifierMultiQuery.submitResponse}
|
|
54666
|
+
*/
|
|
54667
|
+
async submitResponse(ethSigner, txData, authResponse, responses) {
|
|
54668
|
+
const chainConfig = this._configs.find((i) => i.chainId == txData.chain_id);
|
|
54669
|
+
if (!chainConfig) {
|
|
54670
|
+
throw new Error(`config for chain id ${txData.chain_id} was not found`);
|
|
54671
|
+
}
|
|
54672
|
+
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitResponse) {
|
|
54673
|
+
throw new Error(`submitResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitResponse}' is supported.`);
|
|
54674
|
+
}
|
|
54675
|
+
if (!this._opts?.didResolverUrl) {
|
|
54676
|
+
throw new Error(`did resolver url required for crosschain verification`);
|
|
54677
|
+
}
|
|
54678
|
+
const provider = new JsonRpcProvider(chainConfig.url, chainConfig.chainId);
|
|
54679
|
+
ethSigner = ethSigner.connect(provider);
|
|
54680
|
+
const txDataArgs = await this.prepareTxArgsSubmit(txData, authResponse, responses);
|
|
54681
|
+
const feeData = await provider.getFeeData();
|
|
54682
|
+
const maxFeePerGas = chainConfig.maxFeePerGas
|
|
54683
|
+
? BigInt(chainConfig.maxFeePerGas)
|
|
54684
|
+
: feeData.maxFeePerGas;
|
|
54685
|
+
const maxPriorityFeePerGas = chainConfig.maxPriorityFeePerGas
|
|
54686
|
+
? BigInt(chainConfig.maxPriorityFeePerGas)
|
|
54687
|
+
: feeData.maxPriorityFeePerGas;
|
|
54688
|
+
const verifierContract = new Contract(txData.contract_address, IVerifierABI);
|
|
54689
|
+
const txRequestData = await verifierContract.submitResponse.populateTransaction(...txDataArgs);
|
|
54690
|
+
const request = {
|
|
54691
|
+
to: txData.contract_address,
|
|
54692
|
+
data: txRequestData.data,
|
|
54693
|
+
maxFeePerGas,
|
|
54694
|
+
maxPriorityFeePerGas
|
|
54695
|
+
};
|
|
54696
|
+
let gasLimit;
|
|
54697
|
+
try {
|
|
54698
|
+
gasLimit = await ethSigner.estimateGas(request);
|
|
54699
|
+
}
|
|
54700
|
+
catch (e) {
|
|
54701
|
+
gasLimit = maxGasLimit;
|
|
54702
|
+
}
|
|
54703
|
+
request.gasLimit = gasLimit;
|
|
54704
|
+
const transactionService = new TransactionService(provider);
|
|
54705
|
+
const { txnHash } = await transactionService.sendTransactionRequest(ethSigner, request);
|
|
54706
|
+
// return multiple responses for all the responses (single and grouped)
|
|
54707
|
+
return new Map().set(txnHash, {
|
|
54708
|
+
responses: responses,
|
|
54709
|
+
authProofs: [authResponse],
|
|
54710
|
+
crossChainProofs: [txDataArgs[2]]
|
|
54711
|
+
});
|
|
54712
|
+
}
|
|
54713
|
+
static async prepareTxArgsSubmit(resolverUrl, txData, authResponse, responses) {
|
|
54714
|
+
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitResponse) {
|
|
54715
|
+
throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitResponse}' is supported.`);
|
|
54716
|
+
}
|
|
54717
|
+
const gistUpdateArr = [];
|
|
54718
|
+
const stateUpdateArr = [];
|
|
54719
|
+
const payloadResponses = [];
|
|
54720
|
+
// Process all the responses
|
|
54721
|
+
for (const zkProof of responses) {
|
|
54722
|
+
const { requestID, zkProofEncoded, metadata } = await this._processProof(zkProof);
|
|
54723
|
+
payloadResponses.push({
|
|
54724
|
+
requestId: requestID,
|
|
54725
|
+
proof: zkProofEncoded,
|
|
54726
|
+
metadata: metadata
|
|
54727
|
+
});
|
|
54728
|
+
}
|
|
54729
|
+
const crossChainProofs = this.packCrossChainProofs(gistUpdateArr, stateUpdateArr);
|
|
54730
|
+
return [authResponse, payloadResponses, crossChainProofs];
|
|
54731
|
+
}
|
|
54732
|
+
async prepareTxArgsSubmit(txData, authResponse, responses) {
|
|
54733
|
+
if (!this._opts?.didResolverUrl) {
|
|
54734
|
+
throw new Error(`did resolver url required for crosschain verification`);
|
|
54735
|
+
}
|
|
54736
|
+
return OnChainZKPVerifier.prepareTxArgsSubmit(this._opts.didResolverUrl, txData, authResponse, responses);
|
|
54737
|
+
}
|
|
53673
54738
|
static getCrossChainResolvers(source, txDataChainId, type, didResolverUrl) {
|
|
53674
54739
|
return [
|
|
53675
54740
|
...new Set(source.map((info) => JSON.stringify({
|
|
@@ -53711,10 +54776,8 @@ class OnChainZKPVerifier {
|
|
|
53711
54776
|
});
|
|
53712
54777
|
continue;
|
|
53713
54778
|
}
|
|
53714
|
-
const
|
|
53715
|
-
|
|
53716
|
-
[zkProof.proof.pi_b[1][1], zkProof.proof.pi_b[1][0]]
|
|
53717
|
-
], zkProof.proof.pi_c.slice(0, 2));
|
|
54779
|
+
const preparedZkpProof = prepareZkpProof(zkProof.proof);
|
|
54780
|
+
const zkProofEncoded = packZkpProof(inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
|
|
53718
54781
|
const stateInfo = this.getOnChainGistRootStatePubSignals(proofCircuitId, inputs);
|
|
53719
54782
|
const chainId = txData.chain_id;
|
|
53720
54783
|
const gistUpdateResolutions = this.getCrossChainResolvers(stateInfo.gists, chainId, 'gist', resolverUrl);
|
|
@@ -53757,8 +54820,30 @@ class OnChainZKPVerifier {
|
|
|
53757
54820
|
}
|
|
53758
54821
|
return OnChainZKPVerifier.prepareTxArgsSubmitV2(this._opts.didResolverUrl, txData, zkProofResponses);
|
|
53759
54822
|
}
|
|
53760
|
-
static
|
|
53761
|
-
|
|
54823
|
+
static async _processProof(zkProof) {
|
|
54824
|
+
const requestID = zkProof.id;
|
|
54825
|
+
const inputs = zkProof.pub_signals;
|
|
54826
|
+
if (!this._supportedCircuits.includes(zkProof.circuitId)) {
|
|
54827
|
+
throw new Error(`Circuit ${zkProof.circuitId} not supported by OnChainZKPVerifier`);
|
|
54828
|
+
}
|
|
54829
|
+
const preparedZkpProof = prepareZkpProof(zkProof.proof);
|
|
54830
|
+
const zkProofEncoded = packZkpProof(inputs, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
|
|
54831
|
+
const metadataArr = [];
|
|
54832
|
+
if (zkProof.vp) {
|
|
54833
|
+
for (const key in zkProof.vp.verifiableCredential.credentialSubject) {
|
|
54834
|
+
if (key === '@type') {
|
|
54835
|
+
continue;
|
|
54836
|
+
}
|
|
54837
|
+
const metadataValue = poseidon.hashBytes(byteEncoder.encode(JSON.stringify(zkProof.vp.verifiableCredential.credentialSubject[key])));
|
|
54838
|
+
const bytesValue = byteEncoder.encode(metadataValue.toString());
|
|
54839
|
+
metadataArr.push({
|
|
54840
|
+
key,
|
|
54841
|
+
value: bytesValue
|
|
54842
|
+
});
|
|
54843
|
+
}
|
|
54844
|
+
}
|
|
54845
|
+
const metadata = metadataArr.length ? this.packMetadatas(metadataArr) : '0x';
|
|
54846
|
+
return { requestID, zkProofEncoded, metadata };
|
|
53762
54847
|
}
|
|
53763
54848
|
static packCrossChainProofs(gistUpdateArr, stateUpdateArr) {
|
|
53764
54849
|
const proofs = [];
|
|
@@ -58325,127 +59410,6 @@ class CredentialStatusResolverRegistry {
|
|
|
58325
59410
|
}
|
|
58326
59411
|
}
|
|
58327
59412
|
|
|
58328
|
-
const IDEN3_PROTOCOL = 'https://iden3-communication.io/';
|
|
58329
|
-
const DIDCOMM_PROTOCOL = 'https://didcomm.org/';
|
|
58330
|
-
/**
|
|
58331
|
-
* Constants for Iden3 protocol
|
|
58332
|
-
*/
|
|
58333
|
-
const PROTOCOL_MESSAGE_TYPE = Object.freeze({
|
|
58334
|
-
// AuthorizationV2RequestMessageType defines auth request type of the communication protocol
|
|
58335
|
-
AUTHORIZATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/request`,
|
|
58336
|
-
// AuthorizationResponseMessageType defines auth response type of the communication protocol
|
|
58337
|
-
AUTHORIZATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}authorization/1.0/response`,
|
|
58338
|
-
// CredentialIssuanceRequestMessageType accepts request for credential creation
|
|
58339
|
-
CREDENTIAL_ISSUANCE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-request`,
|
|
58340
|
-
// CredentialFetchRequestMessageType is type for request of credential generation
|
|
58341
|
-
CREDENTIAL_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/fetch-request`,
|
|
58342
|
-
// CredentialOfferMessageType is type of message with credential offering
|
|
58343
|
-
CREDENTIAL_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/offer`,
|
|
58344
|
-
// CredentialIssuanceResponseMessageType is type for message with a credential issuance
|
|
58345
|
-
CREDENTIAL_ISSUANCE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/issuance-response`,
|
|
58346
|
-
// CredentialRefreshMessageType is type for message with a credential issuance
|
|
58347
|
-
CREDENTIAL_REFRESH_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/refresh`,
|
|
58348
|
-
// DeviceRegistrationRequestMessageType defines device registration request type of the communication protocol
|
|
58349
|
-
DEVICE_REGISTRATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}devices/1.0/registration`,
|
|
58350
|
-
// MessageFetMessageFetchRequestMessageType defines message fetch request type of the communication protocol.
|
|
58351
|
-
MESSAGE_FETCH_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}messages/1.0/fetch`,
|
|
58352
|
-
// ProofGenerationRequestMessageType is type for request of proof generation
|
|
58353
|
-
PROOF_GENERATION_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/request`,
|
|
58354
|
-
// ProofGenerationResponseMessageType is type for response of proof generation
|
|
58355
|
-
PROOF_GENERATION_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/response`,
|
|
58356
|
-
// RevocationStatusRequestMessageType is type for request of revocation status
|
|
58357
|
-
REVOCATION_STATUS_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/request-status`,
|
|
58358
|
-
// RevocationStatusResponseMessageType is type for response with a revocation status
|
|
58359
|
-
REVOCATION_STATUS_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}revocation/1.0/status`,
|
|
58360
|
-
// ContractInvokeRequestMessageType is type for request of contract invoke request
|
|
58361
|
-
CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-request`,
|
|
58362
|
-
// ContractInvokeResponseMessageType is type for response of contract invoke request
|
|
58363
|
-
CONTRACT_INVOKE_RESPONSE_MESSAGE_TYPE: `${IDEN3_PROTOCOL}proofs/1.0/contract-invoke-response`,
|
|
58364
|
-
// CredentialOnchainOfferMessageType is type of message with credential onchain offering
|
|
58365
|
-
CREDENTIAL_ONCHAIN_OFFER_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/1.0/onchain-offer`,
|
|
58366
|
-
// ProposalRequestMessageType is type for proposal-request message
|
|
58367
|
-
PROPOSAL_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal-request`,
|
|
58368
|
-
// ProposalMessageType is type for proposal message
|
|
58369
|
-
PROPOSAL_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/proposal`,
|
|
58370
|
-
// PaymentRequestMessageType is type for payment-request message
|
|
58371
|
-
PAYMENT_REQUEST_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment-request`,
|
|
58372
|
-
// PaymentMessageType is type for payment message
|
|
58373
|
-
PAYMENT_MESSAGE_TYPE: `${IDEN3_PROTOCOL}credentials/0.1/payment`,
|
|
58374
|
-
// DiscoveryProtocolQueriesMessageType is type for didcomm discovery protocol queries
|
|
58375
|
-
DISCOVERY_PROTOCOL_QUERIES_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/queries`,
|
|
58376
|
-
// DiscoveryProtocolDiscloseMessageType is type for didcomm discovery protocol disclose
|
|
58377
|
-
DISCOVERY_PROTOCOL_DISCLOSE_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/disclose`
|
|
58378
|
-
});
|
|
58379
|
-
/**
|
|
58380
|
-
* Media types for iden3 comm communication protocol
|
|
58381
|
-
*
|
|
58382
|
-
* @enum {number}
|
|
58383
|
-
*/
|
|
58384
|
-
var MediaType;
|
|
58385
|
-
(function (MediaType) {
|
|
58386
|
-
MediaType["ZKPMessage"] = "application/iden3-zkp-json";
|
|
58387
|
-
MediaType["PlainMessage"] = "application/iden3comm-plain-json";
|
|
58388
|
-
MediaType["SignedMessage"] = "application/iden3comm-signed-json";
|
|
58389
|
-
})(MediaType || (MediaType = {}));
|
|
58390
|
-
const SUPPORTED_PUBLIC_KEY_TYPES = {
|
|
58391
|
-
ES256K: [
|
|
58392
|
-
'EcdsaSecp256k1VerificationKey2019',
|
|
58393
|
-
/**
|
|
58394
|
-
* Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
|
|
58395
|
-
*/
|
|
58396
|
-
'EcdsaSecp256k1RecoveryMethod2020',
|
|
58397
|
-
'JsonWebKey2020'
|
|
58398
|
-
],
|
|
58399
|
-
'ES256K-R': [
|
|
58400
|
-
'EcdsaSecp256k1VerificationKey2019',
|
|
58401
|
-
/**
|
|
58402
|
-
* Equivalent to EcdsaSecp256k1VerificationKey2019 when key is an ethereumAddress
|
|
58403
|
-
*/
|
|
58404
|
-
'EcdsaSecp256k1RecoveryMethod2020',
|
|
58405
|
-
'JsonWebKey2020'
|
|
58406
|
-
]
|
|
58407
|
-
};
|
|
58408
|
-
var ProtocolVersion;
|
|
58409
|
-
(function (ProtocolVersion) {
|
|
58410
|
-
ProtocolVersion["V1"] = "iden3comm/v1";
|
|
58411
|
-
})(ProtocolVersion || (ProtocolVersion = {}));
|
|
58412
|
-
var AcceptAuthCircuits;
|
|
58413
|
-
(function (AcceptAuthCircuits) {
|
|
58414
|
-
AcceptAuthCircuits["AuthV2"] = "authV2";
|
|
58415
|
-
AcceptAuthCircuits["AuthV3"] = "authV3";
|
|
58416
|
-
})(AcceptAuthCircuits || (AcceptAuthCircuits = {}));
|
|
58417
|
-
var AcceptJwzAlgorithms;
|
|
58418
|
-
(function (AcceptJwzAlgorithms) {
|
|
58419
|
-
AcceptJwzAlgorithms["Groth16"] = "groth16";
|
|
58420
|
-
})(AcceptJwzAlgorithms || (AcceptJwzAlgorithms = {}));
|
|
58421
|
-
var AcceptJwsAlgorithms;
|
|
58422
|
-
(function (AcceptJwsAlgorithms) {
|
|
58423
|
-
AcceptJwsAlgorithms["ES256K"] = "ES256K";
|
|
58424
|
-
AcceptJwsAlgorithms["ES256KR"] = "ES256K-R";
|
|
58425
|
-
})(AcceptJwsAlgorithms || (AcceptJwsAlgorithms = {}));
|
|
58426
|
-
const defaultAcceptProfile = {
|
|
58427
|
-
protocolVersion: ProtocolVersion.V1,
|
|
58428
|
-
env: MediaType.ZKPMessage,
|
|
58429
|
-
circuits: [AcceptAuthCircuits.AuthV2],
|
|
58430
|
-
alg: [AcceptJwzAlgorithms.Groth16]
|
|
58431
|
-
};
|
|
58432
|
-
const DEFAULT_PROOF_VERIFY_DELAY = 1 * 60 * 60 * 1000; // 1 hour
|
|
58433
|
-
const DEFAULT_AUTH_VERIFY_DELAY = 5 * 60 * 1000; // 5 minutes
|
|
58434
|
-
|
|
58435
|
-
var constants = /*#__PURE__*/Object.freeze({
|
|
58436
|
-
__proto__: null,
|
|
58437
|
-
get AcceptAuthCircuits () { return AcceptAuthCircuits; },
|
|
58438
|
-
get AcceptJwsAlgorithms () { return AcceptJwsAlgorithms; },
|
|
58439
|
-
get AcceptJwzAlgorithms () { return AcceptJwzAlgorithms; },
|
|
58440
|
-
DEFAULT_AUTH_VERIFY_DELAY: DEFAULT_AUTH_VERIFY_DELAY,
|
|
58441
|
-
DEFAULT_PROOF_VERIFY_DELAY: DEFAULT_PROOF_VERIFY_DELAY,
|
|
58442
|
-
get MediaType () { return MediaType; },
|
|
58443
|
-
PROTOCOL_MESSAGE_TYPE: PROTOCOL_MESSAGE_TYPE,
|
|
58444
|
-
get ProtocolVersion () { return ProtocolVersion; },
|
|
58445
|
-
SUPPORTED_PUBLIC_KEY_TYPES: SUPPORTED_PUBLIC_KEY_TYPES,
|
|
58446
|
-
defaultAcceptProfile: defaultAcceptProfile
|
|
58447
|
-
});
|
|
58448
|
-
|
|
58449
59413
|
/**
|
|
58450
59414
|
* AgentResolver is a class that allows to interact with the issuer's agent to get revocation status.
|
|
58451
59415
|
*
|
|
@@ -59410,100 +60374,6 @@ class NativeProver {
|
|
|
59410
60374
|
}
|
|
59411
60375
|
NativeProver.curveName = 'bn128';
|
|
59412
60376
|
|
|
59413
|
-
/**
|
|
59414
|
-
* creates empty basic message
|
|
59415
|
-
*
|
|
59416
|
-
* @returns BasicMessage
|
|
59417
|
-
*/
|
|
59418
|
-
const basicMessageFactory = () => {
|
|
59419
|
-
return {
|
|
59420
|
-
id: '',
|
|
59421
|
-
typ: '',
|
|
59422
|
-
thid: '',
|
|
59423
|
-
type: '',
|
|
59424
|
-
body: {},
|
|
59425
|
-
from: '',
|
|
59426
|
-
to: ''
|
|
59427
|
-
};
|
|
59428
|
-
};
|
|
59429
|
-
/**
|
|
59430
|
-
* create empty header stub
|
|
59431
|
-
*
|
|
59432
|
-
* @returns {HeaderStub}
|
|
59433
|
-
*/
|
|
59434
|
-
const headerStubFactory = () => {
|
|
59435
|
-
return {
|
|
59436
|
-
typ: ''
|
|
59437
|
-
};
|
|
59438
|
-
};
|
|
59439
|
-
|
|
59440
|
-
// Envelope Errors
|
|
59441
|
-
// Token Errors
|
|
59442
|
-
const ErrUnknownCircuitID = "unknown circuit ID. can't verify msg sender";
|
|
59443
|
-
const ErrSenderNotUsedTokenCreation = 'sender of message is not used for jwz token creation';
|
|
59444
|
-
// ZKP-Packer Errors
|
|
59445
|
-
const ErrPackedWithUnsupportedCircuit = 'message was packed with unsupported circuit';
|
|
59446
|
-
const ErrProofIsInvalid = 'message proof is invalid';
|
|
59447
|
-
const ErrStateVerificationFailed = 'message state verification failed';
|
|
59448
|
-
const ErrNoProvingMethodAlg = 'unknown proving method algorithm';
|
|
59449
|
-
|
|
59450
|
-
const objectIs = (obj, //eslint-disable-line @typescript-eslint/no-explicit-any
|
|
59451
|
-
targetObj //eslint-disable-line @typescript-eslint/no-explicit-any
|
|
59452
|
-
) => {
|
|
59453
|
-
Object.keys(targetObj).forEach((prop) => {
|
|
59454
|
-
if (!obj[prop]) {
|
|
59455
|
-
return false;
|
|
59456
|
-
}
|
|
59457
|
-
if (typeof targetObj[prop] !== typeof obj[prop]) {
|
|
59458
|
-
return false;
|
|
59459
|
-
}
|
|
59460
|
-
});
|
|
59461
|
-
return true;
|
|
59462
|
-
};
|
|
59463
|
-
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59464
|
-
const isProtocolMessage = (message) => {
|
|
59465
|
-
const basicMessage = basicMessageFactory();
|
|
59466
|
-
Object.keys(basicMessage).forEach((prop) => {
|
|
59467
|
-
if (!message[prop]) {
|
|
59468
|
-
return false;
|
|
59469
|
-
}
|
|
59470
|
-
if (prop !== 'body') {
|
|
59471
|
-
const res = typeof basicMessage[prop] ===
|
|
59472
|
-
typeof message[prop]; //eslint-disable-line @typescript-eslint/no-explicit-any
|
|
59473
|
-
if (!res) {
|
|
59474
|
-
return false;
|
|
59475
|
-
}
|
|
59476
|
-
}
|
|
59477
|
-
});
|
|
59478
|
-
return true;
|
|
59479
|
-
};
|
|
59480
|
-
/**
|
|
59481
|
-
* helper function to convert serialized JSON bytes to protocol message
|
|
59482
|
-
*
|
|
59483
|
-
* @param {Uint8Array} bytes
|
|
59484
|
-
* @returns {BasicMessage}
|
|
59485
|
-
*/
|
|
59486
|
-
const bytesToProtocolMessage = (bytes) => {
|
|
59487
|
-
const str = byteDecoder.decode(bytes);
|
|
59488
|
-
const message = JSON.parse(str);
|
|
59489
|
-
if (!isProtocolMessage(message)) ;
|
|
59490
|
-
return message;
|
|
59491
|
-
};
|
|
59492
|
-
/**
|
|
59493
|
-
* helper function to convert serialized JSON bytes to header stub
|
|
59494
|
-
* so we can work with know the media type of the message
|
|
59495
|
-
*
|
|
59496
|
-
* @param {Uint8Array} envelope
|
|
59497
|
-
* @returns {HeaderStub}
|
|
59498
|
-
*/
|
|
59499
|
-
const bytesToHeaderStub = (envelope) => {
|
|
59500
|
-
const tmpObj = headerStubFactory();
|
|
59501
|
-
const str = byteDecoder.decode(envelope);
|
|
59502
|
-
const message = JSON.parse(str);
|
|
59503
|
-
if (!objectIs(message, tmpObj)) ;
|
|
59504
|
-
return message;
|
|
59505
|
-
};
|
|
59506
|
-
|
|
59507
60377
|
/**
|
|
59508
60378
|
* Basic package manager for iden3 communication protocol
|
|
59509
60379
|
*
|
|
@@ -59614,164 +60484,6 @@ class PackageManager {
|
|
|
59614
60484
|
}
|
|
59615
60485
|
}
|
|
59616
60486
|
|
|
59617
|
-
const DIDAuthenticationSection = 'authentication';
|
|
59618
|
-
const resolveVerificationMethods = (didDocument) => {
|
|
59619
|
-
const vms = didDocument.verificationMethod || [];
|
|
59620
|
-
// prioritize: first verification methods to be chosen are from `authentication` section.
|
|
59621
|
-
const sortedVerificationMethods = (didDocument[DIDAuthenticationSection] || [])
|
|
59622
|
-
.map((verificationMethod) => {
|
|
59623
|
-
if (typeof verificationMethod === 'string') {
|
|
59624
|
-
return vms.find((i) => i.id === verificationMethod);
|
|
59625
|
-
}
|
|
59626
|
-
return verificationMethod;
|
|
59627
|
-
})
|
|
59628
|
-
.filter((key) => key);
|
|
59629
|
-
// add all other verification methods
|
|
59630
|
-
for (let index = 0; index < vms.length; index++) {
|
|
59631
|
-
const id = vms[index].id;
|
|
59632
|
-
if (sortedVerificationMethods.findIndex((vm) => vm.id === id) === -1) {
|
|
59633
|
-
sortedVerificationMethods.push(vms[index]);
|
|
59634
|
-
}
|
|
59635
|
-
}
|
|
59636
|
-
return sortedVerificationMethods;
|
|
59637
|
-
};
|
|
59638
|
-
const extractPublicKeyBytes = (vm) => {
|
|
59639
|
-
const isSupportedVmType = Object.keys(SUPPORTED_PUBLIC_KEY_TYPES).some((key) => SUPPORTED_PUBLIC_KEY_TYPES[key].includes(vm.type));
|
|
59640
|
-
if (vm.publicKeyBase58 && isSupportedVmType) {
|
|
59641
|
-
return { publicKeyBytes: base58ToBytes$1(vm.publicKeyBase58), kmsKeyType: KmsKeyType.Secp256k1 };
|
|
59642
|
-
}
|
|
59643
|
-
if (vm.publicKeyBase64 && isSupportedVmType) {
|
|
59644
|
-
return {
|
|
59645
|
-
publicKeyBytes: base64UrlToBytes(vm.publicKeyBase64),
|
|
59646
|
-
kmsKeyType: KmsKeyType.Secp256k1
|
|
59647
|
-
};
|
|
59648
|
-
}
|
|
59649
|
-
if (vm.publicKeyHex && isSupportedVmType) {
|
|
59650
|
-
return { publicKeyBytes: hexToBytes$3(vm.publicKeyHex), kmsKeyType: KmsKeyType.Secp256k1 };
|
|
59651
|
-
}
|
|
59652
|
-
if (vm.publicKeyJwk &&
|
|
59653
|
-
vm.publicKeyJwk.crv === 'secp256k1' &&
|
|
59654
|
-
vm.publicKeyJwk.x &&
|
|
59655
|
-
vm.publicKeyJwk.y) {
|
|
59656
|
-
const [xHex, yHex] = [
|
|
59657
|
-
base64UrlToBytes(vm.publicKeyJwk.x),
|
|
59658
|
-
base64UrlToBytes(vm.publicKeyJwk.y)
|
|
59659
|
-
].map(bytesToHex$3);
|
|
59660
|
-
const x = xHex.includes('0x') ? BigInt(xHex) : BigInt(`0x${xHex}`);
|
|
59661
|
-
const y = yHex.includes('0x') ? BigInt(yHex) : BigInt(`0x${yHex}`);
|
|
59662
|
-
return {
|
|
59663
|
-
publicKeyBytes: secp256k1$1.ProjectivePoint.fromAffine({
|
|
59664
|
-
x,
|
|
59665
|
-
y
|
|
59666
|
-
}).toRawBytes(false),
|
|
59667
|
-
kmsKeyType: KmsKeyType.Secp256k1
|
|
59668
|
-
};
|
|
59669
|
-
}
|
|
59670
|
-
return { publicKeyBytes: null };
|
|
59671
|
-
};
|
|
59672
|
-
|
|
59673
|
-
function isProtocolVersion(value) {
|
|
59674
|
-
return Object.values(ProtocolVersion).includes(value);
|
|
59675
|
-
}
|
|
59676
|
-
function isMediaType(value) {
|
|
59677
|
-
return Object.values(MediaType).includes(value);
|
|
59678
|
-
}
|
|
59679
|
-
function isAcceptAuthCircuits(value) {
|
|
59680
|
-
return Object.values(AcceptAuthCircuits).includes(value);
|
|
59681
|
-
}
|
|
59682
|
-
function isAcceptJwsAlgorithms(value) {
|
|
59683
|
-
return Object.values(AcceptJwsAlgorithms).includes(value);
|
|
59684
|
-
}
|
|
59685
|
-
function isAcceptJwzAlgorithms(value) {
|
|
59686
|
-
return Object.values(AcceptJwzAlgorithms).includes(value);
|
|
59687
|
-
}
|
|
59688
|
-
const buildAccept = (profiles) => {
|
|
59689
|
-
const result = [];
|
|
59690
|
-
for (const profile of profiles) {
|
|
59691
|
-
let accept = `${profile.protocolVersion};env=${profile.env}`;
|
|
59692
|
-
if (profile.circuits?.length) {
|
|
59693
|
-
accept += `;circuitId=${profile.circuits.join(',')}`;
|
|
59694
|
-
}
|
|
59695
|
-
if (profile.alg?.length) {
|
|
59696
|
-
accept += `;alg=${profile.alg.join(',')}`;
|
|
59697
|
-
}
|
|
59698
|
-
result.push(accept);
|
|
59699
|
-
}
|
|
59700
|
-
return result;
|
|
59701
|
-
};
|
|
59702
|
-
const parseAcceptProfile = (profile) => {
|
|
59703
|
-
const params = profile.split(';');
|
|
59704
|
-
if (params.length < 2) {
|
|
59705
|
-
throw new Error('Invalid accept profile');
|
|
59706
|
-
}
|
|
59707
|
-
const protocolVersion = params[0].trim();
|
|
59708
|
-
if (!isProtocolVersion(protocolVersion)) {
|
|
59709
|
-
throw new Error(`Protocol version '${protocolVersion}' not supported`);
|
|
59710
|
-
}
|
|
59711
|
-
const envParam = params[1].split('=');
|
|
59712
|
-
if (envParam.length !== 2) {
|
|
59713
|
-
throw new Error(`Invalid accept profile 'env' parameter`);
|
|
59714
|
-
}
|
|
59715
|
-
const env = params[1].split('=')[1].trim();
|
|
59716
|
-
if (!isMediaType(env)) {
|
|
59717
|
-
throw new Error(`Envelop '${env}' not supported`);
|
|
59718
|
-
}
|
|
59719
|
-
const circuitsIndex = params.findIndex((i) => i.includes('circuitId='));
|
|
59720
|
-
if (env !== MediaType.ZKPMessage && circuitsIndex > 0) {
|
|
59721
|
-
throw new Error(`Circuits not supported for env '${env}'`);
|
|
59722
|
-
}
|
|
59723
|
-
let circuits = undefined;
|
|
59724
|
-
if (circuitsIndex > 0) {
|
|
59725
|
-
circuits = params[circuitsIndex]
|
|
59726
|
-
.split('=')[1]
|
|
59727
|
-
.split(',')
|
|
59728
|
-
.map((i) => i.trim())
|
|
59729
|
-
.map((i) => {
|
|
59730
|
-
if (!isAcceptAuthCircuits(i)) {
|
|
59731
|
-
throw new Error(`Circuit '${i}' not supported`);
|
|
59732
|
-
}
|
|
59733
|
-
return i;
|
|
59734
|
-
});
|
|
59735
|
-
}
|
|
59736
|
-
const algIndex = params.findIndex((i) => i.includes('alg='));
|
|
59737
|
-
let alg = undefined;
|
|
59738
|
-
if (algIndex > 0) {
|
|
59739
|
-
if (env === MediaType.ZKPMessage) {
|
|
59740
|
-
alg = params[algIndex]
|
|
59741
|
-
.split('=')[1]
|
|
59742
|
-
.split(',')
|
|
59743
|
-
.map((i) => {
|
|
59744
|
-
i = i.trim();
|
|
59745
|
-
if (!isAcceptJwzAlgorithms(i)) {
|
|
59746
|
-
throw new Error(`Algorithm '${i}' not supported for '${env}'`);
|
|
59747
|
-
}
|
|
59748
|
-
return i;
|
|
59749
|
-
});
|
|
59750
|
-
}
|
|
59751
|
-
else if (env === MediaType.SignedMessage) {
|
|
59752
|
-
alg = params[algIndex]
|
|
59753
|
-
.split('=')[1]
|
|
59754
|
-
.split(',')
|
|
59755
|
-
.map((i) => {
|
|
59756
|
-
i = i.trim();
|
|
59757
|
-
if (!isAcceptJwsAlgorithms(i)) {
|
|
59758
|
-
throw new Error(`Algorithm '${i}' not supported for '${env}'`);
|
|
59759
|
-
}
|
|
59760
|
-
return i;
|
|
59761
|
-
});
|
|
59762
|
-
}
|
|
59763
|
-
else {
|
|
59764
|
-
throw new Error(`Algorithm not supported for '${env}'`);
|
|
59765
|
-
}
|
|
59766
|
-
}
|
|
59767
|
-
return {
|
|
59768
|
-
protocolVersion,
|
|
59769
|
-
env,
|
|
59770
|
-
circuits,
|
|
59771
|
-
alg
|
|
59772
|
-
};
|
|
59773
|
-
};
|
|
59774
|
-
|
|
59775
60487
|
const { getProvingMethod } = proving;
|
|
59776
60488
|
/**
|
|
59777
60489
|
* Handler to
|
|
@@ -60198,6 +60910,12 @@ var CredentialOfferStatus;
|
|
|
60198
60910
|
CredentialOfferStatus["Rejected"] = "rejected";
|
|
60199
60911
|
})(CredentialOfferStatus || (CredentialOfferStatus = {}));
|
|
60200
60912
|
|
|
60913
|
+
var AuthMethod;
|
|
60914
|
+
(function (AuthMethod) {
|
|
60915
|
+
AuthMethod["AUTHV2"] = "authV2";
|
|
60916
|
+
AuthMethod["ETH_IDENTITY"] = "ethIdentity";
|
|
60917
|
+
})(AuthMethod || (AuthMethod = {}));
|
|
60918
|
+
|
|
60201
60919
|
/** @beta DiscoverFeatureQueryType is enum for query type fields */
|
|
60202
60920
|
var DiscoverFeatureQueryType;
|
|
60203
60921
|
(function (DiscoverFeatureQueryType) {
|
|
@@ -60291,6 +61009,59 @@ const processZeroKnowledgeProofRequests = async (to, requests, from, proofServic
|
|
|
60291
61009
|
}
|
|
60292
61010
|
return zkpResponses;
|
|
60293
61011
|
};
|
|
61012
|
+
/**
|
|
61013
|
+
* Processes auth proof requests.
|
|
61014
|
+
*
|
|
61015
|
+
* @param to - The identifier of the recipient.
|
|
61016
|
+
* @param proofService - The proof service.
|
|
61017
|
+
* @param opts - Additional options for processing the requests.
|
|
61018
|
+
* @returns A promise that resolves to an auth proof response.
|
|
61019
|
+
*/
|
|
61020
|
+
const processProofAuth = async (to, proofService, opts) => {
|
|
61021
|
+
if (!opts.acceptProfile) {
|
|
61022
|
+
opts.acceptProfile = defaultAcceptProfile;
|
|
61023
|
+
}
|
|
61024
|
+
if (!opts.skipRevocation) {
|
|
61025
|
+
opts.skipRevocation = true;
|
|
61026
|
+
}
|
|
61027
|
+
switch (opts.acceptProfile.env) {
|
|
61028
|
+
case MediaType.ZKPMessage:
|
|
61029
|
+
if (!opts.acceptProfile.circuits) {
|
|
61030
|
+
throw new Error('Circuit not specified in accept profile');
|
|
61031
|
+
}
|
|
61032
|
+
for (const circuitId of opts.acceptProfile.circuits) {
|
|
61033
|
+
if (!opts.supportedCircuits.includes(circuitId)) {
|
|
61034
|
+
throw new Error(`Circuit ${circuitId} is not supported`);
|
|
61035
|
+
}
|
|
61036
|
+
const zkpRes = await proofService.generateAuthProof(circuitId, to, { challenge: opts.challenge, skipRevocation: opts.skipRevocation });
|
|
61037
|
+
switch (circuitId) {
|
|
61038
|
+
case CircuitId.AuthV2: {
|
|
61039
|
+
const preparedZkpProof = prepareZkpProof(zkpRes.proof);
|
|
61040
|
+
const zkProofEncoded = packZkpProof(zkpRes.pub_signals, preparedZkpProof.a, preparedZkpProof.b, preparedZkpProof.c);
|
|
61041
|
+
return {
|
|
61042
|
+
authMethod: AuthMethod.AUTHV2,
|
|
61043
|
+
proof: zkProofEncoded
|
|
61044
|
+
};
|
|
61045
|
+
}
|
|
61046
|
+
}
|
|
61047
|
+
}
|
|
61048
|
+
throw new Error(`Auth method is not supported`);
|
|
61049
|
+
case MediaType.SignedMessage:
|
|
61050
|
+
if (!opts.acceptProfile.alg || opts.acceptProfile.alg.length === 0) {
|
|
61051
|
+
throw new Error('Algorithm not specified');
|
|
61052
|
+
}
|
|
61053
|
+
if (opts.acceptProfile.alg[0] === AcceptJwsAlgorithms.ES256KR) {
|
|
61054
|
+
const ethIdProof = packEthIdentityProof(to);
|
|
61055
|
+
return {
|
|
61056
|
+
authMethod: AuthMethod.ETH_IDENTITY,
|
|
61057
|
+
proof: ethIdProof
|
|
61058
|
+
};
|
|
61059
|
+
}
|
|
61060
|
+
throw new Error(`Algorithm ${opts.acceptProfile.alg[0]} not supported`);
|
|
61061
|
+
default:
|
|
61062
|
+
throw new Error('Accept env not supported');
|
|
61063
|
+
}
|
|
61064
|
+
};
|
|
60294
61065
|
/**
|
|
60295
61066
|
* Verifies that the expires_time field of a message is not in the past. Throws an error if it is.
|
|
60296
61067
|
*
|
|
@@ -60301,6 +61072,9 @@ const verifyExpiresTime = (message) => {
|
|
|
60301
61072
|
throw new Error('Message expired');
|
|
60302
61073
|
}
|
|
60303
61074
|
};
|
|
61075
|
+
const packEthIdentityProof = (did) => {
|
|
61076
|
+
return `0x${bytesToHex$3(BytesHelper.intToBytes(DID.idFromDID(did).bigInt()))}`;
|
|
61077
|
+
};
|
|
60304
61078
|
|
|
60305
61079
|
/**
|
|
60306
61080
|
* Base implementation of protocol message handler
|
|
@@ -60933,6 +61707,7 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
60933
61707
|
* @param {IPackageManager} _packerMgr - package manager to unpack message envelope
|
|
60934
61708
|
* @param {IProofService} _proofService - proof service to verify zk proofs
|
|
60935
61709
|
* @param {IOnChainZKPVerifier} _zkpVerifier - zkp verifier to submit response
|
|
61710
|
+
* @param {IOnChainVerifierMultiQuery} _verifierMultiQuery - verifier multi-query to submit response
|
|
60936
61711
|
*
|
|
60937
61712
|
*/
|
|
60938
61713
|
constructor(_packerMgr, _proofService, _zkpVerifier) {
|
|
@@ -60944,7 +61719,12 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
60944
61719
|
CircuitId.AuthV2,
|
|
60945
61720
|
CircuitId.AtomicQueryMTPV2OnChain,
|
|
60946
61721
|
CircuitId.AtomicQuerySigV2OnChain,
|
|
60947
|
-
CircuitId.AtomicQueryV3OnChain
|
|
61722
|
+
CircuitId.AtomicQueryV3OnChain,
|
|
61723
|
+
// Now we support off-chain circuits on-chain
|
|
61724
|
+
// TODO: We need to create validators for them
|
|
61725
|
+
CircuitId.AuthV2,
|
|
61726
|
+
CircuitId.AtomicQueryV3,
|
|
61727
|
+
CircuitId.LinkedMultiQuery10
|
|
60948
61728
|
];
|
|
60949
61729
|
}
|
|
60950
61730
|
async handle(message, ctx) {
|
|
@@ -60980,19 +61760,64 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
60980
61760
|
});
|
|
60981
61761
|
const methodId = message.body.transaction_data.method_id.replace('0x', '');
|
|
60982
61762
|
switch (methodId) {
|
|
60983
|
-
case FunctionSignatures.SubmitZKPResponseV2:
|
|
60984
|
-
|
|
61763
|
+
case FunctionSignatures.SubmitZKPResponseV2: {
|
|
61764
|
+
const txHashZkpResponsesMap = await this._zkpVerifier.submitZKPResponseV2(ethSigner, message.body.transaction_data, zkpResponses);
|
|
61765
|
+
const response = new Map();
|
|
61766
|
+
for (const [txHash, zkpResponses] of txHashZkpResponsesMap) {
|
|
61767
|
+
response.set(txHash, { responses: zkpResponses });
|
|
61768
|
+
}
|
|
61769
|
+
return response;
|
|
61770
|
+
}
|
|
60985
61771
|
case FunctionSignatures.SubmitZKPResponseV1: {
|
|
60986
61772
|
const txHashZkpResponseMap = await this._zkpVerifier.submitZKPResponse(ethSigner, message.body.transaction_data, zkpResponses);
|
|
60987
61773
|
const response = new Map();
|
|
60988
61774
|
for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
|
|
60989
|
-
response.set(txHash, [zkpResponse]);
|
|
61775
|
+
response.set(txHash, { responses: [zkpResponse] });
|
|
60990
61776
|
}
|
|
60991
61777
|
return response;
|
|
60992
61778
|
}
|
|
61779
|
+
case FunctionSignatures.SubmitResponse: {
|
|
61780
|
+
// We need to
|
|
61781
|
+
// 1. Generate auth proof from message.body.accept -> authResponse
|
|
61782
|
+
// 2. Generate proofs for each query in scope -> zkpResponses
|
|
61783
|
+
// Build auth response from accept
|
|
61784
|
+
if (!message.to) {
|
|
61785
|
+
throw new Error(`failed message. empty 'to' field`);
|
|
61786
|
+
}
|
|
61787
|
+
// Get first supported accept profile and pass it to processProofAuth
|
|
61788
|
+
const acceptProfile = this.getFirstSupportedProfile(PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE, message.body.accept);
|
|
61789
|
+
const identifier = DID.parse(message.to);
|
|
61790
|
+
const authResponse = await processProofAuth(identifier, this._proofService, {
|
|
61791
|
+
supportedCircuits: this._supportedCircuits,
|
|
61792
|
+
acceptProfile,
|
|
61793
|
+
challenge: challenge,
|
|
61794
|
+
skipRevocation: true
|
|
61795
|
+
});
|
|
61796
|
+
return this._zkpVerifier.submitResponse(ethSigner, message.body.transaction_data, authResponse, zkpResponses);
|
|
61797
|
+
}
|
|
60993
61798
|
default:
|
|
60994
|
-
throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1} and ${FunctionSignatures.
|
|
61799
|
+
throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1}, ${FunctionSignatures.SubmitZKPResponseV2} and ${FunctionSignatures.SubmitResponse} are supported.'`);
|
|
61800
|
+
}
|
|
61801
|
+
}
|
|
61802
|
+
getFirstSupportedProfile(responseType, profile) {
|
|
61803
|
+
if (profile?.length) {
|
|
61804
|
+
for (const acceptProfileString of profile) {
|
|
61805
|
+
// 1. check protocol version
|
|
61806
|
+
const acceptProfile = parseAcceptProfile(acceptProfileString);
|
|
61807
|
+
const responseTypeVersion = Number(responseType.split('/').at(-2));
|
|
61808
|
+
if (acceptProfile.protocolVersion !== ProtocolVersion.V1 ||
|
|
61809
|
+
(acceptProfile.protocolVersion === ProtocolVersion.V1 &&
|
|
61810
|
+
(responseTypeVersion < 1 || responseTypeVersion >= 2))) {
|
|
61811
|
+
continue;
|
|
61812
|
+
}
|
|
61813
|
+
// 2. check packer support
|
|
61814
|
+
if (this._packerMgr.isProfileSupported(acceptProfile.env, acceptProfileString)) {
|
|
61815
|
+
return acceptProfile;
|
|
61816
|
+
}
|
|
61817
|
+
}
|
|
60995
61818
|
}
|
|
61819
|
+
// if we don't have supported profiles, we use default
|
|
61820
|
+
return defaultAcceptProfile;
|
|
60996
61821
|
}
|
|
60997
61822
|
/**
|
|
60998
61823
|
* unpacks contract-invoke request
|
|
@@ -61014,7 +61839,7 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
61014
61839
|
* @private
|
|
61015
61840
|
* @beta
|
|
61016
61841
|
* @param {ContractInvokeRequest} request - ContractInvokeRequest
|
|
61017
|
-
* @param { Map<string,
|
|
61842
|
+
* @param { Map<string, ZeroKnowledgeInvokeResponse>} responses - map tx hash to array of ZeroKnowledgeInvokeResponse
|
|
61018
61843
|
* @returns `Promise<ContractInvokeResponse>`
|
|
61019
61844
|
*/
|
|
61020
61845
|
async createContractInvokeResponse(request, txHashToZkpResponseMap) {
|
|
@@ -61031,12 +61856,17 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
61031
61856
|
created_time: getUnixTimestamp(new Date())
|
|
61032
61857
|
};
|
|
61033
61858
|
for (const [txHash, zkpResponses] of txHashToZkpResponseMap) {
|
|
61034
|
-
for (const zkpResponse of zkpResponses) {
|
|
61859
|
+
for (const zkpResponse of zkpResponses.responses) {
|
|
61035
61860
|
contractInvokeResponse.body.scope.push({
|
|
61036
61861
|
txHash,
|
|
61037
61862
|
...zkpResponse
|
|
61038
61863
|
});
|
|
61039
61864
|
}
|
|
61865
|
+
contractInvokeResponse.body = {
|
|
61866
|
+
...contractInvokeResponse.body,
|
|
61867
|
+
crossChainProofs: zkpResponses.crossChainProofs ?? [],
|
|
61868
|
+
authProofs: zkpResponses.authProofs ?? []
|
|
61869
|
+
};
|
|
61040
61870
|
}
|
|
61041
61871
|
return contractInvokeResponse;
|
|
61042
61872
|
}
|
|
@@ -62045,6 +62875,33 @@ class DiscoveryProtocolHandler extends AbstractMessageHandler {
|
|
|
62045
62875
|
}
|
|
62046
62876
|
}
|
|
62047
62877
|
|
|
62878
|
+
/**
|
|
62879
|
+
* @beta
|
|
62880
|
+
* createProblemReportMessage is a function to create didcomm protocol problem report message
|
|
62881
|
+
* @param pthid - parent thread id
|
|
62882
|
+
* @param code - problem report code
|
|
62883
|
+
* @param opts - problem report options
|
|
62884
|
+
* @returns `ProblemReportMessage`
|
|
62885
|
+
*/
|
|
62886
|
+
function createProblemReportMessage(pthid, code, opts) {
|
|
62887
|
+
const uuidv4 = v4();
|
|
62888
|
+
return {
|
|
62889
|
+
id: uuidv4,
|
|
62890
|
+
pthid: pthid,
|
|
62891
|
+
typ: MediaType.PlainMessage,
|
|
62892
|
+
type: PROTOCOL_MESSAGE_TYPE.PROBLEM_REPORT_MESSAGE_TYPE,
|
|
62893
|
+
ack: opts?.ack,
|
|
62894
|
+
body: {
|
|
62895
|
+
code: code,
|
|
62896
|
+
comment: opts?.comment,
|
|
62897
|
+
args: opts?.args,
|
|
62898
|
+
escalate_to: opts?.escalate_to
|
|
62899
|
+
},
|
|
62900
|
+
from: opts?.from,
|
|
62901
|
+
to: opts?.to
|
|
62902
|
+
};
|
|
62903
|
+
}
|
|
62904
|
+
|
|
62048
62905
|
const allOperations = Object.values(QueryOperators);
|
|
62049
62906
|
const v2Operations = [
|
|
62050
62907
|
Operators.NOOP,
|
|
@@ -63234,6 +64091,32 @@ class ProofService {
|
|
|
63234
64091
|
pub_signals
|
|
63235
64092
|
};
|
|
63236
64093
|
}
|
|
64094
|
+
/** {@inheritdoc IProofService.generateAuthProof} */
|
|
64095
|
+
async generateAuthProof(circuitId, identifier, opts) {
|
|
64096
|
+
if (!opts) {
|
|
64097
|
+
opts = {
|
|
64098
|
+
skipRevocation: false,
|
|
64099
|
+
challenge: 0n
|
|
64100
|
+
};
|
|
64101
|
+
}
|
|
64102
|
+
let zkProof;
|
|
64103
|
+
switch (circuitId) {
|
|
64104
|
+
case CircuitId.AuthV2:
|
|
64105
|
+
{
|
|
64106
|
+
const challenge = opts.challenge
|
|
64107
|
+
? BytesHelper.intToBytes(opts.challenge).reverse()
|
|
64108
|
+
: new Uint8Array(32);
|
|
64109
|
+
zkProof = await this.generateAuthV2Proof(challenge, identifier);
|
|
64110
|
+
}
|
|
64111
|
+
return {
|
|
64112
|
+
circuitId: circuitId,
|
|
64113
|
+
proof: zkProof.proof,
|
|
64114
|
+
pub_signals: zkProof.pub_signals
|
|
64115
|
+
};
|
|
64116
|
+
default:
|
|
64117
|
+
throw new Error(`CircuitId ${circuitId} is not supported`);
|
|
64118
|
+
}
|
|
64119
|
+
}
|
|
63237
64120
|
/** {@inheritdoc IProofService.transitState} */
|
|
63238
64121
|
async transitState(did, oldTreeState, isOldStateGenesis, stateStorage, // for compatibility with previous versions we leave this parameter
|
|
63239
64122
|
ethSigner) {
|
|
@@ -64089,5 +64972,5 @@ class IdentityWallet {
|
|
|
64089
64972
|
}
|
|
64090
64973
|
}
|
|
64091
64974
|
|
|
64092
|
-
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, DiscoverFeatureQueryType, DiscoveryProtocolFeatureType, DiscoveryProtocolHandler, 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, SupportedDataFormat, 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, createDiscoveryFeatureDiscloseMessage, createDiscoveryFeatureQueryMessage, 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 };
|
|
64975
|
+
export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthMethod, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialOfferStatus, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DIDDocumentSignature, DataPrepareHandlerFunc, DidDocumentCredentialStatusResolver, DidResolverStateReadonlyStorage, DiscoverFeatureQueryType, DiscoveryProtocolFeatureType, DiscoveryProtocolHandler, 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, SupportedDataFormat, 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, createDiscoveryFeatureDiscloseMessage, createDiscoveryFeatureQueryMessage, createPayment, createPaymentRequest, createProblemReportMessage, 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, packEthIdentityProof, parseAcceptProfile, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processProofAuth, 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 };
|
|
64093
64976
|
//# sourceMappingURL=index.js.map
|