@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,627 @@
|
|
|
1
|
+
import { DID, getUnixTimestamp } from '@mocanetwork/moca-iden3';
|
|
2
|
+
import {
|
|
3
|
+
Iden3SparseMerkleTreeProof,
|
|
4
|
+
ProofType,
|
|
5
|
+
RevocationStatus,
|
|
6
|
+
W3CCredential
|
|
7
|
+
} from '../../verifiable';
|
|
8
|
+
import { ZeroKnowledgeProofRequest } from '../../iden3comm';
|
|
9
|
+
import {
|
|
10
|
+
AtomicQueryMTPV2Inputs,
|
|
11
|
+
AtomicQueryMTPV2OnChainInputs,
|
|
12
|
+
AtomicQuerySigV2Inputs,
|
|
13
|
+
AtomicQuerySigV2OnChainInputs,
|
|
14
|
+
AtomicQueryV3Inputs,
|
|
15
|
+
AtomicQueryV3OnChainInputs,
|
|
16
|
+
CircuitClaim,
|
|
17
|
+
CircuitId,
|
|
18
|
+
LinkedMultiQueryInputs,
|
|
19
|
+
MTProof,
|
|
20
|
+
Operators,
|
|
21
|
+
Query,
|
|
22
|
+
QueryOperators,
|
|
23
|
+
TreeState,
|
|
24
|
+
getOperatorNameByValue
|
|
25
|
+
} from '../../circuits';
|
|
26
|
+
import {
|
|
27
|
+
PreparedAuthBJJCredential,
|
|
28
|
+
PreparedCredential,
|
|
29
|
+
toClaimNonRevStatus,
|
|
30
|
+
toGISTProof
|
|
31
|
+
} from '../common';
|
|
32
|
+
import { IIdentityWallet } from '../../identity';
|
|
33
|
+
import { IStateStorage } from '../../storage';
|
|
34
|
+
import {
|
|
35
|
+
CredentialStatusResolveOptions,
|
|
36
|
+
ICredentialWallet,
|
|
37
|
+
getUserDIDFromCredential
|
|
38
|
+
} from '../../credentials';
|
|
39
|
+
import { isEthereumIdentity } from '../../utils';
|
|
40
|
+
|
|
41
|
+
export type DIDProfileMetadata = {
|
|
42
|
+
authProfileNonce: number | string;
|
|
43
|
+
credentialSubjectProfileNonce: number | string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type ProofGenerationOptions = {
|
|
47
|
+
skipRevocation: boolean;
|
|
48
|
+
challenge?: bigint;
|
|
49
|
+
credential?: W3CCredential;
|
|
50
|
+
credentialRevocationStatus?: RevocationStatus;
|
|
51
|
+
verifierDid?: DID;
|
|
52
|
+
linkNonce?: bigint;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type AuthProofGenerationOptions = {
|
|
56
|
+
challenge?: bigint;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type ProofInputsParams = ProofGenerationOptions & DIDProfileMetadata;
|
|
60
|
+
|
|
61
|
+
type InputContext = {
|
|
62
|
+
preparedCredential: PreparedCredential;
|
|
63
|
+
identifier: DID;
|
|
64
|
+
proofReq: ZeroKnowledgeProofRequest;
|
|
65
|
+
params: ProofInputsParams;
|
|
66
|
+
circuitQueries: Query[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const allOperations = Object.values(QueryOperators);
|
|
70
|
+
const v2Operations = [
|
|
71
|
+
Operators.NOOP,
|
|
72
|
+
Operators.EQ,
|
|
73
|
+
Operators.LT,
|
|
74
|
+
Operators.GT,
|
|
75
|
+
Operators.IN,
|
|
76
|
+
Operators.NIN,
|
|
77
|
+
Operators.NE,
|
|
78
|
+
Operators.SD
|
|
79
|
+
];
|
|
80
|
+
const v2OnChainOperations = [
|
|
81
|
+
Operators.EQ,
|
|
82
|
+
Operators.LT,
|
|
83
|
+
Operators.GT,
|
|
84
|
+
Operators.IN,
|
|
85
|
+
Operators.NIN,
|
|
86
|
+
Operators.NE
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
export const circuitValidator: {
|
|
90
|
+
[k in CircuitId]: { maxQueriesCount: number; supportedOperations: Operators[] };
|
|
91
|
+
} = {
|
|
92
|
+
[CircuitId.AtomicQueryMTPV2]: { maxQueriesCount: 1, supportedOperations: v2Operations },
|
|
93
|
+
[CircuitId.AtomicQueryMTPV2OnChain]: {
|
|
94
|
+
maxQueriesCount: 1,
|
|
95
|
+
supportedOperations: v2OnChainOperations
|
|
96
|
+
},
|
|
97
|
+
[CircuitId.AtomicQuerySigV2]: { maxQueriesCount: 1, supportedOperations: v2Operations },
|
|
98
|
+
[CircuitId.AtomicQuerySigV2OnChain]: {
|
|
99
|
+
maxQueriesCount: 1,
|
|
100
|
+
supportedOperations: v2OnChainOperations
|
|
101
|
+
},
|
|
102
|
+
[CircuitId.AtomicQueryV3]: { maxQueriesCount: 1, supportedOperations: allOperations },
|
|
103
|
+
[CircuitId.AtomicQueryV3OnChain]: { maxQueriesCount: 1, supportedOperations: allOperations },
|
|
104
|
+
[CircuitId.AuthV2]: { maxQueriesCount: 0, supportedOperations: [] },
|
|
105
|
+
[CircuitId.StateTransition]: { maxQueriesCount: 0, supportedOperations: [] },
|
|
106
|
+
[CircuitId.LinkedMultiQuery10]: { maxQueriesCount: 10, supportedOperations: allOperations }
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export class InputGenerator {
|
|
110
|
+
constructor(
|
|
111
|
+
private readonly _identityWallet: IIdentityWallet,
|
|
112
|
+
private readonly _credentialWallet: ICredentialWallet,
|
|
113
|
+
private readonly _stateStorage: IStateStorage
|
|
114
|
+
) {}
|
|
115
|
+
|
|
116
|
+
async generateInputs(ctx: InputContext): Promise<Uint8Array> {
|
|
117
|
+
const { circuitId } = ctx.proofReq;
|
|
118
|
+
const fnName = `${circuitId.split('-')[0]}PrepareInputs`;
|
|
119
|
+
|
|
120
|
+
const queriesLength = ctx.circuitQueries.length;
|
|
121
|
+
|
|
122
|
+
if (queriesLength > circuitValidator[circuitId as CircuitId].maxQueriesCount) {
|
|
123
|
+
throw new Error(
|
|
124
|
+
`circuit ${circuitId} supports only ${
|
|
125
|
+
circuitValidator[circuitId as CircuitId].maxQueriesCount
|
|
126
|
+
} queries`
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const fn = (this as unknown as { [k: string]: (ctx: InputContext) => Promise<Uint8Array> })[
|
|
131
|
+
fnName
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
if (!fn) {
|
|
135
|
+
throw new Error(`inputs generator for ${circuitId} not found`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return fn(ctx);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async newCircuitClaimData(preparedCredential: PreparedCredential): Promise<CircuitClaim> {
|
|
142
|
+
const smtProof: Iden3SparseMerkleTreeProof | undefined =
|
|
143
|
+
preparedCredential.credential.getIden3SparseMerkleTreeProof();
|
|
144
|
+
|
|
145
|
+
const circuitClaim = new CircuitClaim();
|
|
146
|
+
circuitClaim.claim = preparedCredential.credentialCoreClaim;
|
|
147
|
+
circuitClaim.issuerId = DID.idFromDID(DID.parse(preparedCredential.credential.issuer));
|
|
148
|
+
|
|
149
|
+
if (smtProof) {
|
|
150
|
+
circuitClaim.proof = smtProof.mtp;
|
|
151
|
+
circuitClaim.treeState = {
|
|
152
|
+
state: smtProof.issuerData.state.value,
|
|
153
|
+
claimsRoot: smtProof.issuerData.state.claimsTreeRoot,
|
|
154
|
+
revocationRoot: smtProof.issuerData.state.revocationTreeRoot,
|
|
155
|
+
rootOfRoots: smtProof.issuerData.state.rootOfRoots
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const sigProof = preparedCredential.credential.getBJJSignature2021Proof();
|
|
160
|
+
|
|
161
|
+
if (sigProof) {
|
|
162
|
+
const issuerDID = sigProof.issuerData.id;
|
|
163
|
+
const userDID: DID = getUserDIDFromCredential(issuerDID, preparedCredential.credential);
|
|
164
|
+
|
|
165
|
+
const { credentialStatus, mtp, authCoreClaim } = sigProof.issuerData;
|
|
166
|
+
|
|
167
|
+
if (!credentialStatus) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
"can't check the validity of issuer auth claim: no credential status in proof"
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!mtp) {
|
|
174
|
+
throw new Error('issuer auth credential must have a mtp proof');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (!authCoreClaim) {
|
|
178
|
+
throw new Error('issuer auth credential must have a core claim proof');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const opts: CredentialStatusResolveOptions = {
|
|
182
|
+
issuerGenesisState: sigProof.issuerData.state,
|
|
183
|
+
issuerDID,
|
|
184
|
+
userDID
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const rs = await this._credentialWallet.getRevocationStatus(credentialStatus, opts);
|
|
188
|
+
|
|
189
|
+
const issuerAuthNonRevProof: MTProof = toClaimNonRevStatus(rs);
|
|
190
|
+
|
|
191
|
+
circuitClaim.signatureProof = {
|
|
192
|
+
signature: sigProof.signature,
|
|
193
|
+
issuerAuthIncProof: {
|
|
194
|
+
proof: sigProof.issuerData.mtp,
|
|
195
|
+
treeState: {
|
|
196
|
+
state: sigProof.issuerData.state.value,
|
|
197
|
+
claimsRoot: sigProof.issuerData.state.claimsTreeRoot,
|
|
198
|
+
revocationRoot: sigProof.issuerData.state.revocationTreeRoot,
|
|
199
|
+
rootOfRoots: sigProof.issuerData.state.rootOfRoots
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
issuerAuthClaim: sigProof.issuerData.authCoreClaim,
|
|
203
|
+
issuerAuthNonRevProof
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return circuitClaim;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
async prepareAuthBJJCredential(
|
|
211
|
+
did: DID,
|
|
212
|
+
treeStateInfo?: TreeState
|
|
213
|
+
): Promise<PreparedAuthBJJCredential> {
|
|
214
|
+
const { authCredential, incProof, nonRevProof } =
|
|
215
|
+
await this._identityWallet.getActualAuthCredential(did, treeStateInfo);
|
|
216
|
+
|
|
217
|
+
const authCoreClaim = authCredential.getCoreClaimFromProof(
|
|
218
|
+
ProofType.Iden3SparseMerkleTreeProof
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
if (!authCoreClaim) {
|
|
222
|
+
throw new Error('auth core claim is not defined for auth bjj credential');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
credential: authCredential,
|
|
227
|
+
incProof,
|
|
228
|
+
nonRevProof,
|
|
229
|
+
coreClaim: authCoreClaim
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private credentialAtomicQueryMTPV2PrepareInputs = async ({
|
|
234
|
+
preparedCredential,
|
|
235
|
+
identifier,
|
|
236
|
+
proofReq,
|
|
237
|
+
params,
|
|
238
|
+
circuitQueries
|
|
239
|
+
}: InputContext): Promise<Uint8Array> => {
|
|
240
|
+
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
241
|
+
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
242
|
+
const circuitInputs = new AtomicQueryMTPV2Inputs();
|
|
243
|
+
circuitInputs.id = DID.idFromDID(identifier);
|
|
244
|
+
circuitInputs.requestID = BigInt(proofReq.id);
|
|
245
|
+
|
|
246
|
+
const query = circuitQueries[0];
|
|
247
|
+
query.operator = this.transformV2QueryOperator(query.operator);
|
|
248
|
+
circuitInputs.query = query;
|
|
249
|
+
circuitInputs.claim = {
|
|
250
|
+
issuerID: circuitClaimData.issuerId,
|
|
251
|
+
claim: circuitClaimData.claim,
|
|
252
|
+
incProof: { proof: circuitClaimData.proof, treeState: circuitClaimData.treeState },
|
|
253
|
+
nonRevProof: circuitClaimData.nonRevProof
|
|
254
|
+
};
|
|
255
|
+
circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
|
|
256
|
+
circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
|
|
257
|
+
circuitInputs.profileNonce = BigInt(params.authProfileNonce);
|
|
258
|
+
circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
|
|
259
|
+
|
|
260
|
+
this.checkOperatorSupport(proofReq.circuitId, query.operator);
|
|
261
|
+
|
|
262
|
+
return circuitInputs.inputsMarshal();
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
private credentialAtomicQueryMTPV2OnChainPrepareInputs = async ({
|
|
266
|
+
preparedCredential,
|
|
267
|
+
identifier,
|
|
268
|
+
proofReq,
|
|
269
|
+
params,
|
|
270
|
+
circuitQueries
|
|
271
|
+
}: InputContext): Promise<Uint8Array> => {
|
|
272
|
+
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
273
|
+
|
|
274
|
+
const authInfo = await this.prepareAuthBJJCredential(identifier);
|
|
275
|
+
|
|
276
|
+
const authClaimData = await this.newCircuitClaimData({
|
|
277
|
+
credential: authInfo.credential,
|
|
278
|
+
credentialCoreClaim: authInfo.coreClaim
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
282
|
+
|
|
283
|
+
const circuitInputs = new AtomicQueryMTPV2OnChainInputs();
|
|
284
|
+
const id = DID.idFromDID(identifier);
|
|
285
|
+
circuitInputs.id = DID.idFromDID(identifier);
|
|
286
|
+
circuitInputs.requestID = BigInt(proofReq.id);
|
|
287
|
+
|
|
288
|
+
const stateProof = await this._stateStorage.getGISTProof(id.bigInt());
|
|
289
|
+
|
|
290
|
+
const gistProof = toGISTProof(stateProof);
|
|
291
|
+
circuitInputs.gistProof = gistProof;
|
|
292
|
+
|
|
293
|
+
if (authClaimData?.treeState) {
|
|
294
|
+
circuitInputs.treeState = {
|
|
295
|
+
state: authClaimData?.treeState?.state,
|
|
296
|
+
claimsRoot: authClaimData?.treeState?.claimsRoot,
|
|
297
|
+
revocationRoot: authClaimData?.treeState?.revocationRoot,
|
|
298
|
+
rootOfRoots: authClaimData?.treeState?.rootOfRoots
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
circuitInputs.authClaim = authClaimData.claim;
|
|
303
|
+
circuitInputs.authClaimIncMtp = authClaimData.proof;
|
|
304
|
+
circuitInputs.authClaimNonRevMtp = authInfo.nonRevProof.proof;
|
|
305
|
+
if (!params.challenge) {
|
|
306
|
+
throw new Error('challenge must be provided for onchain circuits');
|
|
307
|
+
}
|
|
308
|
+
const signature = await this._identityWallet.signChallenge(
|
|
309
|
+
params.challenge,
|
|
310
|
+
authInfo.credential
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
circuitInputs.signature = signature;
|
|
314
|
+
circuitInputs.challenge = params.challenge;
|
|
315
|
+
|
|
316
|
+
const query = circuitQueries[0];
|
|
317
|
+
circuitInputs.query = query;
|
|
318
|
+
circuitInputs.claim = {
|
|
319
|
+
issuerID: circuitClaimData.issuerId,
|
|
320
|
+
claim: circuitClaimData.claim,
|
|
321
|
+
incProof: { proof: circuitClaimData.proof, treeState: circuitClaimData.treeState },
|
|
322
|
+
nonRevProof: circuitClaimData.nonRevProof
|
|
323
|
+
};
|
|
324
|
+
circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
|
|
325
|
+
circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
|
|
326
|
+
circuitInputs.profileNonce = BigInt(params.authProfileNonce);
|
|
327
|
+
circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
|
|
328
|
+
|
|
329
|
+
this.checkOperatorSupport(proofReq.circuitId, query.operator);
|
|
330
|
+
|
|
331
|
+
return circuitInputs.inputsMarshal();
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
private credentialAtomicQuerySigV2PrepareInputs = async ({
|
|
335
|
+
preparedCredential,
|
|
336
|
+
identifier,
|
|
337
|
+
proofReq,
|
|
338
|
+
params,
|
|
339
|
+
circuitQueries
|
|
340
|
+
}: InputContext): Promise<Uint8Array> => {
|
|
341
|
+
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
342
|
+
|
|
343
|
+
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
344
|
+
|
|
345
|
+
const circuitInputs = new AtomicQuerySigV2Inputs();
|
|
346
|
+
circuitInputs.id = DID.idFromDID(identifier);
|
|
347
|
+
circuitInputs.claim = {
|
|
348
|
+
issuerID: circuitClaimData?.issuerId,
|
|
349
|
+
signatureProof: circuitClaimData.signatureProof,
|
|
350
|
+
claim: circuitClaimData.claim,
|
|
351
|
+
nonRevProof: circuitClaimData.nonRevProof
|
|
352
|
+
};
|
|
353
|
+
circuitInputs.requestID = BigInt(proofReq.id);
|
|
354
|
+
circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
|
|
355
|
+
circuitInputs.profileNonce = BigInt(params.authProfileNonce);
|
|
356
|
+
circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
|
|
357
|
+
|
|
358
|
+
const query = circuitQueries[0];
|
|
359
|
+
query.operator = this.transformV2QueryOperator(query.operator);
|
|
360
|
+
circuitInputs.query = query;
|
|
361
|
+
circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
|
|
362
|
+
|
|
363
|
+
this.checkOperatorSupport(proofReq.circuitId, query.operator);
|
|
364
|
+
|
|
365
|
+
return circuitInputs.inputsMarshal();
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
private credentialAtomicQuerySigV2OnChainPrepareInputs = async ({
|
|
369
|
+
preparedCredential,
|
|
370
|
+
identifier,
|
|
371
|
+
proofReq,
|
|
372
|
+
params,
|
|
373
|
+
circuitQueries
|
|
374
|
+
}: InputContext): Promise<Uint8Array> => {
|
|
375
|
+
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
376
|
+
|
|
377
|
+
const authInfo = await this.prepareAuthBJJCredential(identifier);
|
|
378
|
+
|
|
379
|
+
const authClaimData = await this.newCircuitClaimData({
|
|
380
|
+
credential: authInfo.credential,
|
|
381
|
+
credentialCoreClaim: authInfo.coreClaim
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
385
|
+
|
|
386
|
+
const circuitInputs = new AtomicQuerySigV2OnChainInputs();
|
|
387
|
+
const id = DID.idFromDID(identifier);
|
|
388
|
+
circuitInputs.id = id;
|
|
389
|
+
circuitInputs.claim = {
|
|
390
|
+
issuerID: circuitClaimData.issuerId,
|
|
391
|
+
signatureProof: circuitClaimData.signatureProof,
|
|
392
|
+
claim: circuitClaimData.claim,
|
|
393
|
+
nonRevProof: circuitClaimData.nonRevProof
|
|
394
|
+
};
|
|
395
|
+
circuitInputs.requestID = BigInt(proofReq.id);
|
|
396
|
+
circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
|
|
397
|
+
circuitInputs.profileNonce = BigInt(params.authProfileNonce);
|
|
398
|
+
circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
|
|
399
|
+
|
|
400
|
+
const query = circuitQueries[0];
|
|
401
|
+
circuitInputs.query = query;
|
|
402
|
+
circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
|
|
403
|
+
|
|
404
|
+
if (authClaimData.treeState) {
|
|
405
|
+
circuitInputs.treeState = {
|
|
406
|
+
state: authClaimData.treeState?.state,
|
|
407
|
+
claimsRoot: authClaimData.treeState?.claimsRoot,
|
|
408
|
+
revocationRoot: authClaimData.treeState?.revocationRoot,
|
|
409
|
+
rootOfRoots: authClaimData.treeState?.rootOfRoots
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const stateProof = await this._stateStorage.getGISTProof(id.bigInt());
|
|
414
|
+
const gistProof = toGISTProof(stateProof);
|
|
415
|
+
circuitInputs.gistProof = gistProof;
|
|
416
|
+
|
|
417
|
+
circuitInputs.authClaim = authClaimData.claim;
|
|
418
|
+
circuitInputs.authClaimIncMtp = authClaimData.proof;
|
|
419
|
+
circuitInputs.authClaimNonRevMtp = authInfo.nonRevProof.proof;
|
|
420
|
+
|
|
421
|
+
if (!params.challenge) {
|
|
422
|
+
throw new Error('challenge must be provided for onchain circuits');
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const signature = await this._identityWallet.signChallenge(
|
|
426
|
+
params.challenge,
|
|
427
|
+
authInfo.credential
|
|
428
|
+
);
|
|
429
|
+
|
|
430
|
+
circuitInputs.signature = signature;
|
|
431
|
+
circuitInputs.challenge = params.challenge;
|
|
432
|
+
|
|
433
|
+
this.checkOperatorSupport(proofReq.circuitId, query.operator);
|
|
434
|
+
|
|
435
|
+
return circuitInputs.inputsMarshal();
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
private credentialAtomicQueryV3PrepareInputs = async ({
|
|
439
|
+
preparedCredential,
|
|
440
|
+
identifier,
|
|
441
|
+
proofReq,
|
|
442
|
+
params,
|
|
443
|
+
circuitQueries
|
|
444
|
+
}: InputContext): Promise<Uint8Array> => {
|
|
445
|
+
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
446
|
+
|
|
447
|
+
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
448
|
+
let proofType: ProofType;
|
|
449
|
+
switch (proofReq.query.proofType) {
|
|
450
|
+
case ProofType.BJJSignature:
|
|
451
|
+
proofType = ProofType.BJJSignature;
|
|
452
|
+
break;
|
|
453
|
+
case ProofType.Iden3SparseMerkleTreeProof:
|
|
454
|
+
proofType = ProofType.Iden3SparseMerkleTreeProof;
|
|
455
|
+
break;
|
|
456
|
+
default:
|
|
457
|
+
if (circuitClaimData.proof) {
|
|
458
|
+
proofType = ProofType.Iden3SparseMerkleTreeProof;
|
|
459
|
+
} else if (circuitClaimData.signatureProof) {
|
|
460
|
+
proofType = ProofType.BJJSignature;
|
|
461
|
+
} else {
|
|
462
|
+
throw Error('claim has no MTP or signature proof');
|
|
463
|
+
}
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const circuitInputs = new AtomicQueryV3Inputs();
|
|
468
|
+
circuitInputs.id = DID.idFromDID(identifier);
|
|
469
|
+
circuitInputs.claim = {
|
|
470
|
+
issuerID: circuitClaimData?.issuerId,
|
|
471
|
+
signatureProof: circuitClaimData.signatureProof,
|
|
472
|
+
claim: circuitClaimData.claim,
|
|
473
|
+
nonRevProof: circuitClaimData.nonRevProof,
|
|
474
|
+
incProof: { proof: circuitClaimData.proof, treeState: circuitClaimData.treeState }
|
|
475
|
+
};
|
|
476
|
+
circuitInputs.requestID = BigInt(proofReq.id);
|
|
477
|
+
circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
|
|
478
|
+
circuitInputs.profileNonce = BigInt(params.authProfileNonce);
|
|
479
|
+
circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
|
|
480
|
+
|
|
481
|
+
const query = circuitQueries[0];
|
|
482
|
+
// it is ok not to reset claimPathKey for noop, as it is a part of output, but auth won't be broken. (it skips check for noop)
|
|
483
|
+
query.values = [Operators.SD, Operators.NOOP].includes(query.operator) ? [] : query.values;
|
|
484
|
+
|
|
485
|
+
circuitInputs.query = query;
|
|
486
|
+
circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
|
|
487
|
+
|
|
488
|
+
circuitInputs.proofType = proofType;
|
|
489
|
+
circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
|
|
490
|
+
circuitInputs.verifierID = params.verifierDid ? DID.idFromDID(params.verifierDid) : undefined;
|
|
491
|
+
circuitInputs.nullifierSessionID = proofReq.params?.nullifierSessionId
|
|
492
|
+
? BigInt(proofReq.params?.nullifierSessionId?.toString())
|
|
493
|
+
: BigInt(0);
|
|
494
|
+
|
|
495
|
+
this.checkOperatorSupport(proofReq.circuitId, query.operator);
|
|
496
|
+
|
|
497
|
+
return circuitInputs.inputsMarshal();
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
private credentialAtomicQueryV3OnChainPrepareInputs = async ({
|
|
501
|
+
preparedCredential,
|
|
502
|
+
identifier,
|
|
503
|
+
proofReq,
|
|
504
|
+
params,
|
|
505
|
+
circuitQueries
|
|
506
|
+
}: InputContext): Promise<Uint8Array> => {
|
|
507
|
+
const id = DID.idFromDID(identifier);
|
|
508
|
+
|
|
509
|
+
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
510
|
+
|
|
511
|
+
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
512
|
+
let proofType: ProofType;
|
|
513
|
+
switch (proofReq.query.proofType) {
|
|
514
|
+
case ProofType.BJJSignature:
|
|
515
|
+
proofType = ProofType.BJJSignature;
|
|
516
|
+
break;
|
|
517
|
+
case ProofType.Iden3SparseMerkleTreeProof:
|
|
518
|
+
proofType = ProofType.Iden3SparseMerkleTreeProof;
|
|
519
|
+
break;
|
|
520
|
+
default:
|
|
521
|
+
if (circuitClaimData.proof) {
|
|
522
|
+
proofType = ProofType.Iden3SparseMerkleTreeProof;
|
|
523
|
+
} else if (circuitClaimData.signatureProof) {
|
|
524
|
+
proofType = ProofType.BJJSignature;
|
|
525
|
+
} else {
|
|
526
|
+
throw Error('claim has no MTP or signature proof');
|
|
527
|
+
}
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
const circuitInputs = new AtomicQueryV3OnChainInputs();
|
|
532
|
+
circuitInputs.id = DID.idFromDID(identifier);
|
|
533
|
+
circuitInputs.claim = {
|
|
534
|
+
issuerID: circuitClaimData?.issuerId,
|
|
535
|
+
signatureProof: circuitClaimData.signatureProof,
|
|
536
|
+
claim: circuitClaimData.claim,
|
|
537
|
+
nonRevProof: circuitClaimData.nonRevProof,
|
|
538
|
+
incProof: { proof: circuitClaimData.proof, treeState: circuitClaimData.treeState }
|
|
539
|
+
};
|
|
540
|
+
circuitInputs.requestID = BigInt(proofReq.id);
|
|
541
|
+
circuitInputs.claimSubjectProfileNonce = BigInt(params.credentialSubjectProfileNonce);
|
|
542
|
+
circuitInputs.profileNonce = BigInt(params.authProfileNonce);
|
|
543
|
+
circuitInputs.skipClaimRevocationCheck = params.skipRevocation;
|
|
544
|
+
|
|
545
|
+
const query = circuitQueries[0];
|
|
546
|
+
// no need to set valueProof empty for noop, because it is ignored in circuit, but implies correct calculation of query hash
|
|
547
|
+
query.values = [Operators.SD, Operators.NOOP].includes(query.operator) ? [] : query.values;
|
|
548
|
+
|
|
549
|
+
circuitInputs.query = query;
|
|
550
|
+
circuitInputs.currentTimeStamp = getUnixTimestamp(new Date());
|
|
551
|
+
|
|
552
|
+
circuitInputs.proofType = proofType;
|
|
553
|
+
circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
|
|
554
|
+
circuitInputs.verifierID = params.verifierDid ? DID.idFromDID(params.verifierDid) : undefined;
|
|
555
|
+
circuitInputs.nullifierSessionID = proofReq.params?.nullifierSessionId
|
|
556
|
+
? BigInt(proofReq.params?.nullifierSessionId?.toString())
|
|
557
|
+
: BigInt(0);
|
|
558
|
+
|
|
559
|
+
const isEthIdentity = isEthereumIdentity(identifier);
|
|
560
|
+
circuitInputs.isBJJAuthEnabled = isEthIdentity ? 0 : 1;
|
|
561
|
+
|
|
562
|
+
circuitInputs.challenge = BigInt(params.challenge ?? 0);
|
|
563
|
+
const stateProof = await this._stateStorage.getGISTProof(id.bigInt());
|
|
564
|
+
const gistProof = toGISTProof(stateProof);
|
|
565
|
+
circuitInputs.gistProof = gistProof;
|
|
566
|
+
// auth inputs
|
|
567
|
+
if (circuitInputs.isBJJAuthEnabled === 1) {
|
|
568
|
+
const authPrepared = await this.prepareAuthBJJCredential(identifier);
|
|
569
|
+
|
|
570
|
+
const authClaimData = await this.newCircuitClaimData({
|
|
571
|
+
credential: authPrepared.credential,
|
|
572
|
+
credentialCoreClaim: authPrepared.coreClaim
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
const signature = await this._identityWallet.signChallenge(
|
|
576
|
+
circuitInputs.challenge,
|
|
577
|
+
authPrepared.credential
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
circuitInputs.authClaim = authClaimData.claim;
|
|
581
|
+
circuitInputs.authClaimIncMtp = authClaimData.proof;
|
|
582
|
+
circuitInputs.authClaimNonRevMtp = authPrepared.nonRevProof.proof;
|
|
583
|
+
circuitInputs.treeState = authClaimData.treeState;
|
|
584
|
+
circuitInputs.signature = signature;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
this.checkOperatorSupport(proofReq.circuitId, query.operator);
|
|
588
|
+
|
|
589
|
+
return circuitInputs.inputsMarshal();
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
private linkedMultiQuery10PrepareInputs = async ({
|
|
593
|
+
preparedCredential,
|
|
594
|
+
params,
|
|
595
|
+
proofReq,
|
|
596
|
+
circuitQueries
|
|
597
|
+
}: InputContext): Promise<Uint8Array> => {
|
|
598
|
+
const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
|
|
599
|
+
|
|
600
|
+
circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
|
|
601
|
+
const circuitInputs = new LinkedMultiQueryInputs();
|
|
602
|
+
circuitInputs.linkNonce = params.linkNonce ?? BigInt(0);
|
|
603
|
+
|
|
604
|
+
circuitInputs.claim = circuitClaimData.claim;
|
|
605
|
+
circuitInputs.query = circuitQueries;
|
|
606
|
+
|
|
607
|
+
circuitQueries.forEach((query) => {
|
|
608
|
+
this.checkOperatorSupport(proofReq.circuitId, query.operator);
|
|
609
|
+
});
|
|
610
|
+
circuitQueries.forEach((query) => {
|
|
611
|
+
query.values = [Operators.SD, Operators.NOOP].includes(query.operator) ? [] : query.values;
|
|
612
|
+
});
|
|
613
|
+
return circuitInputs.inputsMarshal();
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
private transformV2QueryOperator(operator: number): number {
|
|
617
|
+
return operator === Operators.SD || operator === Operators.NOOP ? Operators.EQ : operator;
|
|
618
|
+
}
|
|
619
|
+
private checkOperatorSupport(circuitId: string, operator: number) {
|
|
620
|
+
const supportedOperators = circuitValidator[circuitId as CircuitId].supportedOperations;
|
|
621
|
+
if (!supportedOperators.includes(operator)) {
|
|
622
|
+
throw new Error(
|
|
623
|
+
`operator ${getOperatorNameByValue(operator)} is not supported by ${circuitId}`
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|