@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,531 @@
|
|
|
1
|
+
import { Claim, Id } from '@mocanetwork/moca-iden3';
|
|
2
|
+
import {
|
|
3
|
+
BaseConfig,
|
|
4
|
+
bigIntArrayToStringArray,
|
|
5
|
+
prepareSiblingsStr,
|
|
6
|
+
getNodeAuxValue,
|
|
7
|
+
prepareCircuitArrayValues,
|
|
8
|
+
IStateInfoPubSignals,
|
|
9
|
+
StatesInfo
|
|
10
|
+
} from './common';
|
|
11
|
+
import { BJJSignatureProof, CircuitError, GISTProof, Query, TreeState, ValueProof } from './models';
|
|
12
|
+
import { Hash, Proof, ZERO_HASH } from '@iden3/js-merkletree';
|
|
13
|
+
import { byteDecoder, byteEncoder } from '../utils';
|
|
14
|
+
import { ClaimWithSigAndMTPProof } from './atomic-query-v3';
|
|
15
|
+
import { Signature } from '@iden3/js-crypto';
|
|
16
|
+
import { ProofType } from '../verifiable';
|
|
17
|
+
|
|
18
|
+
const zero = '0';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* AtomicQueryV3OnChainInputs ZK private inputs for credentialAtomicQueryV3OnChain.circom
|
|
22
|
+
*
|
|
23
|
+
* @beta
|
|
24
|
+
* @class AtomicQueryV3OnChainInputs
|
|
25
|
+
* @extends {BaseConfig}
|
|
26
|
+
*/
|
|
27
|
+
export class AtomicQueryV3OnChainInputs extends BaseConfig {
|
|
28
|
+
requestID!: bigint;
|
|
29
|
+
id!: Id;
|
|
30
|
+
profileNonce!: bigint;
|
|
31
|
+
claimSubjectProfileNonce!: bigint;
|
|
32
|
+
claim!: ClaimWithSigAndMTPProof;
|
|
33
|
+
skipClaimRevocationCheck!: boolean;
|
|
34
|
+
|
|
35
|
+
// Auth inputs
|
|
36
|
+
authClaim!: Claim;
|
|
37
|
+
authClaimIncMtp!: Proof;
|
|
38
|
+
authClaimNonRevMtp!: Proof;
|
|
39
|
+
treeState!: TreeState;
|
|
40
|
+
gistProof!: GISTProof;
|
|
41
|
+
signature!: Signature;
|
|
42
|
+
challenge!: bigint;
|
|
43
|
+
|
|
44
|
+
query!: Query;
|
|
45
|
+
currentTimeStamp!: number;
|
|
46
|
+
proofType!: ProofType;
|
|
47
|
+
linkNonce!: bigint;
|
|
48
|
+
verifierID?: Id;
|
|
49
|
+
nullifierSessionID!: bigint;
|
|
50
|
+
isBJJAuthEnabled!: number;
|
|
51
|
+
|
|
52
|
+
validate(): void {
|
|
53
|
+
if (!this.requestID) {
|
|
54
|
+
throw new Error(CircuitError.EmptyRequestID);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!this.claim.nonRevProof.proof) {
|
|
58
|
+
throw new Error(CircuitError.EmptyClaimNonRevProof);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!this.query.values) {
|
|
62
|
+
throw new Error(CircuitError.EmptyQueryValue);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.query.validateValueArraySize(this.getValueArrSize());
|
|
66
|
+
|
|
67
|
+
if (!this.proofType) {
|
|
68
|
+
throw new Error(CircuitError.InvalidProofType);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!this.challenge) {
|
|
72
|
+
throw new Error(CircuitError.EmptyChallenge);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (this.isBJJAuthEnabled === 1) {
|
|
76
|
+
if (!this.authClaimIncMtp) {
|
|
77
|
+
throw new Error(CircuitError.EmptyAuthClaimProof);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!this.authClaimNonRevMtp) {
|
|
81
|
+
throw new Error(CircuitError.EmptyAuthClaimNonRevProof);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!this.signature) {
|
|
85
|
+
throw new Error(CircuitError.EmptyChallengeSignature);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!this.gistProof.proof) {
|
|
89
|
+
throw new Error(CircuitError.EmptyGISTProof);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this.proofType === ProofType.BJJSignature) {
|
|
94
|
+
if (!this.claim.signatureProof?.issuerAuthIncProof.proof) {
|
|
95
|
+
throw new Error(CircuitError.EmptyIssuerAuthClaimProof);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!this.claim.signatureProof.issuerAuthNonRevProof.proof) {
|
|
99
|
+
throw new Error(CircuitError.EmptyIssuerAuthClaimNonRevProof);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!this.claim.signatureProof.signature) {
|
|
103
|
+
throw new Error(CircuitError.EmptyClaimSignature);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (this.proofType === ProofType.Iden3SparseMerkleTreeProof) {
|
|
107
|
+
if (!this.claim?.incProof?.proof) {
|
|
108
|
+
throw new Error(CircuitError.EmptyClaimProof);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
fillMTPProofsWithZero(s: Partial<AtomicQueryV3OnChainCircuitInputs>) {
|
|
114
|
+
s.issuerClaimMtp = prepareSiblingsStr(new Proof(), this.getMTLevel());
|
|
115
|
+
s.issuerClaimClaimsTreeRoot = ZERO_HASH.bigInt().toString();
|
|
116
|
+
s.issuerClaimRevTreeRoot = ZERO_HASH.bigInt().toString();
|
|
117
|
+
s.issuerClaimRootsTreeRoot = ZERO_HASH.bigInt().toString();
|
|
118
|
+
s.issuerClaimIdenState = ZERO_HASH.bigInt().toString();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
fillSigProofWithZero(s: Partial<AtomicQueryV3OnChainCircuitInputs>) {
|
|
122
|
+
s.issuerClaimSignatureR8x = zero;
|
|
123
|
+
s.issuerClaimSignatureR8y = zero;
|
|
124
|
+
s.issuerClaimSignatureS = zero;
|
|
125
|
+
s.issuerAuthClaim = new Claim().marshalJson();
|
|
126
|
+
s.issuerAuthClaimMtp = prepareSiblingsStr(new Proof(), this.getMTLevel());
|
|
127
|
+
s.issuerAuthClaimsTreeRoot = zero;
|
|
128
|
+
s.issuerAuthRevTreeRoot = zero;
|
|
129
|
+
s.issuerAuthRootsTreeRoot = zero;
|
|
130
|
+
s.issuerAuthClaimNonRevMtp = prepareSiblingsStr(new Proof(), this.getMTLevel());
|
|
131
|
+
|
|
132
|
+
s.issuerAuthClaimNonRevMtpAuxHi = ZERO_HASH.bigInt().toString();
|
|
133
|
+
s.issuerAuthClaimNonRevMtpAuxHv = ZERO_HASH.bigInt().toString();
|
|
134
|
+
s.issuerAuthClaimNonRevMtpNoAux = zero;
|
|
135
|
+
s.issuerAuthState = zero;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
fillAuthWithZero(s: Partial<AtomicQueryV3OnChainCircuitInputs>) {
|
|
139
|
+
s.authClaim = new Claim().marshalJson();
|
|
140
|
+
|
|
141
|
+
s.userClaimsTreeRoot = ZERO_HASH.bigInt().toString();
|
|
142
|
+
s.userRevTreeRoot = ZERO_HASH.bigInt().toString();
|
|
143
|
+
s.userRootsTreeRoot = ZERO_HASH.bigInt().toString();
|
|
144
|
+
s.userState = ZERO_HASH.bigInt().toString();
|
|
145
|
+
|
|
146
|
+
s.authClaimIncMtp = prepareSiblingsStr(new Proof(), this.getMTLevel());
|
|
147
|
+
s.authClaimNonRevMtp = prepareSiblingsStr(new Proof(), this.getMTLevel());
|
|
148
|
+
s.challengeSignatureR8x = zero;
|
|
149
|
+
s.challengeSignatureR8y = zero;
|
|
150
|
+
s.challengeSignatureS = zero;
|
|
151
|
+
s.gistRoot = ZERO_HASH.bigInt().toString();
|
|
152
|
+
s.gistMtp = prepareSiblingsStr(new Proof(), this.getMTLevelOnChain());
|
|
153
|
+
|
|
154
|
+
s.authClaimNonRevMtpAuxHi = ZERO_HASH.bigInt().toString();
|
|
155
|
+
s.authClaimNonRevMtpAuxHv = ZERO_HASH.bigInt().toString();
|
|
156
|
+
s.authClaimNonRevMtpNoAux = zero;
|
|
157
|
+
|
|
158
|
+
s.gistMtpAuxHi = ZERO_HASH.bigInt().toString();
|
|
159
|
+
s.gistMtpAuxHv = ZERO_HASH.bigInt().toString();
|
|
160
|
+
s.gistMtpNoAux = zero;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// InputsMarshal returns Circom private inputs for credentialAtomicQueryV3OnChain.circom
|
|
164
|
+
inputsMarshal(): Uint8Array {
|
|
165
|
+
this.validate();
|
|
166
|
+
|
|
167
|
+
if (this.query.valueProof) {
|
|
168
|
+
this.query.validate();
|
|
169
|
+
this.query.valueProof.validate();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let valueProof = this.query.valueProof;
|
|
173
|
+
|
|
174
|
+
if (!valueProof) {
|
|
175
|
+
valueProof = new ValueProof();
|
|
176
|
+
valueProof.path = 0n;
|
|
177
|
+
valueProof.value = 0n;
|
|
178
|
+
valueProof.mtp = new Proof();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let treeState = this.claim.nonRevProof.treeState;
|
|
182
|
+
if (this.proofType === ProofType.BJJSignature && this.skipClaimRevocationCheck) {
|
|
183
|
+
treeState = this.claim.signatureProof?.issuerAuthNonRevProof.treeState;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!treeState) {
|
|
187
|
+
throw new Error(CircuitError.EmptyTreeState);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const s: Partial<AtomicQueryV3OnChainCircuitInputs> = {
|
|
191
|
+
requestID: this.requestID.toString(),
|
|
192
|
+
userGenesisID: this.id.bigInt().toString(),
|
|
193
|
+
profileNonce: this.profileNonce.toString(),
|
|
194
|
+
claimSubjectProfileNonce: this.claimSubjectProfileNonce.toString(),
|
|
195
|
+
issuerID: this.claim.issuerID.bigInt().toString(),
|
|
196
|
+
issuerClaim: this.claim.claim.marshalJson(),
|
|
197
|
+
|
|
198
|
+
issuerClaimNonRevClaimsTreeRoot: treeState.claimsRoot.bigInt().toString(),
|
|
199
|
+
issuerClaimNonRevRevTreeRoot: treeState.revocationRoot.bigInt().toString(),
|
|
200
|
+
issuerClaimNonRevRootsTreeRoot: treeState.rootOfRoots.bigInt().toString(),
|
|
201
|
+
issuerClaimNonRevState: treeState.state.bigInt().toString(),
|
|
202
|
+
issuerClaimNonRevMtp: prepareSiblingsStr(
|
|
203
|
+
this.claim.nonRevProof.proof as Proof,
|
|
204
|
+
this.getMTLevel()
|
|
205
|
+
),
|
|
206
|
+
|
|
207
|
+
claimSchema: this.claim.claim.getSchemaHash().bigInt().toString(),
|
|
208
|
+
|
|
209
|
+
claimPathMtp: prepareSiblingsStr(valueProof.mtp, this.getMTLevelsClaim()),
|
|
210
|
+
claimPathValue: valueProof.value.toString(),
|
|
211
|
+
operator: this.query.operator,
|
|
212
|
+
timestamp: this.currentTimeStamp,
|
|
213
|
+
// value in this path in merklized json-ld document
|
|
214
|
+
|
|
215
|
+
slotIndex: this.query.slotIndex,
|
|
216
|
+
isRevocationChecked: 1
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
s.challenge = this.challenge?.toString();
|
|
220
|
+
if (this.isBJJAuthEnabled === 1) {
|
|
221
|
+
s.authClaim = this.authClaim?.marshalJson();
|
|
222
|
+
s.userClaimsTreeRoot = this.treeState.claimsRoot?.bigInt().toString();
|
|
223
|
+
s.userRevTreeRoot = this.treeState.revocationRoot?.bigInt().toString();
|
|
224
|
+
s.userRootsTreeRoot = this.treeState.rootOfRoots?.bigInt().toString();
|
|
225
|
+
s.userState = this.treeState.state?.bigInt().toString();
|
|
226
|
+
s.authClaimIncMtp = prepareSiblingsStr(this.authClaimIncMtp, this.getMTLevel());
|
|
227
|
+
s.authClaimNonRevMtp = prepareSiblingsStr(this.authClaimNonRevMtp, this.getMTLevel());
|
|
228
|
+
s.challengeSignatureR8x = this.signature.R8[0].toString();
|
|
229
|
+
s.challengeSignatureR8y = this.signature.R8[1].toString();
|
|
230
|
+
s.challengeSignatureS = this.signature.S.toString();
|
|
231
|
+
s.gistMtp =
|
|
232
|
+
this.gistProof && prepareSiblingsStr(this.gistProof.proof, this.getMTLevelOnChain());
|
|
233
|
+
const nodeAuxAuth = getNodeAuxValue(this.authClaimNonRevMtp);
|
|
234
|
+
s.authClaimNonRevMtpAuxHi = nodeAuxAuth.key.bigInt().toString();
|
|
235
|
+
s.authClaimNonRevMtpAuxHv = nodeAuxAuth.value.bigInt().toString();
|
|
236
|
+
s.authClaimNonRevMtpNoAux = nodeAuxAuth.noAux;
|
|
237
|
+
|
|
238
|
+
const globalNodeAux = getNodeAuxValue(this.gistProof.proof);
|
|
239
|
+
s.gistMtpAuxHi = globalNodeAux.key.bigInt().toString();
|
|
240
|
+
s.gistMtpAuxHv = globalNodeAux.value.bigInt().toString();
|
|
241
|
+
s.gistMtpNoAux = globalNodeAux.noAux;
|
|
242
|
+
s.gistRoot = this.gistProof.root.bigInt().toString();
|
|
243
|
+
} else {
|
|
244
|
+
this.fillAuthWithZero(s);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (this.skipClaimRevocationCheck) {
|
|
248
|
+
s.isRevocationChecked = 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (this.proofType === ProofType.BJJSignature) {
|
|
252
|
+
const sigProof = this.claim.signatureProof as BJJSignatureProof;
|
|
253
|
+
s.proofType = '1';
|
|
254
|
+
|
|
255
|
+
s.issuerClaimSignatureR8x = sigProof.signature.R8[0].toString();
|
|
256
|
+
s.issuerClaimSignatureR8y = sigProof.signature.R8[1].toString();
|
|
257
|
+
s.issuerClaimSignatureS = sigProof.signature.S.toString();
|
|
258
|
+
s.issuerAuthClaim = sigProof.issuerAuthClaim?.marshalJson();
|
|
259
|
+
s.issuerAuthClaimMtp = prepareSiblingsStr(
|
|
260
|
+
sigProof.issuerAuthIncProof.proof as Proof,
|
|
261
|
+
this.getMTLevel()
|
|
262
|
+
);
|
|
263
|
+
const issuerAuthTreeState = this.claim.nonRevProof.treeState;
|
|
264
|
+
|
|
265
|
+
if (!issuerAuthTreeState) {
|
|
266
|
+
throw new Error(CircuitError.EmptyTreeState);
|
|
267
|
+
}
|
|
268
|
+
s.issuerAuthClaimsTreeRoot = sigProof.issuerAuthIncProof.treeState?.claimsRoot
|
|
269
|
+
.bigInt()
|
|
270
|
+
.toString();
|
|
271
|
+
s.issuerAuthRevTreeRoot = sigProof.issuerAuthIncProof.treeState?.revocationRoot
|
|
272
|
+
.bigInt()
|
|
273
|
+
.toString();
|
|
274
|
+
s.issuerAuthRootsTreeRoot = sigProof.issuerAuthIncProof.treeState?.rootOfRoots
|
|
275
|
+
.bigInt()
|
|
276
|
+
.toString();
|
|
277
|
+
s.issuerAuthClaimNonRevMtp = prepareSiblingsStr(
|
|
278
|
+
sigProof.issuerAuthNonRevProof.proof as Proof,
|
|
279
|
+
this.getMTLevel()
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
const nodeAuxIssuerAuthNonRev = getNodeAuxValue(sigProof.issuerAuthNonRevProof.proof);
|
|
283
|
+
s.issuerAuthClaimNonRevMtpAuxHi = nodeAuxIssuerAuthNonRev.key.bigInt().toString();
|
|
284
|
+
s.issuerAuthClaimNonRevMtpAuxHv = nodeAuxIssuerAuthNonRev.value.bigInt().toString();
|
|
285
|
+
s.issuerAuthClaimNonRevMtpNoAux = nodeAuxIssuerAuthNonRev.noAux;
|
|
286
|
+
s.issuerAuthState = sigProof.issuerAuthIncProof.treeState?.state.bigInt().toString();
|
|
287
|
+
|
|
288
|
+
this.fillMTPProofsWithZero(s);
|
|
289
|
+
} else if (this.proofType === ProofType.Iden3SparseMerkleTreeProof) {
|
|
290
|
+
s.proofType = '2';
|
|
291
|
+
|
|
292
|
+
const incProofTreeState = this.claim.incProof?.treeState;
|
|
293
|
+
|
|
294
|
+
if (!incProofTreeState) {
|
|
295
|
+
throw new Error(CircuitError.EmptyTreeState);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
s.issuerClaimMtp = prepareSiblingsStr(this.claim.incProof?.proof as Proof, this.getMTLevel());
|
|
299
|
+
s.issuerClaimClaimsTreeRoot = incProofTreeState.claimsRoot.bigInt().toString();
|
|
300
|
+
s.issuerClaimRevTreeRoot = incProofTreeState.revocationRoot.bigInt().toString();
|
|
301
|
+
s.issuerClaimRootsTreeRoot = incProofTreeState.rootOfRoots.bigInt().toString();
|
|
302
|
+
s.issuerClaimIdenState = incProofTreeState.state.bigInt().toString();
|
|
303
|
+
|
|
304
|
+
this.fillSigProofWithZero(s);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const nodeAuxNonRev = getNodeAuxValue(this.claim.nonRevProof.proof);
|
|
308
|
+
s.issuerClaimNonRevMtpAuxHi = nodeAuxNonRev.key.bigInt().toString();
|
|
309
|
+
s.issuerClaimNonRevMtpAuxHv = nodeAuxNonRev.value.bigInt().toString();
|
|
310
|
+
s.issuerClaimNonRevMtpNoAux = nodeAuxNonRev.noAux;
|
|
311
|
+
|
|
312
|
+
const nodAuxJSONLD = getNodeAuxValue(valueProof.mtp);
|
|
313
|
+
s.claimPathMtpNoAux = nodAuxJSONLD.noAux;
|
|
314
|
+
s.claimPathMtpAuxHi = nodAuxJSONLD.key.bigInt().toString();
|
|
315
|
+
s.claimPathMtpAuxHv = nodAuxJSONLD.value.bigInt().toString();
|
|
316
|
+
|
|
317
|
+
s.claimPathKey = valueProof.path.toString();
|
|
318
|
+
|
|
319
|
+
s.valueArraySize = this.query.values.length;
|
|
320
|
+
const values = prepareCircuitArrayValues(this.query.values, this.getValueArrSize());
|
|
321
|
+
s.value = bigIntArrayToStringArray(values);
|
|
322
|
+
|
|
323
|
+
s.linkNonce = this.linkNonce.toString();
|
|
324
|
+
s.verifierID = this.verifierID?.bigInt().toString() ?? '0';
|
|
325
|
+
s.nullifierSessionID = this.nullifierSessionID.toString();
|
|
326
|
+
|
|
327
|
+
s.isBJJAuthEnabled = this.isBJJAuthEnabled.toString();
|
|
328
|
+
|
|
329
|
+
return byteEncoder.encode(JSON.stringify(s));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* @beta
|
|
335
|
+
* AtomicQueryV3OnChainCircuitInputs type represents credentialAtomicQueryV3OnChain.circom private inputs required by prover
|
|
336
|
+
*/
|
|
337
|
+
interface AtomicQueryV3OnChainCircuitInputs {
|
|
338
|
+
requestID: string;
|
|
339
|
+
// user data
|
|
340
|
+
userGenesisID: string;
|
|
341
|
+
profileNonce: string;
|
|
342
|
+
claimSubjectProfileNonce: string;
|
|
343
|
+
|
|
344
|
+
issuerID: string;
|
|
345
|
+
// Claim
|
|
346
|
+
issuerClaim: string[];
|
|
347
|
+
issuerClaimNonRevClaimsTreeRoot: string;
|
|
348
|
+
issuerClaimNonRevRevTreeRoot: string;
|
|
349
|
+
issuerClaimNonRevRootsTreeRoot: string;
|
|
350
|
+
issuerClaimNonRevState: string;
|
|
351
|
+
issuerClaimNonRevMtp: string[];
|
|
352
|
+
issuerClaimNonRevMtpAuxHi: string;
|
|
353
|
+
issuerClaimNonRevMtpAuxHv: string;
|
|
354
|
+
issuerClaimNonRevMtpNoAux: string;
|
|
355
|
+
claimSchema: string;
|
|
356
|
+
issuerClaimSignatureR8x: string;
|
|
357
|
+
issuerClaimSignatureR8y: string;
|
|
358
|
+
issuerClaimSignatureS: string;
|
|
359
|
+
issuerAuthClaim: string[];
|
|
360
|
+
issuerAuthClaimMtp: string[];
|
|
361
|
+
issuerAuthClaimNonRevMtp: string[];
|
|
362
|
+
issuerAuthClaimNonRevMtpAuxHi: string;
|
|
363
|
+
issuerAuthClaimNonRevMtpAuxHv: string;
|
|
364
|
+
issuerAuthClaimNonRevMtpNoAux: string;
|
|
365
|
+
issuerAuthClaimsTreeRoot: string;
|
|
366
|
+
issuerAuthRevTreeRoot: string;
|
|
367
|
+
issuerAuthRootsTreeRoot: string;
|
|
368
|
+
issuerAuthState: string;
|
|
369
|
+
|
|
370
|
+
isRevocationChecked: number;
|
|
371
|
+
// Query
|
|
372
|
+
// JSON path
|
|
373
|
+
claimPathMtp: string[];
|
|
374
|
+
claimPathMtpNoAux: string; // 1 if aux node is empty, 0 if non-empty or for inclusion proofs
|
|
375
|
+
claimPathMtpAuxHi: string; // 0 for inclusion proof
|
|
376
|
+
claimPathMtpAuxHv: string; // 0 for inclusion proof
|
|
377
|
+
claimPathKey: string; // hash of path in merklized json-ld document
|
|
378
|
+
claimPathValue: string; // value in this path in merklized json-ld document
|
|
379
|
+
|
|
380
|
+
operator: number;
|
|
381
|
+
slotIndex: number;
|
|
382
|
+
timestamp: number;
|
|
383
|
+
value: string[];
|
|
384
|
+
valueArraySize: number;
|
|
385
|
+
|
|
386
|
+
issuerClaimMtp: string[];
|
|
387
|
+
issuerClaimClaimsTreeRoot: string;
|
|
388
|
+
issuerClaimRevTreeRoot: string;
|
|
389
|
+
issuerClaimRootsTreeRoot: string;
|
|
390
|
+
issuerClaimIdenState: string;
|
|
391
|
+
|
|
392
|
+
proofType: string;
|
|
393
|
+
|
|
394
|
+
authClaim?: string[];
|
|
395
|
+
authClaimIncMtp?: string[];
|
|
396
|
+
authClaimNonRevMtp: string[];
|
|
397
|
+
authClaimNonRevMtpAuxHi?: string;
|
|
398
|
+
authClaimNonRevMtpAuxHv?: string;
|
|
399
|
+
authClaimNonRevMtpNoAux: string;
|
|
400
|
+
challenge: string;
|
|
401
|
+
challengeSignatureR8x: string;
|
|
402
|
+
challengeSignatureR8y: string;
|
|
403
|
+
challengeSignatureS: string;
|
|
404
|
+
userClaimsTreeRoot?: string;
|
|
405
|
+
userRevTreeRoot?: string;
|
|
406
|
+
userRootsTreeRoot?: string;
|
|
407
|
+
userState?: string;
|
|
408
|
+
gistRoot?: string;
|
|
409
|
+
gistMtp: string[];
|
|
410
|
+
gistMtpAuxHi?: string;
|
|
411
|
+
gistMtpAuxHv?: string;
|
|
412
|
+
gistMtpNoAux: string;
|
|
413
|
+
|
|
414
|
+
// Private random nonce, used to generate LinkID
|
|
415
|
+
linkNonce: string;
|
|
416
|
+
verifierID: string;
|
|
417
|
+
nullifierSessionID: string;
|
|
418
|
+
isBJJAuthEnabled: string;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @beta
|
|
423
|
+
* AtomicQueryV3OnChainPubSignals public inputs
|
|
424
|
+
*/
|
|
425
|
+
export class AtomicQueryV3OnChainPubSignals extends BaseConfig implements IStateInfoPubSignals {
|
|
426
|
+
requestID!: bigint;
|
|
427
|
+
userID!: Id;
|
|
428
|
+
issuerID!: Id;
|
|
429
|
+
issuerState!: Hash;
|
|
430
|
+
issuerClaimNonRevState!: Hash;
|
|
431
|
+
timestamp!: number;
|
|
432
|
+
circuitQueryHash!: bigint;
|
|
433
|
+
challenge!: bigint;
|
|
434
|
+
gistRoot!: Hash;
|
|
435
|
+
proofType!: number;
|
|
436
|
+
linkID!: bigint;
|
|
437
|
+
nullifier!: bigint;
|
|
438
|
+
operatorOutput!: bigint;
|
|
439
|
+
isBJJAuthEnabled!: number;
|
|
440
|
+
|
|
441
|
+
// PubSignalsUnmarshal unmarshal credentialAtomicQueryV3.circom public signals
|
|
442
|
+
pubSignalsUnmarshal(data: Uint8Array): AtomicQueryV3OnChainPubSignals {
|
|
443
|
+
// expected order:
|
|
444
|
+
// userID
|
|
445
|
+
// circuitQueryHash
|
|
446
|
+
// issuerState
|
|
447
|
+
// linkID
|
|
448
|
+
// nullifier
|
|
449
|
+
// operatorOutput
|
|
450
|
+
// proofType
|
|
451
|
+
// requestID
|
|
452
|
+
// challenge
|
|
453
|
+
// gistRoot
|
|
454
|
+
// issuerID
|
|
455
|
+
// issuerClaimNonRevState
|
|
456
|
+
// timestamp
|
|
457
|
+
// isBJJAuthEnabled
|
|
458
|
+
|
|
459
|
+
const sVals: string[] = JSON.parse(byteDecoder.decode(data));
|
|
460
|
+
|
|
461
|
+
let fieldIdx = 0;
|
|
462
|
+
|
|
463
|
+
// - userID
|
|
464
|
+
this.userID = Id.fromBigInt(BigInt(sVals[fieldIdx]));
|
|
465
|
+
fieldIdx++;
|
|
466
|
+
|
|
467
|
+
// - circuitQueryHash
|
|
468
|
+
this.circuitQueryHash = BigInt(sVals[fieldIdx]);
|
|
469
|
+
fieldIdx++;
|
|
470
|
+
|
|
471
|
+
// - issuerState
|
|
472
|
+
this.issuerState = Hash.fromString(sVals[fieldIdx]);
|
|
473
|
+
fieldIdx++;
|
|
474
|
+
|
|
475
|
+
// - linkID
|
|
476
|
+
this.linkID = BigInt(sVals[fieldIdx]);
|
|
477
|
+
fieldIdx++;
|
|
478
|
+
|
|
479
|
+
// - nullifier
|
|
480
|
+
this.nullifier = BigInt(sVals[fieldIdx]);
|
|
481
|
+
fieldIdx++;
|
|
482
|
+
|
|
483
|
+
// - operatorOutput
|
|
484
|
+
this.operatorOutput = BigInt(sVals[fieldIdx]);
|
|
485
|
+
fieldIdx++;
|
|
486
|
+
|
|
487
|
+
// - proofType
|
|
488
|
+
this.proofType = parseInt(sVals[fieldIdx]);
|
|
489
|
+
fieldIdx++;
|
|
490
|
+
|
|
491
|
+
// - requestID
|
|
492
|
+
this.requestID = BigInt(sVals[fieldIdx]);
|
|
493
|
+
fieldIdx++;
|
|
494
|
+
|
|
495
|
+
// - challenge
|
|
496
|
+
this.challenge = BigInt(sVals[fieldIdx]);
|
|
497
|
+
fieldIdx++;
|
|
498
|
+
|
|
499
|
+
// - gistRoot
|
|
500
|
+
this.gistRoot = Hash.fromString(sVals[fieldIdx]);
|
|
501
|
+
fieldIdx++;
|
|
502
|
+
|
|
503
|
+
// - issuerID
|
|
504
|
+
this.issuerID = Id.fromBigInt(BigInt(sVals[fieldIdx]));
|
|
505
|
+
fieldIdx++;
|
|
506
|
+
|
|
507
|
+
// - issuerClaimNonRevState
|
|
508
|
+
this.issuerClaimNonRevState = Hash.fromString(sVals[fieldIdx]);
|
|
509
|
+
fieldIdx++;
|
|
510
|
+
|
|
511
|
+
// - timestamp
|
|
512
|
+
this.timestamp = parseInt(sVals[fieldIdx]);
|
|
513
|
+
fieldIdx++;
|
|
514
|
+
|
|
515
|
+
// - isBJJAuthEnabled
|
|
516
|
+
this.isBJJAuthEnabled = parseInt(sVals[fieldIdx]);
|
|
517
|
+
|
|
518
|
+
return this;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** {@inheritDoc IStateInfoPubSignals.getStatesInfo} */
|
|
522
|
+
getStatesInfo(): StatesInfo {
|
|
523
|
+
return {
|
|
524
|
+
states: [
|
|
525
|
+
{ id: this.issuerID, state: this.issuerState },
|
|
526
|
+
{ id: this.issuerID, state: this.issuerClaimNonRevState }
|
|
527
|
+
],
|
|
528
|
+
gists: [{ id: this.userID, root: this.gistRoot }]
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
}
|