@mocanetwork/privado-js-sdk 1.0.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 +75 -0
- package/dist/browser/esm/index.js +14901 -0
- package/dist/browser/esm/index.js.map +1 -0
- package/dist/browser/umd/index.global.js +678 -0
- package/dist/browser/umd/index.global.js.map +1 -0
- package/dist/node/cjs/index.cjs +15418 -0
- package/dist/node/cjs/index.cjs.map +1 -0
- package/dist/node/esm/index.js +14901 -0
- package/dist/node/esm/index.js.map +1 -0
- package/dist/types/blockchain/index.d.ts +2 -0
- package/dist/types/blockchain/index.d.ts.map +1 -0
- package/dist/types/blockchain/transaction-service.d.ts +81 -0
- package/dist/types/blockchain/transaction-service.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-mtp-v2-on-chain.d.ts +70 -0
- package/dist/types/circuits/atomic-query-mtp-v2-on-chain.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-mtp-v2.d.ts +63 -0
- package/dist/types/circuits/atomic-query-mtp-v2.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-sig-v2-on-chain.d.ts +137 -0
- package/dist/types/circuits/atomic-query-sig-v2-on-chain.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-sig-v2.d.ts +64 -0
- package/dist/types/circuits/atomic-query-sig-v2.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-v3-on-chain.d.ts +141 -0
- package/dist/types/circuits/atomic-query-v3-on-chain.d.ts.map +1 -0
- package/dist/types/circuits/atomic-query-v3.d.ts +121 -0
- package/dist/types/circuits/atomic-query-v3.d.ts.map +1 -0
- package/dist/types/circuits/auth-v2.d.ts +46 -0
- package/dist/types/circuits/auth-v2.d.ts.map +1 -0
- package/dist/types/circuits/common.d.ts +153 -0
- package/dist/types/circuits/common.d.ts.map +1 -0
- package/dist/types/circuits/comparer.d.ts +122 -0
- package/dist/types/circuits/comparer.d.ts.map +1 -0
- package/dist/types/circuits/index.d.ts +13 -0
- package/dist/types/circuits/index.d.ts.map +1 -0
- package/dist/types/circuits/linked-multi-query.d.ts +38 -0
- package/dist/types/circuits/linked-multi-query.d.ts.map +1 -0
- package/dist/types/circuits/models.d.ts +189 -0
- package/dist/types/circuits/models.d.ts.map +1 -0
- package/dist/types/circuits/state-transition.d.ts +49 -0
- package/dist/types/circuits/state-transition.d.ts.map +1 -0
- package/dist/types/credentials/credential-wallet.d.ts +200 -0
- package/dist/types/credentials/credential-wallet.d.ts.map +1 -0
- package/dist/types/credentials/index.d.ts +12 -0
- package/dist/types/credentials/index.d.ts.map +1 -0
- package/dist/types/credentials/models.d.ts +84 -0
- package/dist/types/credentials/models.d.ts.map +1 -0
- package/dist/types/credentials/rhs.d.ts +38 -0
- package/dist/types/credentials/rhs.d.ts.map +1 -0
- package/dist/types/credentials/status/agent-revocation.d.ts +20 -0
- package/dist/types/credentials/status/agent-revocation.d.ts.map +1 -0
- package/dist/types/credentials/status/credential-status-publisher.d.ts +73 -0
- package/dist/types/credentials/status/credential-status-publisher.d.ts.map +1 -0
- package/dist/types/credentials/status/did-resolver-revocation.d.ts +8 -0
- package/dist/types/credentials/status/did-resolver-revocation.d.ts.map +1 -0
- package/dist/types/credentials/status/on-chain-revocation.d.ts +58 -0
- package/dist/types/credentials/status/on-chain-revocation.d.ts.map +1 -0
- package/dist/types/credentials/status/resolver.d.ts +69 -0
- package/dist/types/credentials/status/resolver.d.ts.map +1 -0
- package/dist/types/credentials/status/reverse-sparse-merkle-tree.d.ts +126 -0
- package/dist/types/credentials/status/reverse-sparse-merkle-tree.d.ts.map +1 -0
- package/dist/types/credentials/status/sparse-merkle-tree.d.ts +38 -0
- package/dist/types/credentials/status/sparse-merkle-tree.d.ts.map +1 -0
- package/dist/types/credentials/utils.d.ts +15 -0
- package/dist/types/credentials/utils.d.ts.map +1 -0
- package/dist/types/iden3comm/constants.d.ts +61 -0
- package/dist/types/iden3comm/constants.d.ts.map +1 -0
- package/dist/types/iden3comm/errors.d.ts +10 -0
- package/dist/types/iden3comm/errors.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/auth.d.ts +157 -0
- package/dist/types/iden3comm/handlers/auth.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/common.d.ts +72 -0
- package/dist/types/iden3comm/handlers/common.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/contract-request.d.ts +96 -0
- package/dist/types/iden3comm/handlers/contract-request.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/credential-proposal.d.ts +120 -0
- package/dist/types/iden3comm/handlers/credential-proposal.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/discovery-protocol.d.ts +101 -0
- package/dist/types/iden3comm/handlers/discovery-protocol.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/fetch.d.ts +130 -0
- package/dist/types/iden3comm/handlers/fetch.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/index.d.ts +12 -0
- package/dist/types/iden3comm/handlers/index.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/message-handler.d.ts +93 -0
- package/dist/types/iden3comm/handlers/message-handler.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/payment.d.ts +167 -0
- package/dist/types/iden3comm/handlers/payment.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/problem-report.d.ts +18 -0
- package/dist/types/iden3comm/handlers/problem-report.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/refresh.d.ts +57 -0
- package/dist/types/iden3comm/handlers/refresh.d.ts.map +1 -0
- package/dist/types/iden3comm/handlers/revocation-status.d.ts +76 -0
- package/dist/types/iden3comm/handlers/revocation-status.d.ts.map +1 -0
- package/dist/types/iden3comm/index.d.ts +9 -0
- package/dist/types/iden3comm/index.d.ts.map +1 -0
- package/dist/types/iden3comm/packageManager.d.ts +47 -0
- package/dist/types/iden3comm/packageManager.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/index.d.ts +4 -0
- package/dist/types/iden3comm/packers/index.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/jws.d.ts +56 -0
- package/dist/types/iden3comm/packers/jws.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/plain.d.ts +47 -0
- package/dist/types/iden3comm/packers/plain.d.ts.map +1 -0
- package/dist/types/iden3comm/packers/zkp.d.ts +98 -0
- package/dist/types/iden3comm/packers/zkp.d.ts.map +1 -0
- package/dist/types/iden3comm/types/index.d.ts +17 -0
- package/dist/types/iden3comm/types/index.d.ts.map +1 -0
- package/dist/types/iden3comm/types/models.d.ts +7 -0
- package/dist/types/iden3comm/types/models.d.ts.map +1 -0
- package/dist/types/iden3comm/types/packageManager.d.ts +100 -0
- package/dist/types/iden3comm/types/packageManager.d.ts.map +1 -0
- package/dist/types/iden3comm/types/packer.d.ts +158 -0
- package/dist/types/iden3comm/types/packer.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/accept-profile.d.ts +8 -0
- package/dist/types/iden3comm/types/protocol/accept-profile.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/attachment.d.ts +11 -0
- package/dist/types/iden3comm/types/protocol/attachment.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/auth.d.ts +90 -0
- package/dist/types/iden3comm/types/protocol/auth.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/common.d.ts +11 -0
- package/dist/types/iden3comm/types/protocol/common.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/contract-request.d.ts +62 -0
- package/dist/types/iden3comm/types/protocol/contract-request.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/credentials.d.ts +82 -0
- package/dist/types/iden3comm/types/protocol/credentials.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/discovery-protocol.d.ts +42 -0
- package/dist/types/iden3comm/types/protocol/discovery-protocol.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/messages.d.ts +12 -0
- package/dist/types/iden3comm/types/protocol/messages.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/payment.d.ts +178 -0
- package/dist/types/iden3comm/types/protocol/payment.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/problem-report.d.ts +17 -0
- package/dist/types/iden3comm/types/protocol/problem-report.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/proof.d.ts +22 -0
- package/dist/types/iden3comm/types/protocol/proof.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/proposal-request.d.ts +33 -0
- package/dist/types/iden3comm/types/protocol/proposal-request.d.ts.map +1 -0
- package/dist/types/iden3comm/types/protocol/revocation.d.ts +20 -0
- package/dist/types/iden3comm/types/protocol/revocation.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/accept-profile.d.ts +4 -0
- package/dist/types/iden3comm/utils/accept-profile.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/did.d.ts +8 -0
- package/dist/types/iden3comm/utils/did.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/envelope.d.ts +32 -0
- package/dist/types/iden3comm/utils/envelope.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/index.d.ts +5 -0
- package/dist/types/iden3comm/utils/index.d.ts.map +1 -0
- package/dist/types/iden3comm/utils/message.d.ts +20 -0
- package/dist/types/iden3comm/utils/message.d.ts.map +1 -0
- package/dist/types/identity/common.d.ts +27 -0
- package/dist/types/identity/common.d.ts.map +1 -0
- package/dist/types/identity/identity-wallet.d.ts +472 -0
- package/dist/types/identity/identity-wallet.d.ts.map +1 -0
- package/dist/types/identity/index.d.ts +3 -0
- package/dist/types/identity/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/kms/index.d.ts +5 -0
- package/dist/types/kms/index.d.ts.map +1 -0
- package/dist/types/kms/key-providers/bjj-provider.d.ts +54 -0
- package/dist/types/kms/key-providers/bjj-provider.d.ts.map +1 -0
- package/dist/types/kms/key-providers/ed25519-provider.d.ts +61 -0
- package/dist/types/kms/key-providers/ed25519-provider.d.ts.map +1 -0
- package/dist/types/kms/key-providers/index.d.ts +4 -0
- package/dist/types/kms/key-providers/index.d.ts.map +1 -0
- package/dist/types/kms/key-providers/secp256k1-provider.d.ts +62 -0
- package/dist/types/kms/key-providers/secp256k1-provider.d.ts.map +1 -0
- package/dist/types/kms/kms.d.ts +120 -0
- package/dist/types/kms/kms.d.ts.map +1 -0
- package/dist/types/kms/provider-helpers.d.ts +10 -0
- package/dist/types/kms/provider-helpers.d.ts.map +1 -0
- package/dist/types/kms/store/abstract-key-store.d.ts +41 -0
- package/dist/types/kms/store/abstract-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/index.d.ts +6 -0
- package/dist/types/kms/store/index.d.ts.map +1 -0
- package/dist/types/kms/store/indexed-db-key-store.d.ts +44 -0
- package/dist/types/kms/store/indexed-db-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/local-storage-key-store.d.ts +42 -0
- package/dist/types/kms/store/local-storage-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/memory-key-store.d.ts +24 -0
- package/dist/types/kms/store/memory-key-store.d.ts.map +1 -0
- package/dist/types/kms/store/types.d.ts +21 -0
- package/dist/types/kms/store/types.d.ts.map +1 -0
- package/dist/types/proof/common.d.ts +49 -0
- package/dist/types/proof/common.d.ts.map +1 -0
- package/dist/types/proof/index.d.ts +5 -0
- package/dist/types/proof/index.d.ts.map +1 -0
- package/dist/types/proof/proof-service.d.ts +169 -0
- package/dist/types/proof/proof-service.d.ts.map +1 -0
- package/dist/types/proof/provers/index.d.ts +4 -0
- package/dist/types/proof/provers/index.d.ts.map +1 -0
- package/dist/types/proof/provers/inputs-generator.d.ts +57 -0
- package/dist/types/proof/provers/inputs-generator.d.ts.map +1 -0
- package/dist/types/proof/provers/prover.d.ts +56 -0
- package/dist/types/proof/provers/prover.d.ts.map +1 -0
- package/dist/types/proof/provers/witness_calculator.d.ts +17 -0
- package/dist/types/proof/provers/witness_calculator.d.ts.map +1 -0
- package/dist/types/proof/verifiers/index.d.ts +4 -0
- package/dist/types/proof/verifiers/index.d.ts.map +1 -0
- package/dist/types/proof/verifiers/pub-signals-verifier.d.ts +60 -0
- package/dist/types/proof/verifiers/pub-signals-verifier.d.ts.map +1 -0
- package/dist/types/proof/verifiers/query-hash.d.ts +4 -0
- package/dist/types/proof/verifiers/query-hash.d.ts.map +1 -0
- package/dist/types/proof/verifiers/query.d.ts +43 -0
- package/dist/types/proof/verifiers/query.d.ts.map +1 -0
- package/dist/types/schema-processor/index.d.ts +4 -0
- package/dist/types/schema-processor/index.d.ts.map +1 -0
- package/dist/types/schema-processor/json/index.d.ts +3 -0
- package/dist/types/schema-processor/json/index.d.ts.map +1 -0
- package/dist/types/schema-processor/json/parser.d.ts +141 -0
- package/dist/types/schema-processor/json/parser.d.ts.map +1 -0
- package/dist/types/schema-processor/json/validator.d.ts +26 -0
- package/dist/types/schema-processor/json/validator.d.ts.map +1 -0
- package/dist/types/schema-processor/jsonld/cache.d.ts +3 -0
- package/dist/types/schema-processor/jsonld/cache.d.ts.map +1 -0
- package/dist/types/schema-processor/jsonld/index.d.ts +3 -0
- package/dist/types/schema-processor/jsonld/index.d.ts.map +1 -0
- package/dist/types/schema-processor/jsonld/parser.d.ts +30 -0
- package/dist/types/schema-processor/jsonld/parser.d.ts.map +1 -0
- package/dist/types/schema-processor/utils.d.ts +54 -0
- package/dist/types/schema-processor/utils.d.ts.map +1 -0
- package/dist/types/storage/blockchain/common.d.ts +8 -0
- package/dist/types/storage/blockchain/common.d.ts.map +1 -0
- package/dist/types/storage/blockchain/did-resolver-readonly-storage.d.ts +17 -0
- package/dist/types/storage/blockchain/did-resolver-readonly-storage.d.ts.map +1 -0
- package/dist/types/storage/blockchain/erc20-helper.d.ts +20 -0
- package/dist/types/storage/blockchain/erc20-helper.d.ts.map +1 -0
- package/dist/types/storage/blockchain/errors.d.ts +4 -0
- package/dist/types/storage/blockchain/errors.d.ts.map +1 -0
- package/dist/types/storage/blockchain/index.d.ts +8 -0
- package/dist/types/storage/blockchain/index.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.d.ts +67 -0
- package/dist/types/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-issuer.d.ts +41 -0
- package/dist/types/storage/blockchain/onchain-issuer.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-revocation.d.ts +41 -0
- package/dist/types/storage/blockchain/onchain-revocation.d.ts.map +1 -0
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts +116 -0
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts.map +1 -0
- package/dist/types/storage/blockchain/state.d.ts +127 -0
- package/dist/types/storage/blockchain/state.d.ts.map +1 -0
- package/dist/types/storage/entities/circuitData.d.ts +8 -0
- package/dist/types/storage/entities/circuitData.d.ts.map +1 -0
- package/dist/types/storage/entities/identity.d.ts +17 -0
- package/dist/types/storage/entities/identity.d.ts.map +1 -0
- package/dist/types/storage/entities/index.d.ts +5 -0
- package/dist/types/storage/entities/index.d.ts.map +1 -0
- package/dist/types/storage/entities/mt.d.ts +22 -0
- package/dist/types/storage/entities/mt.d.ts.map +1 -0
- package/dist/types/storage/entities/state.d.ts +92 -0
- package/dist/types/storage/entities/state.d.ts.map +1 -0
- package/dist/types/storage/errors.d.ts +9 -0
- package/dist/types/storage/errors.d.ts.map +1 -0
- package/dist/types/storage/filters/index.d.ts +2 -0
- package/dist/types/storage/filters/index.d.ts.map +1 -0
- package/dist/types/storage/filters/jsonQuery.d.ts +83 -0
- package/dist/types/storage/filters/jsonQuery.d.ts.map +1 -0
- package/dist/types/storage/fs/circuits-storage.d.ts +64 -0
- package/dist/types/storage/fs/circuits-storage.d.ts.map +1 -0
- package/dist/types/storage/fs/index.d.ts +2 -0
- package/dist/types/storage/fs/index.d.ts.map +1 -0
- package/dist/types/storage/index.d.ts +10 -0
- package/dist/types/storage/index.d.ts.map +1 -0
- package/dist/types/storage/indexed-db/data-source.d.ts +44 -0
- package/dist/types/storage/indexed-db/data-source.d.ts.map +1 -0
- package/dist/types/storage/indexed-db/index.d.ts +3 -0
- package/dist/types/storage/indexed-db/index.d.ts.map +1 -0
- package/dist/types/storage/indexed-db/merkletree.d.ts +43 -0
- package/dist/types/storage/indexed-db/merkletree.d.ts.map +1 -0
- package/dist/types/storage/interfaces/circuits.d.ts +26 -0
- package/dist/types/storage/interfaces/circuits.d.ts.map +1 -0
- package/dist/types/storage/interfaces/credentials.d.ts +53 -0
- package/dist/types/storage/interfaces/credentials.d.ts.map +1 -0
- package/dist/types/storage/interfaces/data-source.d.ts +39 -0
- package/dist/types/storage/interfaces/data-source.d.ts.map +1 -0
- package/dist/types/storage/interfaces/data-storage.d.ts +17 -0
- package/dist/types/storage/interfaces/data-storage.d.ts.map +1 -0
- package/dist/types/storage/interfaces/identity.d.ts +70 -0
- package/dist/types/storage/interfaces/identity.d.ts.map +1 -0
- package/dist/types/storage/interfaces/index.d.ts +11 -0
- package/dist/types/storage/interfaces/index.d.ts.map +1 -0
- package/dist/types/storage/interfaces/merkletree.d.ts +44 -0
- package/dist/types/storage/interfaces/merkletree.d.ts.map +1 -0
- package/dist/types/storage/interfaces/onchain-issuer.d.ts +13 -0
- package/dist/types/storage/interfaces/onchain-issuer.d.ts.map +1 -0
- package/dist/types/storage/interfaces/onchain-revocation.d.ts +19 -0
- package/dist/types/storage/interfaces/onchain-revocation.d.ts.map +1 -0
- package/dist/types/storage/interfaces/onchain-zkp-verifier.d.ts +63 -0
- package/dist/types/storage/interfaces/onchain-zkp-verifier.d.ts.map +1 -0
- package/dist/types/storage/interfaces/state.d.ts +74 -0
- package/dist/types/storage/interfaces/state.d.ts.map +1 -0
- package/dist/types/storage/local-storage/data-source.d.ts +41 -0
- package/dist/types/storage/local-storage/data-source.d.ts.map +1 -0
- package/dist/types/storage/local-storage/index.d.ts +3 -0
- package/dist/types/storage/local-storage/index.d.ts.map +1 -0
- package/dist/types/storage/local-storage/merkletree.d.ts +41 -0
- package/dist/types/storage/local-storage/merkletree.d.ts.map +1 -0
- package/dist/types/storage/memory/cache-lru.d.ts +11 -0
- package/dist/types/storage/memory/cache-lru.d.ts.map +1 -0
- package/dist/types/storage/memory/data-source.d.ts +20 -0
- package/dist/types/storage/memory/data-source.d.ts.map +1 -0
- package/dist/types/storage/memory/index.d.ts +4 -0
- package/dist/types/storage/memory/index.d.ts.map +1 -0
- package/dist/types/storage/memory/merkletree.d.ts +48 -0
- package/dist/types/storage/memory/merkletree.d.ts.map +1 -0
- package/dist/types/storage/shared/circuit-storage.d.ts +39 -0
- package/dist/types/storage/shared/circuit-storage.d.ts.map +1 -0
- package/dist/types/storage/shared/credential-storage.d.ts +39 -0
- package/dist/types/storage/shared/credential-storage.d.ts.map +1 -0
- package/dist/types/storage/shared/identity-storage.d.ts +45 -0
- package/dist/types/storage/shared/identity-storage.d.ts.map +1 -0
- package/dist/types/storage/shared/index.d.ts +4 -0
- package/dist/types/storage/shared/index.d.ts.map +1 -0
- package/dist/types/storage/utils.d.ts +4 -0
- package/dist/types/storage/utils.d.ts.map +1 -0
- package/dist/types/utils/compare-func.d.ts +2 -0
- package/dist/types/utils/compare-func.d.ts.map +1 -0
- package/dist/types/utils/did-helper.d.ts +38 -0
- package/dist/types/utils/did-helper.d.ts.map +1 -0
- package/dist/types/utils/encoding.d.ts +25 -0
- package/dist/types/utils/encoding.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +8 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/message-bus.d.ts +63 -0
- package/dist/types/utils/message-bus.d.ts.map +1 -0
- package/dist/types/utils/object.d.ts +10 -0
- package/dist/types/utils/object.d.ts.map +1 -0
- package/dist/types/utils/payments/evm.d.ts +19 -0
- package/dist/types/utils/payments/evm.d.ts.map +1 -0
- package/dist/types/utils/payments/solana.d.ts +88 -0
- package/dist/types/utils/payments/solana.d.ts.map +1 -0
- package/dist/types/verifiable/constants.d.ts +188 -0
- package/dist/types/verifiable/constants.d.ts.map +1 -0
- package/dist/types/verifiable/core-utils.d.ts +87 -0
- package/dist/types/verifiable/core-utils.d.ts.map +1 -0
- package/dist/types/verifiable/credential.d.ts +150 -0
- package/dist/types/verifiable/credential.d.ts.map +1 -0
- package/dist/types/verifiable/index.d.ts +7 -0
- package/dist/types/verifiable/index.d.ts.map +1 -0
- package/dist/types/verifiable/presentation.d.ts +11 -0
- package/dist/types/verifiable/presentation.d.ts.map +1 -0
- package/dist/types/verifiable/proof.d.ts +211 -0
- package/dist/types/verifiable/proof.d.ts.map +1 -0
- package/dist/types/verifiable/schema.d.ts +3 -0
- package/dist/types/verifiable/schema.d.ts.map +1 -0
- package/package.json +104 -0
- package/src/blockchain/index.ts +1 -0
- package/src/blockchain/transaction-service.ts +121 -0
- package/src/circuits/atomic-query-mtp-v2-on-chain.ts +338 -0
- package/src/circuits/atomic-query-mtp-v2.ts +283 -0
- package/src/circuits/atomic-query-sig-v2-on-chain.ts +411 -0
- package/src/circuits/atomic-query-sig-v2.ts +340 -0
- package/src/circuits/atomic-query-v3-on-chain.ts +531 -0
- package/src/circuits/atomic-query-v3.ts +461 -0
- package/src/circuits/auth-v2.ts +159 -0
- package/src/circuits/common.ts +261 -0
- package/src/circuits/comparer.ts +227 -0
- package/src/circuits/index.ts +12 -0
- package/src/circuits/linked-multi-query.ts +180 -0
- package/src/circuits/models.ts +263 -0
- package/src/circuits/state-transition.ts +139 -0
- package/src/credentials/credential-wallet.ts +353 -0
- package/src/credentials/index.ts +11 -0
- package/src/credentials/models.ts +93 -0
- package/src/credentials/rhs.ts +176 -0
- package/src/credentials/status/agent-revocation.ts +69 -0
- package/src/credentials/status/credential-status-publisher.ts +143 -0
- package/src/credentials/status/did-resolver-revocation.ts +24 -0
- package/src/credentials/status/on-chain-revocation.ts +174 -0
- package/src/credentials/status/resolver.ts +81 -0
- package/src/credentials/status/reverse-sparse-merkle-tree.ts +366 -0
- package/src/credentials/status/sparse-merkle-tree.ts +50 -0
- package/src/credentials/utils.ts +36 -0
- package/src/iden3comm/constants.ts +119 -0
- package/src/iden3comm/errors.ts +14 -0
- package/src/iden3comm/handlers/auth.ts +520 -0
- package/src/iden3comm/handlers/common.ts +324 -0
- package/src/iden3comm/handlers/contract-request.ts +367 -0
- package/src/iden3comm/handlers/credential-proposal.ts +371 -0
- package/src/iden3comm/handlers/discovery-protocol.ts +277 -0
- package/src/iden3comm/handlers/fetch.ts +450 -0
- package/src/iden3comm/handlers/index.ts +11 -0
- package/src/iden3comm/handlers/message-handler.ts +165 -0
- package/src/iden3comm/handlers/payment.ts +698 -0
- package/src/iden3comm/handlers/problem-report.ts +41 -0
- package/src/iden3comm/handlers/refresh.ts +138 -0
- package/src/iden3comm/handlers/revocation-status.ts +228 -0
- package/src/iden3comm/index.ts +9 -0
- package/src/iden3comm/packageManager.ts +143 -0
- package/src/iden3comm/packers/index.ts +3 -0
- package/src/iden3comm/packers/jws.ts +225 -0
- package/src/iden3comm/packers/plain.ts +86 -0
- package/src/iden3comm/packers/zkp.ts +243 -0
- package/src/iden3comm/types/index.ts +17 -0
- package/src/iden3comm/types/models.ts +7 -0
- package/src/iden3comm/types/packageManager.ts +112 -0
- package/src/iden3comm/types/packer.ts +190 -0
- package/src/iden3comm/types/protocol/accept-profile.ts +14 -0
- package/src/iden3comm/types/protocol/attachment.ts +12 -0
- package/src/iden3comm/types/protocol/auth.ts +104 -0
- package/src/iden3comm/types/protocol/common.ts +10 -0
- package/src/iden3comm/types/protocol/contract-request.ts +76 -0
- package/src/iden3comm/types/protocol/credentials.ts +96 -0
- package/src/iden3comm/types/protocol/discovery-protocol.ts +49 -0
- package/src/iden3comm/types/protocol/messages.ts +13 -0
- package/src/iden3comm/types/protocol/payment.ts +231 -0
- package/src/iden3comm/types/protocol/problem-report.ts +18 -0
- package/src/iden3comm/types/protocol/proof.ts +25 -0
- package/src/iden3comm/types/protocol/proposal-request.ts +38 -0
- package/src/iden3comm/types/protocol/revocation.ts +23 -0
- package/src/iden3comm/utils/accept-profile.ts +121 -0
- package/src/iden3comm/utils/did.ts +71 -0
- package/src/iden3comm/utils/envelope.ts +101 -0
- package/src/iden3comm/utils/index.ts +4 -0
- package/src/iden3comm/utils/message.ts +41 -0
- package/src/identity/common.ts +69 -0
- package/src/identity/identity-wallet.ts +1592 -0
- package/src/identity/index.ts +2 -0
- package/src/index.ts +16 -0
- package/src/kms/index.ts +4 -0
- package/src/kms/key-providers/bjj-provider.ts +118 -0
- package/src/kms/key-providers/ed25519-provider.ts +105 -0
- package/src/kms/key-providers/index.ts +3 -0
- package/src/kms/key-providers/secp256k1-provider.ts +125 -0
- package/src/kms/kms.ts +173 -0
- package/src/kms/provider-helpers.ts +13 -0
- package/src/kms/store/abstract-key-store.ts +34 -0
- package/src/kms/store/index.ts +5 -0
- package/src/kms/store/indexed-db-key-store.ts +60 -0
- package/src/kms/store/local-storage-key-store.ts +69 -0
- package/src/kms/store/memory-key-store.ts +29 -0
- package/src/kms/store/types.ts +21 -0
- package/src/proof/common.ts +273 -0
- package/src/proof/index.ts +4 -0
- package/src/proof/proof-service.ts +623 -0
- package/src/proof/provers/index.ts +3 -0
- package/src/proof/provers/inputs-generator.ts +627 -0
- package/src/proof/provers/prover.ts +104 -0
- package/src/proof/provers/witness_calculator.ts +315 -0
- package/src/proof/verifiers/index.ts +3 -0
- package/src/proof/verifiers/pub-signals-verifier.ts +730 -0
- package/src/proof/verifiers/query-hash.ts +57 -0
- package/src/proof/verifiers/query.ts +340 -0
- package/src/schema-processor/index.ts +3 -0
- package/src/schema-processor/json/index.ts +2 -0
- package/src/schema-processor/json/parser.ts +256 -0
- package/src/schema-processor/json/validator.ts +67 -0
- package/src/schema-processor/jsonld/cache.ts +49 -0
- package/src/schema-processor/jsonld/index.ts +2 -0
- package/src/schema-processor/jsonld/parser.ts +93 -0
- package/src/schema-processor/utils.ts +84 -0
- package/src/storage/blockchain/abi/CredentialStatusResolver.json +1 -0
- package/src/storage/blockchain/abi/ERC20.json +1 -0
- package/src/storage/blockchain/abi/ERC20Permit.json +1 -0
- package/src/storage/blockchain/abi/IdentityBase.json +1 -0
- package/src/storage/blockchain/abi/State.json +1 -0
- package/src/storage/blockchain/abi/ZkpVerifier.json +789 -0
- package/src/storage/blockchain/common.ts +20 -0
- package/src/storage/blockchain/did-resolver-readonly-storage.ts +90 -0
- package/src/storage/blockchain/erc20-helper.ts +66 -0
- package/src/storage/blockchain/errors.ts +46 -0
- package/src/storage/blockchain/index.ts +7 -0
- package/src/storage/blockchain/onchain-issuer-adapter/non-merklized/version/v0.0.1/onchain-non-merklized-issuer-adapter.ts +327 -0
- package/src/storage/blockchain/onchain-issuer.ts +104 -0
- package/src/storage/blockchain/onchain-revocation.ts +143 -0
- package/src/storage/blockchain/onchain-zkp-verifier.ts +704 -0
- package/src/storage/blockchain/state.ts +471 -0
- package/src/storage/entities/circuitData.ts +7 -0
- package/src/storage/entities/identity.ts +18 -0
- package/src/storage/entities/index.ts +4 -0
- package/src/storage/entities/mt.ts +25 -0
- package/src/storage/entities/state.ts +97 -0
- package/src/storage/errors.ts +8 -0
- package/src/storage/filters/index.ts +1 -0
- package/src/storage/filters/jsonQuery.ts +368 -0
- package/src/storage/fs/circuits-storage.ts +149 -0
- package/src/storage/fs/index.ts +1 -0
- package/src/storage/index.ts +9 -0
- package/src/storage/indexed-db/data-source.ts +58 -0
- package/src/storage/indexed-db/index.ts +2 -0
- package/src/storage/indexed-db/merkletree.ts +140 -0
- package/src/storage/interfaces/circuits.ts +27 -0
- package/src/storage/interfaces/credentials.ts +53 -0
- package/src/storage/interfaces/data-source.ts +41 -0
- package/src/storage/interfaces/data-storage.ts +17 -0
- package/src/storage/interfaces/identity.ts +73 -0
- package/src/storage/interfaces/index.ts +10 -0
- package/src/storage/interfaces/merkletree.ts +52 -0
- package/src/storage/interfaces/onchain-issuer.ts +13 -0
- package/src/storage/interfaces/onchain-revocation.ts +22 -0
- package/src/storage/interfaces/onchain-zkp-verifier.ts +94 -0
- package/src/storage/interfaces/state.ts +81 -0
- package/src/storage/local-storage/data-source.ts +87 -0
- package/src/storage/local-storage/index.ts +2 -0
- package/src/storage/local-storage/merkletree.ts +137 -0
- package/src/storage/memory/cache-lru.ts +30 -0
- package/src/storage/memory/data-source.ts +45 -0
- package/src/storage/memory/index.ts +3 -0
- package/src/storage/memory/merkletree.ts +116 -0
- package/src/storage/shared/circuit-storage.ts +49 -0
- package/src/storage/shared/credential-storage.ts +70 -0
- package/src/storage/shared/identity-storage.ts +82 -0
- package/src/storage/shared/index.ts +3 -0
- package/src/storage/utils.ts +19 -0
- package/src/utils/compare-func.ts +5 -0
- package/src/utils/did-helper.ts +157 -0
- package/src/utils/encoding.ts +47 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/message-bus.ts +88 -0
- package/src/utils/object.ts +52 -0
- package/src/utils/payments/evm.ts +152 -0
- package/src/utils/payments/solana.ts +360 -0
- package/src/verifiable/constants.ts +239 -0
- package/src/verifiable/core-utils.ts +307 -0
- package/src/verifiable/credential.ts +649 -0
- package/src/verifiable/index.ts +6 -0
- package/src/verifiable/presentation.ts +97 -0
- package/src/verifiable/proof.ts +277 -0
- package/src/verifiable/schema.ts +241 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { Schema, serialize } from 'borsh';
|
|
2
|
+
import {
|
|
3
|
+
Iden3PaymentRailsSolanaRequestV1,
|
|
4
|
+
Iden3PaymentRailsSolanaSPLRequestV1,
|
|
5
|
+
Iden3SolanaEd25519SignatureV1,
|
|
6
|
+
MultiChainPaymentConfigOption
|
|
7
|
+
} from '../../iden3comm';
|
|
8
|
+
import { ed25519 } from '@noble/curves/ed25519';
|
|
9
|
+
import {
|
|
10
|
+
PaymentRequestDataType,
|
|
11
|
+
SOLANA_CHAIN_REF,
|
|
12
|
+
SupportedPaymentProofType
|
|
13
|
+
} from '../../verifiable';
|
|
14
|
+
import { byteEncoder } from '../encoding';
|
|
15
|
+
import { getUnixTimestamp } from '@mocanetwork/moca-iden3';
|
|
16
|
+
import { Keypair, PublicKey } from '@solana/web3.js';
|
|
17
|
+
import { Resolvable } from 'did-resolver';
|
|
18
|
+
|
|
19
|
+
export class SolanaNativePaymentRequest {
|
|
20
|
+
version: Uint8Array;
|
|
21
|
+
chainId: bigint;
|
|
22
|
+
verifyingContract: Uint8Array;
|
|
23
|
+
recipient: Uint8Array;
|
|
24
|
+
amount: bigint;
|
|
25
|
+
expirationDate: bigint;
|
|
26
|
+
nonce: bigint;
|
|
27
|
+
metadata: Uint8Array;
|
|
28
|
+
|
|
29
|
+
constructor(fields: {
|
|
30
|
+
version: Uint8Array;
|
|
31
|
+
chainId: bigint;
|
|
32
|
+
verifyingContract: Uint8Array;
|
|
33
|
+
recipient: Uint8Array;
|
|
34
|
+
amount: bigint;
|
|
35
|
+
expirationDate: bigint;
|
|
36
|
+
nonce: bigint;
|
|
37
|
+
metadata: Uint8Array;
|
|
38
|
+
}) {
|
|
39
|
+
this.version = fields.version;
|
|
40
|
+
this.chainId = fields.chainId;
|
|
41
|
+
this.verifyingContract = fields.verifyingContract;
|
|
42
|
+
this.recipient = fields.recipient;
|
|
43
|
+
this.amount = fields.amount;
|
|
44
|
+
this.expirationDate = fields.expirationDate;
|
|
45
|
+
this.nonce = fields.nonce;
|
|
46
|
+
this.metadata = fields.metadata;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class SolanaSplPaymentRequest {
|
|
51
|
+
version: Uint8Array;
|
|
52
|
+
chainId: bigint;
|
|
53
|
+
verifyingContract: Uint8Array;
|
|
54
|
+
tokenAddress: Uint8Array;
|
|
55
|
+
recipient: Uint8Array;
|
|
56
|
+
amount: bigint;
|
|
57
|
+
expirationDate: bigint;
|
|
58
|
+
nonce: bigint;
|
|
59
|
+
metadata: Uint8Array;
|
|
60
|
+
|
|
61
|
+
constructor(fields: {
|
|
62
|
+
version: Uint8Array;
|
|
63
|
+
chainId: bigint;
|
|
64
|
+
verifyingContract: Uint8Array;
|
|
65
|
+
tokenAddress: Uint8Array;
|
|
66
|
+
recipient: Uint8Array;
|
|
67
|
+
amount: bigint;
|
|
68
|
+
expirationDate: bigint;
|
|
69
|
+
nonce: bigint;
|
|
70
|
+
metadata: Uint8Array;
|
|
71
|
+
}) {
|
|
72
|
+
this.version = fields.version;
|
|
73
|
+
this.chainId = fields.chainId;
|
|
74
|
+
this.verifyingContract = fields.verifyingContract;
|
|
75
|
+
this.tokenAddress = fields.tokenAddress;
|
|
76
|
+
this.recipient = fields.recipient;
|
|
77
|
+
this.amount = fields.amount;
|
|
78
|
+
this.expirationDate = fields.expirationDate;
|
|
79
|
+
this.nonce = fields.nonce;
|
|
80
|
+
this.metadata = fields.metadata;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const SolanaNativePaymentSchema = new Map([
|
|
85
|
+
[
|
|
86
|
+
SolanaNativePaymentRequest,
|
|
87
|
+
{
|
|
88
|
+
kind: 'struct',
|
|
89
|
+
fields: [
|
|
90
|
+
['version', ['u8']],
|
|
91
|
+
['chainId', 'u64'],
|
|
92
|
+
['verifyingContract', ['u8', 32]],
|
|
93
|
+
['recipient', ['u8', 32]],
|
|
94
|
+
['amount', 'u64'],
|
|
95
|
+
['expirationDate', 'u64'],
|
|
96
|
+
['nonce', 'u64'],
|
|
97
|
+
['metadata', ['u8']]
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
export const SolanaSplPaymentSchema = new Map([
|
|
104
|
+
[
|
|
105
|
+
SolanaSplPaymentRequest,
|
|
106
|
+
{
|
|
107
|
+
kind: 'struct',
|
|
108
|
+
fields: [
|
|
109
|
+
['version', ['u8']],
|
|
110
|
+
['chainId', 'u64'],
|
|
111
|
+
['verifyingContract', ['u8', 32]],
|
|
112
|
+
['tokenAddress', ['u8', 32]],
|
|
113
|
+
['recipient', ['u8', 32]],
|
|
114
|
+
['amount', 'u64'],
|
|
115
|
+
['expirationDate', 'u64'],
|
|
116
|
+
['nonce', 'u64'],
|
|
117
|
+
['metadata', ['u8']]
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
export class SolanaPaymentInstruction {
|
|
124
|
+
recipient: Uint8Array;
|
|
125
|
+
amount: bigint;
|
|
126
|
+
expiration_date: bigint;
|
|
127
|
+
nonce: bigint;
|
|
128
|
+
metadata: Uint8Array;
|
|
129
|
+
signature: Uint8Array;
|
|
130
|
+
|
|
131
|
+
constructor(fields: {
|
|
132
|
+
recipient: Uint8Array;
|
|
133
|
+
amount: bigint;
|
|
134
|
+
expiration_date: bigint;
|
|
135
|
+
nonce: bigint;
|
|
136
|
+
metadata: Uint8Array;
|
|
137
|
+
signature: Uint8Array;
|
|
138
|
+
}) {
|
|
139
|
+
this.recipient = fields.recipient;
|
|
140
|
+
this.amount = fields.amount;
|
|
141
|
+
this.expiration_date = fields.expiration_date;
|
|
142
|
+
this.nonce = fields.nonce;
|
|
143
|
+
this.metadata = fields.metadata;
|
|
144
|
+
this.signature = fields.signature;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export const SolanaPaymentInstructionSchema: Schema = new Map([
|
|
149
|
+
[
|
|
150
|
+
SolanaPaymentInstruction,
|
|
151
|
+
{
|
|
152
|
+
kind: 'struct',
|
|
153
|
+
fields: [
|
|
154
|
+
['recipient', ['u8', 32]],
|
|
155
|
+
['amount', 'u64'],
|
|
156
|
+
['expiration_date', 'u64'],
|
|
157
|
+
['nonce', 'u64'],
|
|
158
|
+
['metadata', ['u8']],
|
|
159
|
+
['signature', [64]]
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
]);
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @beta
|
|
167
|
+
* buildSolanaPayment creates an Solana-based payment request and signs it using ed25519.
|
|
168
|
+
* @param {Keypair} solSigner - Keypair for signing the payment request
|
|
169
|
+
* @param {MultiChainPaymentConfigOption} option - payment option configuration
|
|
170
|
+
* @param {string} chainId - EVM chain ID
|
|
171
|
+
* @param {string} paymentRails - payment rails contract address
|
|
172
|
+
* @param {string} recipient - recipient address
|
|
173
|
+
* @param {bigint} amount - payment amount in smallest units
|
|
174
|
+
* @param {Date} expirationDateRequired - expiration date
|
|
175
|
+
* @param {bigint} nonce - unique nonce for the payment
|
|
176
|
+
* @returns {Promise<Iden3PaymentRailsSolanaRequestV1 | Iden3PaymentRailsSolanaSPLRequestV1>} payment request object
|
|
177
|
+
*/
|
|
178
|
+
export const buildSolanaPayment = async (
|
|
179
|
+
solSigner: Keypair,
|
|
180
|
+
option: MultiChainPaymentConfigOption,
|
|
181
|
+
chainId: string,
|
|
182
|
+
paymentRails: string,
|
|
183
|
+
recipient: string,
|
|
184
|
+
amount: bigint,
|
|
185
|
+
expirationDate: Date,
|
|
186
|
+
nonce: bigint
|
|
187
|
+
): Promise<Iden3PaymentRailsSolanaRequestV1 | Iden3PaymentRailsSolanaSPLRequestV1> => {
|
|
188
|
+
let serialized: Uint8Array;
|
|
189
|
+
const proofVersion =
|
|
190
|
+
option.type === PaymentRequestDataType.Iden3PaymentRailsSolanaRequestV1
|
|
191
|
+
? 'SolanaEd25519NativeV1'
|
|
192
|
+
: 'SolanaEd25519SPLV1';
|
|
193
|
+
let chainRef = chainId;
|
|
194
|
+
switch (chainId) {
|
|
195
|
+
case '101':
|
|
196
|
+
chainRef = SOLANA_CHAIN_REF.DEVNET;
|
|
197
|
+
break;
|
|
198
|
+
case '102':
|
|
199
|
+
chainRef = SOLANA_CHAIN_REF.TESTNET;
|
|
200
|
+
break;
|
|
201
|
+
case '103':
|
|
202
|
+
chainRef = SOLANA_CHAIN_REF.MAINNET;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
if (option.type === PaymentRequestDataType.Iden3PaymentRailsSolanaRequestV1) {
|
|
206
|
+
const request = new SolanaNativePaymentRequest({
|
|
207
|
+
version: byteEncoder.encode(proofVersion),
|
|
208
|
+
chainId: BigInt(chainId),
|
|
209
|
+
verifyingContract: new PublicKey(paymentRails).toBytes(),
|
|
210
|
+
recipient: new PublicKey(recipient).toBytes(),
|
|
211
|
+
amount: BigInt(amount),
|
|
212
|
+
expirationDate: BigInt(getUnixTimestamp(expirationDate)),
|
|
213
|
+
nonce: nonce,
|
|
214
|
+
metadata: byteEncoder.encode('0x')
|
|
215
|
+
});
|
|
216
|
+
serialized = serialize(SolanaNativePaymentSchema, request);
|
|
217
|
+
} else {
|
|
218
|
+
if (!option.contractAddress) {
|
|
219
|
+
throw new Error(`failed request. no contract address for ${option.type} payment type`);
|
|
220
|
+
}
|
|
221
|
+
const request = new SolanaSplPaymentRequest({
|
|
222
|
+
version: byteEncoder.encode(proofVersion),
|
|
223
|
+
chainId: BigInt(chainId),
|
|
224
|
+
verifyingContract: new PublicKey(paymentRails).toBytes(),
|
|
225
|
+
tokenAddress: new PublicKey(option.contractAddress).toBytes(),
|
|
226
|
+
recipient: new PublicKey(recipient).toBytes(),
|
|
227
|
+
amount: BigInt(amount),
|
|
228
|
+
expirationDate: BigInt(getUnixTimestamp(expirationDate)),
|
|
229
|
+
nonce: nonce,
|
|
230
|
+
metadata: byteEncoder.encode('0x')
|
|
231
|
+
});
|
|
232
|
+
serialized = serialize(SolanaSplPaymentSchema, request);
|
|
233
|
+
}
|
|
234
|
+
const privateKey = solSigner.secretKey.slice(0, 32);
|
|
235
|
+
const signature = await ed25519.sign(serialized, privateKey);
|
|
236
|
+
const proof: Iden3SolanaEd25519SignatureV1[] = [
|
|
237
|
+
{
|
|
238
|
+
type: SupportedPaymentProofType.SolanaEd25519Signature2025,
|
|
239
|
+
proofPurpose: 'assertionMethod',
|
|
240
|
+
proofValue: Buffer.from(signature).toString('hex'),
|
|
241
|
+
created: new Date().toISOString(),
|
|
242
|
+
verificationMethod: `did:pkh:solana:${chainRef}:${solSigner.publicKey.toBase58()}`,
|
|
243
|
+
domain: {
|
|
244
|
+
version: proofVersion,
|
|
245
|
+
chainId,
|
|
246
|
+
verifyingContract: paymentRails
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
];
|
|
250
|
+
const d: Iden3PaymentRailsSolanaRequestV1 = {
|
|
251
|
+
type: PaymentRequestDataType.Iden3PaymentRailsSolanaRequestV1,
|
|
252
|
+
'@context': [
|
|
253
|
+
`https://schema.iden3.io/core/jsonld/payment.jsonld#${option.type}`,
|
|
254
|
+
'https://schema.iden3.io/core/jsonld/solanaEd25519.jsonld'
|
|
255
|
+
],
|
|
256
|
+
recipient,
|
|
257
|
+
amount: amount.toString(),
|
|
258
|
+
expirationDate: expirationDate.toISOString(),
|
|
259
|
+
nonce: nonce.toString(),
|
|
260
|
+
metadata: '0x',
|
|
261
|
+
proof
|
|
262
|
+
};
|
|
263
|
+
if (option.type === PaymentRequestDataType.Iden3PaymentRailsSolanaRequestV1) {
|
|
264
|
+
return d;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return {
|
|
268
|
+
...d,
|
|
269
|
+
type: option.type,
|
|
270
|
+
tokenAddress: option.contractAddress || '',
|
|
271
|
+
features: option.features || []
|
|
272
|
+
} as Iden3PaymentRailsSolanaSPLRequestV1;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export const serializeSolanaPaymentInstruction = (
|
|
276
|
+
data: Iden3PaymentRailsSolanaRequestV1 | Iden3PaymentRailsSolanaSPLRequestV1
|
|
277
|
+
): Uint8Array => {
|
|
278
|
+
let serialized: Uint8Array;
|
|
279
|
+
const proof = Array.isArray(data.proof) ? data.proof[0] : data.proof;
|
|
280
|
+
const proofVersion =
|
|
281
|
+
data.type === PaymentRequestDataType.Iden3PaymentRailsSolanaRequestV1
|
|
282
|
+
? 'SolanaEd25519NativeV1'
|
|
283
|
+
: 'SolanaEd25519SPLV1';
|
|
284
|
+
if (data.type === PaymentRequestDataType.Iden3PaymentRailsSolanaRequestV1) {
|
|
285
|
+
const request = new SolanaNativePaymentRequest({
|
|
286
|
+
version: byteEncoder.encode(proofVersion),
|
|
287
|
+
chainId: BigInt(proof.domain.chainId),
|
|
288
|
+
verifyingContract: new PublicKey(proof.domain.verifyingContract).toBytes(),
|
|
289
|
+
recipient: new PublicKey(data.recipient).toBytes(),
|
|
290
|
+
amount: BigInt(data.amount),
|
|
291
|
+
expirationDate: BigInt(getUnixTimestamp(new Date(data.expirationDate))),
|
|
292
|
+
nonce: BigInt(data.nonce),
|
|
293
|
+
metadata: byteEncoder.encode('0x')
|
|
294
|
+
});
|
|
295
|
+
serialized = serialize(SolanaNativePaymentSchema, request);
|
|
296
|
+
} else {
|
|
297
|
+
const request = new SolanaSplPaymentRequest({
|
|
298
|
+
version: byteEncoder.encode(proofVersion),
|
|
299
|
+
chainId: BigInt(proof.domain.chainId),
|
|
300
|
+
verifyingContract: new PublicKey(proof.domain.verifyingContract).toBytes(),
|
|
301
|
+
tokenAddress: new PublicKey(data.tokenAddress).toBytes(),
|
|
302
|
+
recipient: new PublicKey(data.recipient).toBytes(),
|
|
303
|
+
amount: BigInt(data.amount),
|
|
304
|
+
expirationDate: BigInt(getUnixTimestamp(new Date(data.expirationDate))),
|
|
305
|
+
nonce: BigInt(data.nonce),
|
|
306
|
+
metadata: byteEncoder.encode('0x')
|
|
307
|
+
});
|
|
308
|
+
serialized = serialize(SolanaSplPaymentSchema, request);
|
|
309
|
+
}
|
|
310
|
+
return serialized;
|
|
311
|
+
};
|
|
312
|
+
export const verifyIden3SolanaPaymentRequest = async (
|
|
313
|
+
data: Iden3PaymentRailsSolanaRequestV1 | Iden3PaymentRailsSolanaSPLRequestV1,
|
|
314
|
+
resolver: Resolvable
|
|
315
|
+
): Promise<boolean> => {
|
|
316
|
+
const proof = Array.isArray(data.proof) ? data.proof[0] : data.proof;
|
|
317
|
+
let serialized: Uint8Array;
|
|
318
|
+
if (data.type === PaymentRequestDataType.Iden3PaymentRailsSolanaRequestV1) {
|
|
319
|
+
const request = new SolanaNativePaymentRequest({
|
|
320
|
+
version: byteEncoder.encode(proof.domain.version),
|
|
321
|
+
chainId: BigInt(proof.domain.chainId),
|
|
322
|
+
verifyingContract: new PublicKey(proof.domain.verifyingContract).toBytes(),
|
|
323
|
+
recipient: new PublicKey(data.recipient).toBytes(),
|
|
324
|
+
amount: BigInt(data.amount),
|
|
325
|
+
expirationDate: BigInt(getUnixTimestamp(new Date(data.expirationDate))),
|
|
326
|
+
nonce: BigInt(data.nonce),
|
|
327
|
+
metadata: byteEncoder.encode('0x')
|
|
328
|
+
});
|
|
329
|
+
serialized = serialize(SolanaNativePaymentSchema, request);
|
|
330
|
+
} else {
|
|
331
|
+
const request = new SolanaSplPaymentRequest({
|
|
332
|
+
version: byteEncoder.encode(proof.domain.version),
|
|
333
|
+
chainId: BigInt(proof.domain.chainId),
|
|
334
|
+
verifyingContract: new PublicKey(proof.domain.verifyingContract).toBytes(),
|
|
335
|
+
tokenAddress: new PublicKey(data.tokenAddress).toBytes(),
|
|
336
|
+
recipient: new PublicKey(data.recipient).toBytes(),
|
|
337
|
+
amount: BigInt(data.amount),
|
|
338
|
+
expirationDate: BigInt(getUnixTimestamp(new Date(data.expirationDate))),
|
|
339
|
+
nonce: BigInt(data.nonce),
|
|
340
|
+
metadata: byteEncoder.encode('0x')
|
|
341
|
+
});
|
|
342
|
+
serialized = serialize(SolanaSplPaymentSchema, request);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const { didDocument } = await resolver.resolve(proof.verificationMethod);
|
|
346
|
+
let publicKeyMultibase;
|
|
347
|
+
if (didDocument?.verificationMethod) {
|
|
348
|
+
for (const verificationMethod of didDocument.verificationMethod) {
|
|
349
|
+
if (verificationMethod.type === 'Ed25519VerificationKey2020') {
|
|
350
|
+
publicKeyMultibase = verificationMethod.publicKeyMultibase;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (!publicKeyMultibase) {
|
|
356
|
+
throw new Error('No Ed25519VerificationKey2020 found in DID document');
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return ed25519.verify(proof.proofValue, serialized, new PublicKey(publicKeyMultibase).toBytes());
|
|
360
|
+
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/** Verifiable constants */
|
|
2
|
+
export const VerifiableConstants = Object.freeze({
|
|
3
|
+
ERRORS: {
|
|
4
|
+
FiELD_IS_EMPTY: 'fieldPath is empty',
|
|
5
|
+
CONTEXT_TYPE_IS_EMPTY: 'ctxType is empty',
|
|
6
|
+
// ErrStateNotFound issuer state is genesis state.
|
|
7
|
+
IDENTITY_DOES_NOT_EXIST: 'Identity does not exist',
|
|
8
|
+
IDENTITY_DOES_NOT_EXIST_CUSTOM_ERROR: 'IdentityDoesNotExist',
|
|
9
|
+
NO_AUTH_CRED_FOUND: 'no auth credentials found',
|
|
10
|
+
STATE_DOES_NOT_EXIST: 'State does not exist',
|
|
11
|
+
STATE_DOES_NOT_EXIST_CUSTOM_ERROR: 'StateDoesNotExist',
|
|
12
|
+
ROOT_DOES_NOT_EXIST: 'Root does not exist',
|
|
13
|
+
ROOT_DOES_NOT_EXIST_CUSTOM_ERROR: 'RootDoesNotExist',
|
|
14
|
+
|
|
15
|
+
// identity wallet
|
|
16
|
+
|
|
17
|
+
ID_WALLET_NO_CREDENTIAL_SATISFIED_QUERY: 'no credential satisfied query',
|
|
18
|
+
ID_WALLET_SIGNER_IS_REQUIRED:
|
|
19
|
+
'Ethereum signer is required to create Ethereum identities in order to transit state',
|
|
20
|
+
ID_WALLET_PROVER_IS_REQUIRED:
|
|
21
|
+
'prover is required to generate proofs for non ethereum identities',
|
|
22
|
+
ID_WALLET_CORE_CLAIM_REQUIRED_IN_SIG_PROOF:
|
|
23
|
+
'credential must have coreClaim representation in the signature proof',
|
|
24
|
+
ID_WALLET_CORE_CLAIM_REQUIRED_IN_ANY_PROOF:
|
|
25
|
+
'credential must have coreClaim representation in proofs',
|
|
26
|
+
ID_WALLET_CORE_CLAIM_MISMATCH:
|
|
27
|
+
'core claim representations is set in both proofs but they are not equal',
|
|
28
|
+
ID_WALLET_CORE_CLAIM_IS_NOT_SET: 'core claim is not set in credential proofs',
|
|
29
|
+
ID_WALLET_PROFILE_OR_IDENTITY_NOT_FOUND: 'profile or identity not found',
|
|
30
|
+
ID_WALLET_PROFILE_ALREADY_EXISTS: 'profile with given nonce or verifier already exists',
|
|
31
|
+
ID_WALLET_PROFILE_ALREADY_EXISTS_VERIFIER_TAGS:
|
|
32
|
+
'profile with given verifier and tags already exists',
|
|
33
|
+
ID_WALLET_ISSUER_AUTH_BJJ_CRED_MUST_HAVE_ANY_PROOF: 'issuer auth credential must have proof',
|
|
34
|
+
ID_WALLET_ISSUER_AUTH_BJJ_CRED_MUST_HAVE_MTP_PROOF:
|
|
35
|
+
'mtp is required for auth bjj key to issue new credentials',
|
|
36
|
+
|
|
37
|
+
// proof service
|
|
38
|
+
|
|
39
|
+
PROOF_SERVICE_NO_CREDENTIAL_FOR_IDENTITY_OR_PROFILE:
|
|
40
|
+
'no credentials belong to did or its profiles',
|
|
41
|
+
PROOF_SERVICE_NO_CREDENTIAL_FOR_QUERY: 'credential not found for query',
|
|
42
|
+
PROOF_SERVICE_PROFILE_GENESIS_DID_MISMATCH:
|
|
43
|
+
'subject and auth profiles are not derived from the same did',
|
|
44
|
+
PROOF_SERVICE_NO_QUERIES_IN_ZKP_REQUEST: 'no queries in zkp request',
|
|
45
|
+
|
|
46
|
+
// credential wallet
|
|
47
|
+
|
|
48
|
+
CREDENTIAL_WALLET_ALL_CREDENTIALS_ARE_REVOKED: 'all claims are revoked'
|
|
49
|
+
},
|
|
50
|
+
CREDENTIAL_TYPE: {
|
|
51
|
+
// VerifiableCredential is a W3C verifiable credential type
|
|
52
|
+
W3C_VERIFIABLE_CREDENTIAL: 'VerifiableCredential',
|
|
53
|
+
W3C_VERIFIABLE_PRESENTATION: 'VerifiablePresentation'
|
|
54
|
+
},
|
|
55
|
+
CREDENTIAL_SUBJECT_PATH: 'https://www.w3.org/2018/credentials#credentialSubject',
|
|
56
|
+
JSONLD_SCHEMA: {
|
|
57
|
+
// JSONLDSchemaIden3Credential is a schema for context with Iden3Credential type
|
|
58
|
+
IDEN3_CREDENTIAL: 'https://schema.iden3.io/core/jsonld/iden3proofs.jsonld',
|
|
59
|
+
// JSONLDSchemaIden3DisplayMethod is a schema for context with Iden3BasicDisplayMethodV1 type
|
|
60
|
+
IDEN3_DISPLAY_METHOD: 'https://schema.iden3.io/core/jsonld/displayMethod.jsonld',
|
|
61
|
+
// JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type
|
|
62
|
+
W3C_CREDENTIAL_2018: 'https://www.w3.org/2018/credentials/v1',
|
|
63
|
+
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"}}}`,
|
|
64
|
+
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"}}`,
|
|
65
|
+
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"}}}}`
|
|
66
|
+
},
|
|
67
|
+
// JsonSchema2023 JSON schema for verification of Iden3Credential
|
|
68
|
+
JSON_SCHEMA_VALIDATOR: 'JsonSchema2023',
|
|
69
|
+
SERVICE_TYPE: {
|
|
70
|
+
// Iden3CommServiceType is service type for iden3comm protocol
|
|
71
|
+
IDEN3_COMM: 'iden3-communication',
|
|
72
|
+
// PushNotificationServiceType is service type for delivering push notifications to identity
|
|
73
|
+
PUSH_NOTIFICATION: 'push-notification'
|
|
74
|
+
},
|
|
75
|
+
AUTH: {
|
|
76
|
+
AUTH_BJJ_CREDENTIAL_HASH: '013fd3f623559d850fb5b02ff012d0e2',
|
|
77
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: 'https://schema.iden3.io/core/json/auth.json',
|
|
78
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: 'https://schema.iden3.io/core/jsonld/auth.jsonld',
|
|
79
|
+
AUTH_BJJ_CREDENTIAL_TYPE: 'AuthBJJCredential',
|
|
80
|
+
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"}}}}}`,
|
|
81
|
+
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"}}}}}}]}`
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Proof type for Verifiable Credential supported by sdk
|
|
87
|
+
*
|
|
88
|
+
* @enum {number}
|
|
89
|
+
*/
|
|
90
|
+
export enum ProofType {
|
|
91
|
+
// BJJSignatureProofType
|
|
92
|
+
BJJSignature = 'BJJSignature2021',
|
|
93
|
+
// Iden3SparseMerkleTreeProofType
|
|
94
|
+
Iden3SparseMerkleTreeProof = 'Iden3SparseMerkleTreeProof'
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* CredentialStatusType type for revocation type
|
|
99
|
+
*
|
|
100
|
+
* @enum {number}
|
|
101
|
+
*/
|
|
102
|
+
export enum CredentialStatusType {
|
|
103
|
+
// SparseMerkleTreeProof is CredentialStatusType for standard MTP result handlers
|
|
104
|
+
SparseMerkleTreeProof = 'SparseMerkleTreeProof',
|
|
105
|
+
// Iden3ReverseSparseMerkleTreeProof is CredentialStatusType for reverse iden3 algorithm
|
|
106
|
+
Iden3ReverseSparseMerkleTreeProof = 'Iden3ReverseSparseMerkleTreeProof',
|
|
107
|
+
// Iden3commRevocationStatusV1 is CredentialStatusType for iden3comm revocation status
|
|
108
|
+
Iden3commRevocationStatusV1 = 'Iden3commRevocationStatusV1.0',
|
|
109
|
+
// Iden3OnchainSparseMerkleTreeProof2023 is a proof type for MTP proofs with iden3 metadata from blockchain
|
|
110
|
+
Iden3OnchainSparseMerkleTreeProof2023 = 'Iden3OnchainSparseMerkleTreeProof2023'
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* W3C Proof purpose
|
|
115
|
+
*
|
|
116
|
+
* @enum {number}
|
|
117
|
+
*/
|
|
118
|
+
export enum ProofPurpose {
|
|
119
|
+
Authentication = 'Authentication'
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Merklized Core.Claim root position for vc creation
|
|
124
|
+
*
|
|
125
|
+
* @enum {number}
|
|
126
|
+
*/
|
|
127
|
+
export enum MerklizedRootPosition {
|
|
128
|
+
// PositionIndex merklized root is stored in index.
|
|
129
|
+
Index = 'index',
|
|
130
|
+
// Value merklized root is stored in value.
|
|
131
|
+
Value = 'value',
|
|
132
|
+
// None merklized root is not stored in the claim. By Default.
|
|
133
|
+
None = ''
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Subject Core.Claim position for vc creation
|
|
138
|
+
*
|
|
139
|
+
* @enum {number}
|
|
140
|
+
*/
|
|
141
|
+
export enum SubjectPosition {
|
|
142
|
+
// CredentialSubjectPositionNone is for self issued Iden3Credential
|
|
143
|
+
None = '',
|
|
144
|
+
// Index save subject in index part of claim. By default.
|
|
145
|
+
Index = 'index',
|
|
146
|
+
// Value save subject in value part of claim.
|
|
147
|
+
Value = 'value'
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* RefreshServiceType type for refreshService
|
|
152
|
+
*
|
|
153
|
+
* @enum {string}
|
|
154
|
+
*/
|
|
155
|
+
export enum RefreshServiceType {
|
|
156
|
+
Iden3RefreshService2023 = 'Iden3RefreshService2023'
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* PaymentRequestDataType type for payment requests
|
|
161
|
+
* @beta
|
|
162
|
+
* @enum {string}
|
|
163
|
+
*/
|
|
164
|
+
export enum PaymentRequestDataType {
|
|
165
|
+
Iden3PaymentRequestCryptoV1 = 'Iden3PaymentRequestCryptoV1',
|
|
166
|
+
Iden3PaymentRailsRequestV1 = 'Iden3PaymentRailsRequestV1',
|
|
167
|
+
Iden3PaymentRailsERC20RequestV1 = 'Iden3PaymentRailsERC20RequestV1',
|
|
168
|
+
Iden3PaymentRailsSolanaRequestV1 = 'Iden3PaymentRailsSolanaRequestV1',
|
|
169
|
+
Iden3PaymentRailsSolanaSPLRequestV1 = 'Iden3PaymentRailsSolanaSPLRequestV1'
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* PaymentType type for payment responses
|
|
174
|
+
* @beta
|
|
175
|
+
* @enum {string}
|
|
176
|
+
*/
|
|
177
|
+
export enum PaymentType {
|
|
178
|
+
Iden3PaymentCryptoV1 = 'Iden3PaymentCryptoV1',
|
|
179
|
+
Iden3PaymentRailsV1 = 'Iden3PaymentRailsV1',
|
|
180
|
+
Iden3PaymentRailsERC20V1 = 'Iden3PaymentRailsERC20V1',
|
|
181
|
+
Iden3PaymentRailsSolanaV1 = 'Iden3PaymentRailsSolanaV1',
|
|
182
|
+
Iden3PaymentRailsSolanaSPLV1 = 'Iden3PaymentRailsSolanaSPLV1'
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* SupportedPaymentProofType type for payment proofs
|
|
187
|
+
* @beta
|
|
188
|
+
* @enum {string}
|
|
189
|
+
*/
|
|
190
|
+
export enum SupportedPaymentProofType {
|
|
191
|
+
EthereumEip712Signature2021 = 'EthereumEip712Signature2021',
|
|
192
|
+
SolanaEd25519Signature2025 = 'SolanaEd25519Signature2025'
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Media types for Payment supported currencies
|
|
197
|
+
* @beta
|
|
198
|
+
* @deprecated
|
|
199
|
+
* @enum {string}
|
|
200
|
+
*/
|
|
201
|
+
export enum SupportedCurrencies {
|
|
202
|
+
ETH = 'ETH',
|
|
203
|
+
ETH_WEI = 'ETHWEI',
|
|
204
|
+
ETH_GWEI = 'ETHGWEI',
|
|
205
|
+
MATIC = 'MATIC',
|
|
206
|
+
POL = 'POL'
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Supported features for payment-request
|
|
211
|
+
* @beta
|
|
212
|
+
* @enum {string}
|
|
213
|
+
*/
|
|
214
|
+
export enum PaymentFeatures {
|
|
215
|
+
EIP_2612 = 'EIP-2612'
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* DisplayMethodType type for display method
|
|
220
|
+
*
|
|
221
|
+
* @enum {string}
|
|
222
|
+
*/
|
|
223
|
+
export enum DisplayMethodType {
|
|
224
|
+
Iden3BasicDisplayMethodV1 = 'Iden3BasicDisplayMethodV1'
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Default cache max size for in-memory cache
|
|
229
|
+
*/
|
|
230
|
+
export const DEFAULT_CACHE_MAX_SIZE = 10_000;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Solana chain reference
|
|
234
|
+
*/
|
|
235
|
+
export const SOLANA_CHAIN_REF = Object.freeze({
|
|
236
|
+
DEVNET: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
|
|
237
|
+
TESTNET: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z',
|
|
238
|
+
MAINNET: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
|
|
239
|
+
});
|