@0xpolygonid/js-sdk 1.32.3 → 1.33.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.
Files changed (48) hide show
  1. package/dist/browser/esm/index.js +45 -12
  2. package/dist/browser/esm/index.js.map +1 -1
  3. package/dist/browser/umd/index.global.js +22 -22
  4. package/dist/browser/umd/index.global.js.map +1 -1
  5. package/dist/node/cjs/index.cjs +298 -14
  6. package/dist/node/cjs/index.cjs.map +1 -1
  7. package/dist/node/esm/index.js +45 -12
  8. package/dist/node/esm/index.js.map +1 -1
  9. package/dist/types/credentials/status/on-chain-revocation.d.ts.map +1 -1
  10. package/dist/types/credentials/status/reverse-sparse-merkle-tree.d.ts.map +1 -1
  11. package/dist/types/iden3comm/handlers/auth.d.ts +2 -1
  12. package/dist/types/iden3comm/handlers/auth.d.ts.map +1 -1
  13. package/dist/types/iden3comm/handlers/credential-proposal.d.ts +6 -3
  14. package/dist/types/iden3comm/handlers/credential-proposal.d.ts.map +1 -1
  15. package/dist/types/iden3comm/types/index.d.ts +2 -0
  16. package/dist/types/iden3comm/types/index.d.ts.map +1 -1
  17. package/dist/types/iden3comm/types/packer.d.ts +4 -1
  18. package/dist/types/iden3comm/types/packer.d.ts.map +1 -1
  19. package/dist/types/iden3comm/types/protocol/attachment.d.ts +11 -0
  20. package/dist/types/iden3comm/types/protocol/attachment.d.ts.map +1 -0
  21. package/dist/types/iden3comm/types/protocol/common.d.ts +11 -0
  22. package/dist/types/iden3comm/types/protocol/common.d.ts.map +1 -0
  23. package/dist/types/iden3comm/types/protocol/payment.d.ts +2 -4
  24. package/dist/types/iden3comm/types/protocol/payment.d.ts.map +1 -1
  25. package/dist/types/iden3comm/types/protocol/proposal-request.d.ts +4 -10
  26. package/dist/types/iden3comm/types/protocol/proposal-request.d.ts.map +1 -1
  27. package/dist/types/proof/verifiers/pub-signals-verifier.d.ts.map +1 -1
  28. package/dist/types/storage/blockchain/errors.d.ts +4 -0
  29. package/dist/types/storage/blockchain/errors.d.ts.map +1 -0
  30. package/dist/types/storage/blockchain/index.d.ts +1 -0
  31. package/dist/types/storage/blockchain/index.d.ts.map +1 -1
  32. package/dist/types/verifiable/constants.d.ts +5 -0
  33. package/dist/types/verifiable/constants.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/src/credentials/status/on-chain-revocation.ts +2 -3
  36. package/src/credentials/status/reverse-sparse-merkle-tree.ts +3 -3
  37. package/src/iden3comm/handlers/auth.ts +5 -2
  38. package/src/iden3comm/handlers/credential-proposal.ts +14 -5
  39. package/src/iden3comm/types/index.ts +2 -0
  40. package/src/iden3comm/types/packer.ts +7 -1
  41. package/src/iden3comm/types/protocol/attachment.ts +12 -0
  42. package/src/iden3comm/types/protocol/common.ts +10 -0
  43. package/src/iden3comm/types/protocol/payment.ts +2 -4
  44. package/src/iden3comm/types/protocol/proposal-request.ts +5 -8
  45. package/src/proof/verifiers/pub-signals-verifier.ts +3 -4
  46. package/src/storage/blockchain/errors.ts +46 -0
  47. package/src/storage/blockchain/index.ts +1 -0
  48. package/src/verifiable/constants.ts +6 -1
@@ -242,7 +242,10 @@ __export(index_exports, {
242
242
  isEthereumIdentity: () => isEthereumIdentity,
243
243
  isGenesisState: () => isGenesisState,
244
244
  isGenesisStateId: () => isGenesisStateId,
245
+ isIdentityDoesNotExistError: () => isIdentityDoesNotExistError,
245
246
  isIssuerGenesis: () => isIssuerGenesis,
247
+ isRootDoesNotExistError: () => isRootDoesNotExistError,
248
+ isStateDoesNotExistError: () => isStateDoesNotExistError,
246
249
  isValidOperation: () => isValidOperation,
247
250
  jsonLDMerklizer: () => jsonLDMerklizer,
248
251
  keyPath: () => keyPath,
@@ -1055,7 +1058,12 @@ var VerifiableConstants = Object.freeze({
1055
1058
  CONTEXT_TYPE_IS_EMPTY: "ctxType is empty",
1056
1059
  // ErrStateNotFound issuer state is genesis state.
1057
1060
  IDENTITY_DOES_NOT_EXIST: "Identity does not exist",
1061
+ IDENTITY_DOES_NOT_EXIST_CUSTOM_ERROR: "IdentityDoesNotExist",
1058
1062
  NO_AUTH_CRED_FOUND: "no auth credentials found",
1063
+ STATE_DOES_NOT_EXIST: "State does not exist",
1064
+ STATE_DOES_NOT_EXIST_CUSTOM_ERROR: "StateDoesNotExist",
1065
+ ROOT_DOES_NOT_EXIST: "Root does not exist",
1066
+ ROOT_DOES_NOT_EXIST_CUSTOM_ERROR: "RootDoesNotExist",
1059
1067
  // identity wallet
1060
1068
  ID_WALLET_NO_CREDENTIAL_SATISFIED_QUERY: "no credential satisfied query",
1061
1069
  ID_WALLET_SIGNER_IS_REQUIRED: "Ethereum signer is required to create Ethereum identities in order to transit state",
@@ -1091,7 +1099,7 @@ var VerifiableConstants = Object.freeze({
1091
1099
  // JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type
1092
1100
  W3C_CREDENTIAL_2018: "https://www.w3.org/2018/credentials/v1",
1093
1101
  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"}}}`,
1094
- 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"}}`,
1102
+ 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#","xsd":"http://www.w3.org/2001/XMLSchema#","revocationNonce":{"@id":"iden3-reverse-sparse-merkle-tree-proof-vocab:revocationNonce","@type":"xsd:integer"},"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#","xsd":"http://www.w3.org/2001/XMLSchema#","revocationNonce":{"@id":"iden3-comm-revocation-statusV1.0-vocab:revocationNonce","@type":"xsd:integer"},"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#","xsd":"http://www.w3.org/2001/XMLSchema#","revocationNonce":{"@id":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:revocationNonce","@type":"xsd:integer"},"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"}}`,
1095
1103
  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"}}}}`
1096
1104
  },
1097
1105
  // JsonSchema2023 JSON schema for verification of Iden3Credential
@@ -4946,10 +4954,258 @@ var InMemoryDataSource = class {
4946
4954
  }
4947
4955
  };
4948
4956
 
4957
+ // node_modules/quick-lru/index.js
4958
+ var QuickLRU = class extends Map {
4959
+ #size = 0;
4960
+ #cache = /* @__PURE__ */ new Map();
4961
+ #oldCache = /* @__PURE__ */ new Map();
4962
+ #maxSize;
4963
+ #maxAge;
4964
+ #onEviction;
4965
+ constructor(options = {}) {
4966
+ super();
4967
+ if (!(options.maxSize && options.maxSize > 0)) {
4968
+ throw new TypeError("`maxSize` must be a number greater than 0");
4969
+ }
4970
+ if (typeof options.maxAge === "number" && options.maxAge === 0) {
4971
+ throw new TypeError("`maxAge` must be a number greater than 0");
4972
+ }
4973
+ this.#maxSize = options.maxSize;
4974
+ this.#maxAge = options.maxAge || Number.POSITIVE_INFINITY;
4975
+ this.#onEviction = options.onEviction;
4976
+ }
4977
+ // For tests.
4978
+ get __oldCache() {
4979
+ return this.#oldCache;
4980
+ }
4981
+ #emitEvictions(cache) {
4982
+ if (typeof this.#onEviction !== "function") {
4983
+ return;
4984
+ }
4985
+ for (const [key, item] of cache) {
4986
+ this.#onEviction(key, item.value);
4987
+ }
4988
+ }
4989
+ #deleteIfExpired(key, item) {
4990
+ if (typeof item.expiry === "number" && item.expiry <= Date.now()) {
4991
+ if (typeof this.#onEviction === "function") {
4992
+ this.#onEviction(key, item.value);
4993
+ }
4994
+ return this.delete(key);
4995
+ }
4996
+ return false;
4997
+ }
4998
+ #getOrDeleteIfExpired(key, item) {
4999
+ const deleted = this.#deleteIfExpired(key, item);
5000
+ if (deleted === false) {
5001
+ return item.value;
5002
+ }
5003
+ }
5004
+ #getItemValue(key, item) {
5005
+ return item.expiry ? this.#getOrDeleteIfExpired(key, item) : item.value;
5006
+ }
5007
+ #peek(key, cache) {
5008
+ const item = cache.get(key);
5009
+ return this.#getItemValue(key, item);
5010
+ }
5011
+ #set(key, value) {
5012
+ this.#cache.set(key, value);
5013
+ this.#size++;
5014
+ if (this.#size >= this.#maxSize) {
5015
+ this.#size = 0;
5016
+ this.#emitEvictions(this.#oldCache);
5017
+ this.#oldCache = this.#cache;
5018
+ this.#cache = /* @__PURE__ */ new Map();
5019
+ }
5020
+ }
5021
+ #moveToRecent(key, item) {
5022
+ this.#oldCache.delete(key);
5023
+ this.#set(key, item);
5024
+ }
5025
+ *#entriesAscending() {
5026
+ for (const item of this.#oldCache) {
5027
+ const [key, value] = item;
5028
+ if (!this.#cache.has(key)) {
5029
+ const deleted = this.#deleteIfExpired(key, value);
5030
+ if (deleted === false) {
5031
+ yield item;
5032
+ }
5033
+ }
5034
+ }
5035
+ for (const item of this.#cache) {
5036
+ const [key, value] = item;
5037
+ const deleted = this.#deleteIfExpired(key, value);
5038
+ if (deleted === false) {
5039
+ yield item;
5040
+ }
5041
+ }
5042
+ }
5043
+ get(key) {
5044
+ if (this.#cache.has(key)) {
5045
+ const item = this.#cache.get(key);
5046
+ return this.#getItemValue(key, item);
5047
+ }
5048
+ if (this.#oldCache.has(key)) {
5049
+ const item = this.#oldCache.get(key);
5050
+ if (this.#deleteIfExpired(key, item) === false) {
5051
+ this.#moveToRecent(key, item);
5052
+ return item.value;
5053
+ }
5054
+ }
5055
+ }
5056
+ set(key, value, { maxAge = this.#maxAge } = {}) {
5057
+ const expiry = typeof maxAge === "number" && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : void 0;
5058
+ if (this.#cache.has(key)) {
5059
+ this.#cache.set(key, {
5060
+ value,
5061
+ expiry
5062
+ });
5063
+ } else {
5064
+ this.#set(key, { value, expiry });
5065
+ }
5066
+ return this;
5067
+ }
5068
+ has(key) {
5069
+ if (this.#cache.has(key)) {
5070
+ return !this.#deleteIfExpired(key, this.#cache.get(key));
5071
+ }
5072
+ if (this.#oldCache.has(key)) {
5073
+ return !this.#deleteIfExpired(key, this.#oldCache.get(key));
5074
+ }
5075
+ return false;
5076
+ }
5077
+ peek(key) {
5078
+ if (this.#cache.has(key)) {
5079
+ return this.#peek(key, this.#cache);
5080
+ }
5081
+ if (this.#oldCache.has(key)) {
5082
+ return this.#peek(key, this.#oldCache);
5083
+ }
5084
+ }
5085
+ delete(key) {
5086
+ const deleted = this.#cache.delete(key);
5087
+ if (deleted) {
5088
+ this.#size--;
5089
+ }
5090
+ return this.#oldCache.delete(key) || deleted;
5091
+ }
5092
+ clear() {
5093
+ this.#cache.clear();
5094
+ this.#oldCache.clear();
5095
+ this.#size = 0;
5096
+ }
5097
+ resize(newSize) {
5098
+ if (!(newSize && newSize > 0)) {
5099
+ throw new TypeError("`maxSize` must be a number greater than 0");
5100
+ }
5101
+ const items = [...this.#entriesAscending()];
5102
+ const removeCount = items.length - newSize;
5103
+ if (removeCount < 0) {
5104
+ this.#cache = new Map(items);
5105
+ this.#oldCache = /* @__PURE__ */ new Map();
5106
+ this.#size = items.length;
5107
+ } else {
5108
+ if (removeCount > 0) {
5109
+ this.#emitEvictions(items.slice(0, removeCount));
5110
+ }
5111
+ this.#oldCache = new Map(items.slice(removeCount));
5112
+ this.#cache = /* @__PURE__ */ new Map();
5113
+ this.#size = 0;
5114
+ }
5115
+ this.#maxSize = newSize;
5116
+ }
5117
+ *keys() {
5118
+ for (const [key] of this) {
5119
+ yield key;
5120
+ }
5121
+ }
5122
+ *values() {
5123
+ for (const [, value] of this) {
5124
+ yield value;
5125
+ }
5126
+ }
5127
+ *[Symbol.iterator]() {
5128
+ for (const item of this.#cache) {
5129
+ const [key, value] = item;
5130
+ const deleted = this.#deleteIfExpired(key, value);
5131
+ if (deleted === false) {
5132
+ yield [key, value.value];
5133
+ }
5134
+ }
5135
+ for (const item of this.#oldCache) {
5136
+ const [key, value] = item;
5137
+ if (!this.#cache.has(key)) {
5138
+ const deleted = this.#deleteIfExpired(key, value);
5139
+ if (deleted === false) {
5140
+ yield [key, value.value];
5141
+ }
5142
+ }
5143
+ }
5144
+ }
5145
+ *entriesDescending() {
5146
+ let items = [...this.#cache];
5147
+ for (let i = items.length - 1; i >= 0; --i) {
5148
+ const item = items[i];
5149
+ const [key, value] = item;
5150
+ const deleted = this.#deleteIfExpired(key, value);
5151
+ if (deleted === false) {
5152
+ yield [key, value.value];
5153
+ }
5154
+ }
5155
+ items = [...this.#oldCache];
5156
+ for (let i = items.length - 1; i >= 0; --i) {
5157
+ const item = items[i];
5158
+ const [key, value] = item;
5159
+ if (!this.#cache.has(key)) {
5160
+ const deleted = this.#deleteIfExpired(key, value);
5161
+ if (deleted === false) {
5162
+ yield [key, value.value];
5163
+ }
5164
+ }
5165
+ }
5166
+ }
5167
+ *entriesAscending() {
5168
+ for (const [key, value] of this.#entriesAscending()) {
5169
+ yield [key, value.value];
5170
+ }
5171
+ }
5172
+ get size() {
5173
+ if (!this.#size) {
5174
+ return this.#oldCache.size;
5175
+ }
5176
+ let oldCacheSize = 0;
5177
+ for (const key of this.#oldCache.keys()) {
5178
+ if (!this.#cache.has(key)) {
5179
+ oldCacheSize++;
5180
+ }
5181
+ }
5182
+ return Math.min(this.#size + oldCacheSize, this.#maxSize);
5183
+ }
5184
+ get maxSize() {
5185
+ return this.#maxSize;
5186
+ }
5187
+ entries() {
5188
+ return this.entriesAscending();
5189
+ }
5190
+ forEach(callbackFunction, thisArgument = this) {
5191
+ for (const [key, value] of this.entriesAscending()) {
5192
+ callbackFunction.call(thisArgument, value, key, this);
5193
+ }
5194
+ }
5195
+ get [Symbol.toStringTag]() {
5196
+ return "QuickLRU";
5197
+ }
5198
+ toString() {
5199
+ return `QuickLRU(${this.size}/${this.maxSize})`;
5200
+ }
5201
+ [Symbol.for("nodejs.util.inspect.custom")]() {
5202
+ return this.toString();
5203
+ }
5204
+ };
5205
+
4949
5206
  // src/storage/memory/cache-lru.ts
4950
- var import_quick_lru = __toESM(require("quick-lru"), 1);
4951
5207
  function createInMemoryCache(params) {
4952
- const cache = new import_quick_lru.default({ maxSize: params.maxSize, maxAge: params.ttl });
5208
+ const cache = new QuickLRU({ maxSize: params.maxSize, maxAge: params.ttl });
4953
5209
  return {
4954
5210
  get: async (key) => {
4955
5211
  return cache.get(key);
@@ -6150,7 +6406,8 @@ function createAuthorizationRequestWithMessage(reason, message, sender, callback
6150
6406
  scope: opts?.scope ?? []
6151
6407
  },
6152
6408
  created_time: (0, import_js_iden3_core19.getUnixTimestamp)(/* @__PURE__ */ new Date()),
6153
- expires_time: opts?.expires_time ? (0, import_js_iden3_core19.getUnixTimestamp)(opts.expires_time) : void 0
6409
+ expires_time: opts?.expires_time ? (0, import_js_iden3_core19.getUnixTimestamp)(opts.expires_time) : void 0,
6410
+ attachments: opts?.attachments
6154
6411
  };
6155
6412
  return request;
6156
6413
  }
@@ -6503,6 +6760,31 @@ var OnChainRevocationStorage = class _OnChainRevocationStorage {
6503
6760
  // src/credentials/status/on-chain-revocation.ts
6504
6761
  var import_js_iden3_core20 = require("@iden3/js-iden3-core");
6505
6762
  var import_js_merkletree17 = require("@iden3/js-merkletree");
6763
+
6764
+ // src/storage/blockchain/errors.ts
6765
+ function isErrorWithArgs(error) {
6766
+ return typeof error === "object" && error !== null && "errorArgs" in error && Array.isArray(error.errorArgs);
6767
+ }
6768
+ function extractErrorMessage(error) {
6769
+ const errorArgs = isErrorWithArgs(error) ? error.errorArgs[0] : void 0;
6770
+ const errMsg = errorArgs || (error instanceof Error ? error.message : "");
6771
+ return errMsg;
6772
+ }
6773
+ function isError(error, errorMsg) {
6774
+ const errMsg = extractErrorMessage(error);
6775
+ return errMsg.includes(errorMsg);
6776
+ }
6777
+ function isIdentityDoesNotExistError(error) {
6778
+ return isError(error, VerifiableConstants.ERRORS.IDENTITY_DOES_NOT_EXIST) || isError(error, VerifiableConstants.ERRORS.IDENTITY_DOES_NOT_EXIST_CUSTOM_ERROR);
6779
+ }
6780
+ function isStateDoesNotExistError(error) {
6781
+ return isError(error, VerifiableConstants.ERRORS.STATE_DOES_NOT_EXIST) || isError(error, VerifiableConstants.ERRORS.STATE_DOES_NOT_EXIST_CUSTOM_ERROR);
6782
+ }
6783
+ function isRootDoesNotExistError(error) {
6784
+ return isError(error, VerifiableConstants.ERRORS.ROOT_DOES_NOT_EXIST) || isError(error, VerifiableConstants.ERRORS.ROOT_DOES_NOT_EXIST_CUSTOM_ERROR);
6785
+ }
6786
+
6787
+ // src/credentials/status/on-chain-revocation.ts
6506
6788
  var OnChainResolver = class {
6507
6789
  /**
6508
6790
  *
@@ -6550,8 +6832,7 @@ var OnChainResolver = class {
6550
6832
  }
6551
6833
  latestIssuerState = latestStateInfo.state;
6552
6834
  } catch (e) {
6553
- const errMsg = e?.reason ?? e.message ?? e;
6554
- if (!errMsg.includes(VerifiableConstants.ERRORS.IDENTITY_DOES_NOT_EXIST)) {
6835
+ if (!isIdentityDoesNotExistError(e)) {
6555
6836
  throw e;
6556
6837
  }
6557
6838
  if (!stateHex) {
@@ -6759,8 +7040,7 @@ var RHSResolver = class {
6759
7040
  }
6760
7041
  latestState = latestStateInfo.state;
6761
7042
  } catch (e) {
6762
- const errMsg = e?.reason ?? e.message ?? e;
6763
- if (!errMsg.includes(VerifiableConstants.ERRORS.IDENTITY_DOES_NOT_EXIST)) {
7043
+ if (!isIdentityDoesNotExistError(e)) {
6764
7044
  throw e;
6765
7045
  }
6766
7046
  const stateHex = this.extractState(credentialStatus.id);
@@ -8053,7 +8333,8 @@ function createProposalRequest(sender, receiver, opts) {
8053
8333
  type: PROTOCOL_MESSAGE_TYPE.PROPOSAL_REQUEST_MESSAGE_TYPE,
8054
8334
  body: opts,
8055
8335
  created_time: (0, import_js_iden3_core27.getUnixTimestamp)(/* @__PURE__ */ new Date()),
8056
- expires_time: opts?.expires_time ? (0, import_js_iden3_core27.getUnixTimestamp)(opts.expires_time) : void 0
8336
+ expires_time: opts?.expires_time ? (0, import_js_iden3_core27.getUnixTimestamp)(opts.expires_time) : void 0,
8337
+ attachments: opts.attachments
8057
8338
  };
8058
8339
  return request;
8059
8340
  }
@@ -8165,7 +8446,9 @@ var CredentialProposalHandler = class extends AbstractMessageHandler {
8165
8446
  );
8166
8447
  continue;
8167
8448
  }
8168
- const proposal = await this._params.proposalResolverFn(cred.context, cred.type);
8449
+ const proposal = await this._params.proposalResolverFn(cred.context, cred.type, {
8450
+ msg: proposalRequest
8451
+ });
8169
8452
  if (!proposal) {
8170
8453
  throw new Error(`can't resolve Proposal for type: ${cred.type}, context: ${cred.context}`);
8171
8454
  }
@@ -13267,9 +13550,7 @@ var PubSignalsVerifier = class {
13267
13550
  try {
13268
13551
  contractState = await this._stateStorage.getStateInfoByIdAndState(idBigInt, state);
13269
13552
  } catch (e) {
13270
- const stateNotExistErr = (e?.errorArgs ?? [])[0];
13271
- const errMsg = stateNotExistErr || e.message;
13272
- if (errMsg.includes("State does not exist")) {
13553
+ if (isStateDoesNotExistError(e)) {
13273
13554
  if (isGenesis) {
13274
13555
  return {
13275
13556
  latest: true,
@@ -13302,7 +13583,7 @@ var PubSignalsVerifier = class {
13302
13583
  try {
13303
13584
  globalStateInfo = await this._stateStorage.getGISTRootInfo(state, id);
13304
13585
  } catch (e) {
13305
- if (e.errorArgs[0] === "Root does not exist") {
13586
+ if (isRootDoesNotExistError(e)) {
13306
13587
  throw new Error("GIST root does not exist in the smart contract");
13307
13588
  }
13308
13589
  throw e;
@@ -14673,7 +14954,10 @@ var jsonLDMerklizer = __toESM(require("@iden3/js-jsonld-merklization"), 1);
14673
14954
  isEthereumIdentity,
14674
14955
  isGenesisState,
14675
14956
  isGenesisStateId,
14957
+ isIdentityDoesNotExistError,
14676
14958
  isIssuerGenesis,
14959
+ isRootDoesNotExistError,
14960
+ isStateDoesNotExistError,
14677
14961
  isValidOperation,
14678
14962
  jsonLDMerklizer,
14679
14963
  keyPath,