UNPKG

@0xpolygonid/js-sdk

Version:
915 lines (898 loc) 635 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var index_exports = {}; __export(index_exports, { AbstractMessageHandler: () => AbstractMessageHandler, AbstractPrivateKeyStore: () => AbstractPrivateKeyStore, AgentResolver: () => AgentResolver, AnonCryptPacker: () => AnonCryptPacker, AtomicQueryMTPV2Inputs: () => AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs: () => AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals: () => AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals: () => AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs: () => AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs: () => AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs: () => AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals: () => AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals: () => AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs: () => AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs: () => AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals: () => AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals: () => AtomicQueryV3PubSignals, AuthHandler: () => AuthHandler, AuthMethod: () => AuthMethod, AuthV2Inputs: () => AuthV2Inputs, AuthV2PubSignals: () => AuthV2PubSignals, AuthV3Inputs: () => AuthV3Inputs, AuthV3PubSignals: () => AuthV3PubSignals, BJJSignatureProof2021: () => BJJSignatureProof2021, BaseConfig: () => BaseConfig, BjjProvider: () => BjjProvider, BrowserDataSource: () => BrowserDataSource, CACHE_KEY_VERSION: () => CACHE_KEY_VERSION, CircuitClaim: () => CircuitClaim, CircuitError: () => CircuitError, CircuitId: () => CircuitId, CircuitStorage: () => CircuitStorage, ContractRequestHandler: () => ContractRequestHandler, CredentialOfferStatus: () => CredentialOfferStatus, CredentialProposalHandler: () => CredentialProposalHandler, CredentialStatusPublisherRegistry: () => CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry: () => CredentialStatusResolverRegistry, CredentialStatusType: () => CredentialStatusType, CredentialStorage: () => CredentialStorage, CredentialWallet: () => CredentialWallet, DEFAULT_CACHE_MAX_SIZE: () => DEFAULT_CACHE_MAX_SIZE, DEFAULT_DID_CONTEXT: () => DEFAULT_DID_CONTEXT, DIDDocumentBuilder: () => DIDDocumentBuilder, DIDDocumentJSONSchema: () => DIDDocumentJSONSchema, DIDDocumentSignature: () => DIDDocumentSignature, DataPrepareHandlerFunc: () => DataPrepareHandlerFunc, DefaultKMSKeyResolver: () => DefaultKMSKeyResolver, DidDocumentCredentialStatusResolver: () => DidDocumentCredentialStatusResolver, DidResolverStateReadonlyStorage: () => DidResolverStateReadonlyStorage, DiscoverFeatureQueryType: () => DiscoverFeatureQueryType, DiscoveryProtocolFeatureType: () => DiscoveryProtocolFeatureType, DiscoveryProtocolHandler: () => DiscoveryProtocolHandler, DisplayMethodType: () => DisplayMethodType, Ed25519Provider: () => Ed25519Provider, ErrorEmptyAuthClaimNonRevProof: () => ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof: () => ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature: () => ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof: () => ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof: () => ErrorEmptyClaimProof, ErrorEmptyClaimSignature: () => ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof: () => ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof: () => ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof: () => ErrorUserStateInRelayClaimProof, EthStateStorage: () => EthStateStorage, FSCircuitStorage: () => FSCircuitStorage, FetchHandler: () => FetchHandler, FilterQuery: () => FilterQuery, FunctionSignatures: () => FunctionSignatures, Iden3OnchainSmtCredentialStatusPublisher: () => Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher: () => Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof: () => Iden3SparseMerkleTreeProof, IdentityStorage: () => IdentityStorage, IdentityWallet: () => IdentityWallet, InMemoryDataSource: () => InMemoryDataSource, InMemoryMerkleTreeStorage: () => InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore: () => InMemoryPrivateKeyStore, InMemoryProofStorage: () => InMemoryProofStorage, IndexedDBDataSource: () => IndexedDBDataSource, IndexedDBPrivateKeyStore: () => IndexedDBPrivateKeyStore, InputGenerator: () => InputGenerator, IssuerResolver: () => IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY: () => JSON_SCHEMA_VALIDATORS_REGISTRY, JWK2020_CONTEXT_V1: () => JWK2020_CONTEXT_V1, JWSPacker: () => JWSPacker, JoseService: () => JoseService, JsonSchemaValidator: () => JsonSchemaValidator, Jwk2020VerificationMethodBuilder: () => Jwk2020VerificationMethodBuilder, KMS: () => KMS, KmsKeyType: () => KmsKeyType, LDParser: () => LDParser, LinkedMultiQueryInputs: () => LinkedMultiQueryInputs, LinkedMultiQueryPubSignals: () => LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore: () => LocalStoragePrivateKeyStore, MERKLE_TREE_TYPES: () => MERKLE_TREE_TYPES, MerkleTreeIndexedDBStorage: () => MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage: () => MerkleTreeLocalStorage, MerkleTreeType: () => MerkleTreeType, MerklizedRootPosition: () => MerklizedRootPosition, MessageBus: () => MessageBus, MessageHandler: () => MessageHandler, NativeProver: () => NativeProver, OnChainResolver: () => OnChainResolver, OnChainRevocationStorage: () => OnChainRevocationStorage, OnChainZKPVerifier: () => OnChainZKPVerifier, OnchainIssuer: () => OnchainIssuer, Operators: () => Operators, P384Provider: () => P384Provider, PROTOCOL_CONSTANTS: () => constants_exports, PackageManager: () => PackageManager, Parser: () => Parser, PaymentFeatures: () => PaymentFeatures, PaymentHandler: () => PaymentHandler, PaymentRequestDataType: () => PaymentRequestDataType, PaymentType: () => PaymentType, PlainPacker: () => PlainPacker, ProofNode: () => ProofNode, ProofPurpose: () => ProofPurpose, ProofService: () => ProofService, ProofType: () => ProofType, PubSignalsVerifier: () => PubSignalsVerifier, Query: () => Query, QueryOperators: () => QueryOperators, RHSResolver: () => RHSResolver, RefreshHandler: () => RefreshHandler, RefreshServiceType: () => RefreshServiceType, RevocationStatusHandler: () => RevocationStatusHandler, RsaOAEPKeyProvider: () => RsaOAEPKeyProvider, SDK_EVENTS: () => SDK_EVENTS, SOLANA_CHAIN_REF: () => SOLANA_CHAIN_REF, Scalar: () => Scalar, SearchError: () => SearchError, Sec256k1Provider: () => Sec256k1Provider, SolanaNativePaymentRequest: () => SolanaNativePaymentRequest, SolanaNativePaymentSchema: () => SolanaNativePaymentSchema, SolanaPaymentInstruction: () => SolanaPaymentInstruction, SolanaPaymentInstructionSchema: () => SolanaPaymentInstructionSchema, SolanaSplPaymentRequest: () => SolanaSplPaymentRequest, SolanaSplPaymentSchema: () => SolanaSplPaymentSchema, StandardJSONCredentialsQueryFilter: () => StandardJSONCredentialsQueryFilter, StateTransitionInputs: () => StateTransitionInputs, StateTransitionPubSignals: () => StateTransitionPubSignals, SubjectPosition: () => SubjectPosition, SupportedCurrencies: () => SupportedCurrencies, SupportedDataFormat: () => SupportedDataFormat, SupportedPaymentProofType: () => SupportedPaymentProofType, TransactionService: () => TransactionService, ValueProof: () => ValueProof, Vector: () => Vector, VerifiableConstants: () => VerifiableConstants, VerificationHandlerFunc: () => VerificationHandlerFunc, W3CCredential: () => W3CCredential, XSDNS: () => XSDNS, ZKPPacker: () => ZKPPacker, acceptHasProvingMethodAlg: () => acceptHasProvingMethodAlg, availableTypesOperators: () => availableTypesOperators, base58ToBytes: () => base58ToBytes, base64ToBytes: () => base64ToBytes, base64UrlToBytes: () => base64UrlToBytes, bigIntArrayToStringArray: () => bigIntArrayToStringArray, bigIntCompare: () => bigIntCompare, buildAccept: () => buildAccept, buildAcceptFromProvingMethodAlg: () => buildAcceptFromProvingMethodAlg, buildDIDFromEthAddress: () => buildDIDFromEthAddress, buildDIDFromEthPubKey: () => buildDIDFromEthPubKey, buildEvmPayment: () => buildEvmPayment, buildFieldPath: () => buildFieldPath, buildSolanaPayment: () => buildSolanaPayment, buildTreeState: () => buildTreeState, buildVerifierId: () => buildVerifierId, byteDecoder: () => byteDecoder, byteEncoder: () => byteEncoder, bytesToBase58: () => bytesToBase58, bytesToBase64: () => bytesToBase64, bytesToBase64url: () => bytesToBase64url, bytesToHex: () => bytesToHex, cacheLoader: () => cacheLoader, calcChallengeAuthV2: () => calcChallengeAuthV2, calculateCoreSchemaHash: () => calculateCoreSchemaHash, calculateGroupId: () => calculateGroupId, calculateMultiRequestId: () => calculateMultiRequestId, calculateQueryHashV2: () => calculateQueryHashV2, calculateQueryHashV3: () => calculateQueryHashV3, calculateRequestId: () => calculateRequestId, checkCircuitOperator: () => checkCircuitOperator, checkCircuitQueriesLength: () => checkCircuitQueriesLength, checkDataInField: () => checkDataInField, checkQueryRequest: () => checkQueryRequest, circuitValidator: () => circuitValidator, comparatorOptions: () => comparatorOptions, core: () => core, createAuthorizationRequest: () => createAuthorizationRequest, createAuthorizationRequestWithMessage: () => createAuthorizationRequestWithMessage, createDiscoveryFeatureDiscloseMessage: () => createDiscoveryFeatureDiscloseMessage, createDiscoveryFeatureQueryMessage: () => createDiscoveryFeatureQueryMessage, createInMemoryCache: () => createInMemoryCache, createMerkleTreeMetaInfo: () => createMerkleTreeMetaInfo, createPayment: () => createPayment, createPaymentRequest: () => createPaymentRequest, createProblemReport: () => createProblemReport, createProblemReportMessage: () => createProblemReportMessage, createProposal: () => createProposal, createProposalRequest: () => createProposalRequest, createSchemaHash: () => createSchemaHash, createVerifiablePresentation: () => createVerifiablePresentation, createZkpRequestCacheKey: () => createZkpRequestCacheKey, credentialSubjectKey: () => credentialSubjectKey2, dataFillsSlot: () => dataFillsSlot, decodeBase64url: () => decodeBase64url, defaultEthConnectionConfig: () => defaultEthConnectionConfig, defaultMTLevels: () => defaultMTLevels, defaultMTLevelsClaim: () => defaultMTLevelsClaim, defaultMTLevelsOnChain: () => defaultMTLevelsOnChain, defaultProvingMethodAlg: () => defaultProvingMethodAlg, defaultRSAOaepKmsIdPathGeneratingFunction: () => defaultRSAOaepKmsIdPathGeneratingFunction, defaultValueArraySize: () => defaultValueArraySize, defineMerklizedRootPosition: () => defineMerklizedRootPosition, encodeBase64url: () => encodeBase64url, existenceToInt: () => existenceToInt, extractProof: () => extractProof, extractPublicKeyBytes: () => extractPublicKeyBytes, factoryComparer: () => factoryComparer, fieldToByteArray: () => fieldToByteArray, fieldValueFromVerifiablePresentation: () => fieldValueFromVerifiablePresentation, fillCoreClaimSlot: () => fillCoreClaimSlot, fillSlot: () => fillSlot, findCredentialType: () => findCredentialType, findValue: () => findValue, generateProfileDID: () => generateProfileDID, getERC20Decimals: () => getERC20Decimals, getFieldSlotIndex: () => getFieldSlotIndex, getIsGenesisStateById: () => getIsGenesisStateById, getKMSIdByAuthCredential: () => getKMSIdByAuthCredential, getNodeAuxValue: () => getNodeAuxValue, getNodesRepresentation: () => getNodesRepresentation, getOperatorNameByValue: () => getOperatorNameByValue, getPermitSignature: () => getPermitSignature, getProperties: () => getProperties, getProvingMethodAlgFromJWZ: () => getProvingMethodAlgFromJWZ, getRecipientsJWKs: () => getRecipientsJWKs, getSerializationAttrFromContext: () => getSerializationAttrFromContext, getSerializationAttrFromParsedContext: () => getSerializationAttrFromParsedContext, getUserDIDFromCredential: () => getUserDIDFromCredential, hexToBytes: () => hexToBytes, initDefaultPackerOptions: () => initDefaultPackerOptions, isEthereumIdentity: () => isEthereumIdentity, isGenesisState: () => isGenesisState, isGenesisStateId: () => isGenesisStateId, isIdentityDoesNotExistError: () => isIdentityDoesNotExistError, isIssuerGenesis: () => isIssuerGenesis, isRootDoesNotExistError: () => isRootDoesNotExistError, isStateDoesNotExistError: () => isStateDoesNotExistError, isValidOperation: () => isValidOperation, jsonLDMerklizer: () => jsonLDMerklizer, keyPath: () => keyPath, mergeObjects: () => mergeObjects, notification: () => notifications_exports, packEthIdentityProof: () => packEthIdentityProof, packMetadatas: () => packMetadatas, parseAcceptProfile: () => parseAcceptProfile, parseCoreClaimSlots: () => parseCoreClaimSlots, parseCredentialSubject: () => parseCredentialSubject, parseQueriesMetadata: () => parseQueriesMetadata, parseQueryMetadata: () => parseQueryMetadata, parseSerializationAttr: () => parseSerializationAttr, prepareCircuitArrayValues: () => prepareCircuitArrayValues, prepareSiblingsStr: () => prepareSiblingsStr, processProofAuth: () => processProofAuth, processProofResponse: () => processProofResponse, processZeroKnowledgeProofRequests: () => processZeroKnowledgeProofRequests, pushHashesToRHS: () => pushHashesToRHS, resolveDIDDocumentAuth: () => resolveDIDDocumentAuth, resolveDidDocument: () => resolveDidDocument, resolvePath: () => resolvePath, resolveVerificationMethods: () => resolveVerificationMethods, serializeSolanaPaymentInstruction: () => serializeSolanaPaymentInstruction, strMTHex: () => strMTHex, stringByPath: () => stringByPath, subjectPositionIndex: () => subjectPositionIndex, swapEndianness: () => swapEndianness, toClaimNonRevStatus: () => toClaimNonRevStatus, toGISTProof: () => toGISTProof, toPublicKeyJwk: () => toPublicKeyJwk, toRevocationStatus: () => toRevocationStatus, toTxDataArgs: () => toTxDataArgs, transformQueryValueToBigInts: () => transformQueryValueToBigInts, userStateError: () => userStateError, validateDIDDocumentAuth: () => validateDIDDocumentAuth, validateDisclosureNativeSDSupport: () => validateDisclosureNativeSDSupport, validateDisclosureV2Circuit: () => validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport: () => validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit: () => validateEmptyCredentialSubjectV2Circuit, validateOperators: () => validateOperators, validateTreeState: () => validateTreeState, verifyEIP712TypedData: () => verifyEIP712TypedData, verifyExpiresTime: () => verifyExpiresTime, verifyFieldValueInclusionNativeExistsSupport: () => verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2: () => verifyFieldValueInclusionV2, verifyIden3SolanaPaymentRequest: () => verifyIden3SolanaPaymentRequest, witnessBuilder: () => witnessBuilder }); module.exports = __toCommonJS(index_exports); // src/kms/kms.ts var KMS = class { _registry = /* @__PURE__ */ new Map(); /** * register key provider in the KMS * * @param {KmsKeyType} keyType - kms key type * @param {IKeyProvider} keyProvider - key provider implementation */ registerKeyProvider(keyType, keyProvider) { if (this._registry.get(keyType)) { throw new Error("present keyType"); } this._registry.set(keyType, keyProvider); } /** * generates a new key and returns it kms key id * * @param {KmsKeyType} keyType * @param {Uint8Array} bytes * @returns kms key id */ async createKeyFromSeed(keyType, bytes) { const keyProvider = this._registry.get(keyType); if (!keyProvider) { throw new Error(`keyProvider not found for: ${keyType}`); } return keyProvider.newPrivateKeyFromSeed(bytes); } async createKey(keyType) { const keyProvider = this._registry.get(keyType); if (!keyProvider) { throw new Error(`keyProvider not found for: ${keyType}`); } return keyProvider.newPrivateKey(); } /** * gets public key for key id * * @param {KmsKeyId} keyId -- key id * @returns public key */ async publicKey(keyId) { const keyProvider = this._registry.get(keyId.type); if (!keyProvider) { throw new Error(`keyProvider not found for: ${keyId.type}`); } return keyProvider.publicKey(keyId); } /** * sign Uint8Array with giv KmsKeyIden * * @param {KmsKeyId} keyId - key id * @param {Uint8Array} data - prepared data bytes * @returns `Promise<Uint8Array>` - return signature */ async sign(keyId, data, opts) { const keyProvider = this._registry.get(keyId.type); if (!keyProvider) { throw new Error(`keyProvider not found for: ${keyId.type}`); } return keyProvider.sign(keyId, data, opts); } /** * Verifies a signature against the provided data and key ID. * * @param data - The data to verify the signature against. * @param signatureHex - The signature to verify, in hexadecimal format. * @param keyId - The key ID to use for verification. * @returns A promise that resolves to a boolean indicating whether the signature is valid. */ verify(data, signatureHex, keyId) { const keyProvider = this._registry.get(keyId.type); if (!keyProvider) { throw new Error(`keyProvider not found for: ${keyId.type}`); } return keyProvider.verify(data, signatureHex, keyId); } /** * get all keys by key type * * @param keyType - Key type * @returns list of keys */ list(keyType) { const keyProvider = this._registry.get(keyType); if (!keyProvider) { throw new Error(`keyProvider not found for: ${keyType}`); } return keyProvider.list(); } /** * get key provider by key type * * @param keyType - Key type * @returns key provider */ getKeyProvider(keyType) { return this._registry.get(keyType); } }; // src/kms/key-providers/bjj-provider.ts var import_js_crypto6 = require("@iden3/js-crypto"); var import_js_iden3_core8 = require("@iden3/js-iden3-core"); // src/kms/store/abstract-key-store.ts var AbstractPrivateKeyStore = class { }; // src/kms/store/memory-key-store.ts var InMemoryPrivateKeyStore = class { _data; constructor() { this._data = /* @__PURE__ */ new Map(); } list() { return Promise.resolve(Array.from(this._data).map(([alias, key]) => ({ alias, key }))); } async get(args) { const privateKey = this._data.get(args.alias); if (!privateKey) { throw new Error("no key under given alias"); } return privateKey; } async importKey(args) { this._data.set(args.alias, args.key); } }; // src/kms/store/types.ts var KmsKeyType = /* @__PURE__ */ ((KmsKeyType2) => { KmsKeyType2["BabyJubJub"] = "BJJ"; KmsKeyType2["Secp256k1"] = "Secp256k1"; KmsKeyType2["Ed25519"] = "Ed25519"; KmsKeyType2["RsaOaep256"] = "RSA-OAEP-256"; KmsKeyType2["P384"] = "P-384"; return KmsKeyType2; })(KmsKeyType || {}); // src/kms/store/local-storage-key-store.ts var LocalStoragePrivateKeyStore = class _LocalStoragePrivateKeyStore { static storageKey = "keystore"; /** * get all keys * * @abstract * @returns `Promise<{ alias: string; key: string }[]>` */ list() { const dataStr = localStorage.getItem(_LocalStoragePrivateKeyStore.storageKey); if (!dataStr) { throw new Error("no key under given alias"); } const data = JSON.parse(dataStr); return data.map((i) => ({ alias: i.id, key: i.value })); } /** * Gets key from the local storage * * @param {{ alias: string }} args * @returns hex string */ async get(args) { const dataStr = localStorage.getItem(_LocalStoragePrivateKeyStore.storageKey); if (!dataStr) { throw new Error("no key under given alias"); } const data = JSON.parse(dataStr); const privateKey = data.find((d) => d.id === args.alias); if (!privateKey) { throw new Error("no key under given alias"); } return privateKey.value; } /** * Import key to the local storage * * @param {{ alias: string; key: string }} args - alias and private key in the hex * @returns void */ async importKey(args) { const dataStr = localStorage.getItem(_LocalStoragePrivateKeyStore.storageKey); let data = []; if (dataStr) { data = JSON.parse(dataStr); } const index = data.findIndex((d) => d.id === args.alias); if (index > -1) { data[index].value = args.key; } else { data.push({ id: args.alias, value: args.key }); } localStorage.setItem(_LocalStoragePrivateKeyStore.storageKey, JSON.stringify(data)); } }; // src/kms/store/indexed-db-key-store.ts var import_idb_keyval = require("idb-keyval"); var IndexedDBPrivateKeyStore = class _IndexedDBPrivateKeyStore { static storageKey = "keystore"; _store; constructor() { this._store = (0, import_idb_keyval.createStore)( `${_IndexedDBPrivateKeyStore.storageKey}-db`, _IndexedDBPrivateKeyStore.storageKey ); } /** * get all keys * * @abstract * @returns `Promise<{ alias: string; key: string }[]>` */ async list() { const allEntries = await (0, import_idb_keyval.entries)(this._store); return allEntries.map(([alias, key]) => ({ alias, key: key.value })); } /** * Gets key from the indexed db storage * * @param {{ alias: string }} args * @returns hex string */ async get(args) { const key = await (0, import_idb_keyval.get)(args.alias, this._store); if (!key) { throw new Error("no key under given alias"); } return key.value; } /** * Import key to the indexed db storage * * @param {{ alias: string; key: string }} args - alias and private key in the hex * @returns void */ async importKey(args) { await (0, import_idb_keyval.set)(args.alias, { value: args.key }, this._store); } }; // src/kms/provider-helpers.ts function keyPath(keyType, keyID) { const basePath = ""; return basePath + String(keyType) + ":" + keyID; } // src/utils/encoding.ts var import_js_crypto = require("@iden3/js-crypto"); var import_rfc4648 = require("rfc4648"); var byteEncoder = new TextEncoder(); var byteDecoder = new TextDecoder(); function bytesToBase64url(b, opts = { pad: false }) { return import_rfc4648.base64url.stringify(b, opts); } function base64ToBytes(s, opts = { loose: true }) { return import_rfc4648.base64.parse(s, opts); } function bytesToBase64(b, opts = { pad: false }) { return import_rfc4648.base64.stringify(b, opts); } function base64UrlToBytes(s, opts = { loose: true }) { const inputBase64Url = s.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); return import_rfc4648.base64url.parse(inputBase64Url, opts); } function base58ToBytes(s) { return (0, import_js_crypto.base58ToBytes)(s); } function bytesToBase58(b) { return (0, import_js_crypto.base58FromBytes)(b); } function hexToBytes(s) { const input = s.startsWith("0x") ? s.substring(2) : s; return import_js_crypto.Hex.decodeString(input.toLowerCase()); } function encodeBase64url(s, opts = { pad: false }) { return import_rfc4648.base64url.stringify(byteEncoder.encode(s), opts); } function decodeBase64url(s, opts = { loose: true }) { return byteDecoder.decode(import_rfc4648.base64url.parse(s, opts)); } function bytesToHex(b) { return import_js_crypto.Hex.encodeString(b); } // src/utils/object.ts function mergeObjects(credSubject, otherCredSubject) { let result = {}; const credSubjectKeys = Object.keys(credSubject); for (const key of credSubjectKeys) { if (typeof otherCredSubject[key] !== "undefined") { if (typeof credSubject[key] !== "object" && typeof otherCredSubject[key] !== "object") { throw new Error("Invalid query"); } const subjectProperty = credSubject[key]; const otherSubjectProperty = otherCredSubject[key]; const propertyOperators = Object.keys(subjectProperty); const subjectPropertyResult = {}; for (const operatorKey of propertyOperators) { if (typeof otherSubjectProperty[operatorKey] !== "undefined") { const operatorValue1 = subjectProperty[operatorKey]; const operatorValue2 = otherSubjectProperty[operatorKey]; subjectPropertyResult[operatorKey] = [ .../* @__PURE__ */ new Set([ ...subjectPropertyResult[operatorKey] ?? [], operatorValue1, ...Array.isArray(operatorValue2) ? operatorValue2 : [operatorValue2] ]) ]; } else { subjectPropertyResult[operatorKey] = subjectProperty[operatorKey]; } } result[key] = { ...otherCredSubject[key], ...subjectPropertyResult }; } } result = { ...credSubject, ...otherCredSubject, ...result }; return result; } // src/utils/did-helper.ts var import_js_crypto2 = require("@iden3/js-crypto"); var import_js_iden3_core = require("@iden3/js-iden3-core"); var import_js_merkletree = require("@iden3/js-merkletree"); var import_ethers = require("ethers"); var DIDDocumentSignature = /* @__PURE__ */ ((DIDDocumentSignature2) => { DIDDocumentSignature2["EthereumEip712Signature2021"] = "EthereumEip712Signature2021"; return DIDDocumentSignature2; })(DIDDocumentSignature || {}); function isGenesisState(did, state) { if (typeof state === "string") { state = import_js_merkletree.Hash.fromHex(state).bigInt(); } const id = import_js_iden3_core.DID.idFromDID(did); return getIsGenesisStateById(id, state); } function getIsGenesisStateById(id, state) { const { method, blockchain, networkId } = import_js_iden3_core.DID.decodePartsFromId(id); const type = (0, import_js_iden3_core.buildDIDType)(method, blockchain, networkId); const idFromState = import_js_iden3_core.Id.idGenesisFromIdenState(type, state); return id.bigInt().toString() === idFromState.bigInt().toString(); } function isEthereumIdentity(did) { const issuerId = import_js_iden3_core.DID.idFromDID(did); try { import_js_iden3_core.Id.ethAddressFromId(issuerId); return true; } catch { return false; } } var buildVerifierId = (address, info) => { address = address.replace("0x", ""); const ethAddrBytes = import_js_crypto2.Hex.decodeString(address); const ethAddr = ethAddrBytes.slice(0, 20); const genesis = (0, import_js_iden3_core.genesisFromEthAddress)(ethAddr); const tp = (0, import_js_iden3_core.buildDIDType)(info.method, info.blockchain, info.networkId); return new import_js_iden3_core.Id(tp, genesis); }; var validateDIDDocumentAuth = async (did, resolverURL, state) => { const vm = await resolveDIDDocumentAuth(did, resolverURL, state); if (!vm) { throw new Error(`can't resolve DID document`); } if (!vm.published && !isGenesisState(did, state.bigInt())) { throw new Error(`issuer state not published and not genesis`); } }; var resolveDIDDocumentAuth = async (did, resolveURL, state) => { let url = `${resolveURL}/${encodeURIComponent(did.string())}`; if (state) { url += `?state=${state.hex()}`; } const resp = await fetch(url); const didResolutionRes = await resp.json(); return didResolutionRes.didDocument?.verificationMethod?.find( (i) => i.type === "Iden3StateInfo2023" ); }; function emptyStateDID(did) { const id = import_js_iden3_core.DID.idFromDID(did); const didType = (0, import_js_iden3_core.buildDIDType)( import_js_iden3_core.DID.methodFromId(id), import_js_iden3_core.DID.blockchainFromId(id), import_js_iden3_core.DID.networkIdFromId(id) ); const identifier = import_js_iden3_core.Id.idGenesisFromIdenState(didType, 0n); const emptyDID = import_js_iden3_core.DID.parseFromId(identifier); return emptyDID; } var resolveDidDocument = async (did, resolverUrl, opts) => { let didString = encodeURIComponent(did.string()); const isGistRequest = opts?.gist && !opts.state; if (isGistRequest) { didString = encodeURIComponent(emptyStateDID(did).string()); } let url = `${resolverUrl}/1.0/identifiers/${didString}`; if (opts?.signature) { url += `?signature=${opts.signature}`; } if (opts?.state) { url += `${url.includes("?") ? "&" : "?"}state=${opts.state.hex()}`; } if (opts?.gist) { url += `${url.includes("?") ? "&" : "?"}gist=${opts.gist.hex()}`; } try { const resp = await fetch(url); const data = await resp.json(); return data; } catch (e) { throw new Error(`Failed to resolve DID document for ${did} ${e}`); } }; var _buildDIDFromEthAddress = (didType, ethAddress) => { const genesis = (0, import_js_iden3_core.genesisFromEthAddress)(ethAddress); const identifier = new import_js_iden3_core.Id(didType, genesis); return import_js_iden3_core.DID.parseFromId(identifier); }; var buildDIDFromEthPubKey = (didType, pubKeyEth) => { const hashOfPublicKey = (0, import_ethers.keccak256)(hexToBytes(pubKeyEth)); const ethAddressBuffer = hexToBytes(hashOfPublicKey); const ethAddr = ethAddressBuffer.slice(-20); return _buildDIDFromEthAddress(didType, ethAddr); }; var buildDIDFromEthAddress = (didType, ethAddress) => { return _buildDIDFromEthAddress(didType, hexToBytes(ethAddress)); }; // src/utils/message-bus.ts var import_pubsub_js = __toESM(require("pubsub-js"), 1); var SDK_EVENTS = { TX_RECEIPT_ACCEPTED: "TX_RECEIPT_ACCEPTED" }; var MessageBus = class _MessageBus { /** * The singleton instance of the MessageBus class. */ static instance; /** * Private constructor for the MessageBus class. */ // eslint-disable-next-line @typescript-eslint/no-empty-function constructor() { } /** * Returns the singleton instance of the MessageBus class. * If the instance doesn't exist, it creates a new one. * @returns The singleton instance of the MessageBus class. */ static getInstance() { if (!_MessageBus.instance) { _MessageBus.instance = new _MessageBus(); } return _MessageBus.instance; } /** * Publishes a message to the specified topic. * * @template T - The type of data being published. * @param {SdkTopic} topic - The topic to publish the message to. * @param {T} data - The data to be published. * @returns {boolean} - Returns true if the message was successfully published, false otherwise. */ publish(topic, data) { return import_pubsub_js.default.publish(topic.toString(), data); } /** * Subscribes to a specific topic and registers a callback function to be executed when a message is published. * * @param topic - The topic to subscribe to. * @param callback - The callback function to be executed when a message is published. */ subscribe(topic, callback) { return import_pubsub_js.default.subscribe(topic.toString(), (_, data) => callback(data)); } /** * Subscribes to a specific topic and registers a callback function to be executed when a message is published. * The callback function is executed only once. * * @param topic - The topic to subscribe to. * @param callback - The callback function to be executed when a message is published. */ subscribeOnce(topic, callback) { import_pubsub_js.default.subscribeOnce(topic.toString(), (_, data) => callback(data)); } /** * Unsubscribes from a specific topic in the message bus. * * @param topic - The topic to unsubscribe from. * @returns A string or boolean indicating the success of the unsubscribe operation. */ unsubscribe(topic) { return import_pubsub_js.default.unsubscribe(topic.toString()); } }; // src/utils/compare-func.ts var bigIntCompare = (a, b) => { if (a < b) return -1; if (a > b) return 1; return 0; }; // src/utils/payments/solana.ts var import_borsh = require("borsh"); var import_ed25519 = require("@noble/curves/ed25519"); // src/verifiable/proof.ts var import_js_merkletree2 = require("@iden3/js-merkletree"); // src/verifiable/constants.ts var VerifiableConstants = Object.freeze({ ERRORS: { FiELD_IS_EMPTY: "fieldPath is empty", CONTEXT_TYPE_IS_EMPTY: "ctxType is empty", // ErrStateNotFound issuer state is genesis state. IDENTITY_DOES_NOT_EXIST: "Identity does not exist", IDENTITY_DOES_NOT_EXIST_CUSTOM_ERROR: "IdentityDoesNotExist", NO_AUTH_CRED_FOUND: "no auth credentials found", STATE_DOES_NOT_EXIST: "State does not exist", STATE_DOES_NOT_EXIST_CUSTOM_ERROR: "StateDoesNotExist", ROOT_DOES_NOT_EXIST: "Root does not exist", ROOT_DOES_NOT_EXIST_CUSTOM_ERROR: "RootDoesNotExist", // identity wallet ID_WALLET_NO_CREDENTIAL_SATISFIED_QUERY: "no credential satisfied query", ID_WALLET_SIGNER_IS_REQUIRED: "Ethereum signer is required to create Ethereum identities in order to transit state", ID_WALLET_PROVER_IS_REQUIRED: "prover is required to generate proofs for non ethereum identities", ID_WALLET_CORE_CLAIM_REQUIRED_IN_SIG_PROOF: "credential must have coreClaim representation in the signature proof", ID_WALLET_CORE_CLAIM_REQUIRED_IN_ANY_PROOF: "credential must have coreClaim representation in proofs", ID_WALLET_CORE_CLAIM_MISMATCH: "core claim representations is set in both proofs but they are not equal", ID_WALLET_CORE_CLAIM_IS_NOT_SET: "core claim is not set in credential proofs", ID_WALLET_PROFILE_OR_IDENTITY_NOT_FOUND: "profile or identity not found", ID_WALLET_PROFILE_ALREADY_EXISTS: "profile with given nonce or verifier already exists", ID_WALLET_PROFILE_ALREADY_EXISTS_VERIFIER_TAGS: "profile with given verifier and tags already exists", ID_WALLET_ISSUER_AUTH_BJJ_CRED_MUST_HAVE_ANY_PROOF: "issuer auth credential must have proof", ID_WALLET_ISSUER_AUTH_BJJ_CRED_MUST_HAVE_MTP_PROOF: "mtp is required for auth bjj key to issue new credentials", // proof service PROOF_SERVICE_NO_CREDENTIAL_FOR_IDENTITY_OR_PROFILE: "no credentials belong to did or its profiles", PROOF_SERVICE_NO_CREDENTIAL_FOR_QUERY: "credential not found for query", PROOF_SERVICE_PROFILE_GENESIS_DID_MISMATCH: "subject and auth profiles are not derived from the same did", PROOF_SERVICE_NO_QUERIES_IN_ZKP_REQUEST: "no queries in zkp request", // credential wallet CREDENTIAL_WALLET_ALL_CREDENTIALS_ARE_REVOKED: "all claims are revoked" }, CREDENTIAL_TYPE: { // VerifiableCredential is a W3C verifiable credential type W3C_VERIFIABLE_CREDENTIAL: "VerifiableCredential", W3C_VERIFIABLE_PRESENTATION: "VerifiablePresentation" }, CREDENTIAL_SUBJECT_PATH: "https://www.w3.org/2018/credentials#credentialSubject", JSONLD_SCHEMA: { // JSONLDSchemaIden3Credential is a schema for context with Iden3Credential type IDEN3_CREDENTIAL: "https://schema.iden3.io/core/jsonld/iden3proofs.jsonld", // JSONLDSchemaIden3DisplayMethod is a schema for context with Iden3BasicDisplayMethodV1 type IDEN3_DISPLAY_METHOD: "https://schema.iden3.io/core/jsonld/displayMethod.jsonld", // JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type W3C_CREDENTIAL_2018: "https://www.w3.org/2018/credentials/v1", W3C_VC_DOCUMENT_2018: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}`, IDEN3_PROOFS_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"@propagate":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","@vocab":"https://schema.iden3.io/core/vocab/Iden3SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"state":{"@id":"state","@context":{"txId":{"@id":"txId","@type":"xsd:string"},"blockTimestamp":{"@id":"blockTimestamp","@type":"xsd:integer"},"blockNumber":{"@id":"blockNumber","@type":"xsd:integer"},"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}}}},"SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","smt-proof-vocab":"https://schema.iden3.io/core/vocab/SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","existence":{"@id":"smt-proof-vocab:existence","@type":"xsd:boolean"},"revocationNonce":{"@id":"smt-proof-vocab:revocationNonce","@type":"xsd:number"},"siblings":{"@id":"smt-proof-vocab:siblings","@container":"@list"},"nodeAux":"@nest","hIndex":{"@id":"smt-proof-vocab:hIndex","@nest":"nodeAux","@type":"xsd:string"},"hValue":{"@id":"smt-proof-vocab:hValue","@nest":"nodeAux","@type":"xsd:string"}}},"BJJSignature2021":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#BJJSignature2021","@context":{"@version":1.1,"@protected":true,"id":"@id","@vocab":"https://schema.iden3.io/core/vocab/BJJSignature2021.md#","@propagate":true,"type":"@type","xsd":"http://www.w3.org/2001/XMLSchema#","coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"revocationStatus":{"@id":"revocationStatus","@type":"@id"},"state":{"@id":"state","@context":{"@version":1.1,"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}},"signature":{"@id":"signature","@type":"https://w3id.org/security#multibase"},"domain":"https://w3id.org/security#domain","creator":{"@id":"creator","@type":"http://www.w3.org/2001/XMLSchema#string"},"challenge":"https://w3id.org/security#challenge","created":{"@id":"created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},"verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"Iden3ReverseSparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3ReverseSparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-reverse-sparse-merkle-tree-proof-vocab":"https://schema.iden3.io/core/vocab/Iden3ReverseSparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","revocationNonce":{"@id":"iden3-reverse-sparse-merkle-tree-proof-vocab:revocationNonce","@type":"xsd:integer"},"statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-reverse-sparse-merkle-tree-proof-vocab:statusIssuer"}}},"Iden3commRevocationStatusV1.0":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3commRevocationStatusV1.0","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-comm-revocation-statusV1.0-vocab":"https://schema.iden3.io/core/vocab/Iden3commRevocationStatusV1.0.md#","xsd":"http://www.w3.org/2001/XMLSchema#","revocationNonce":{"@id":"iden3-comm-revocation-statusV1.0-vocab:revocationNonce","@type":"xsd:integer"},"statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-comm-revocation-statusV1.0-vocab:statusIssuer"}}},"Iden3OnchainSparseMerkleTreeProof2023":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3OnchainSparseMerkleTreeProof2023","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-onchain-sparse-merkle-tree-proof-2023-vocab":"https://schema.iden3.io/core/vocab/Iden3OnchainSparseMerkleTreeProof2023.md#","xsd":"http://www.w3.org/2001/XMLSchema#","revocationNonce":{"@id":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:revocationNonce","@type":"xsd:integer"},"statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:statusIssuer"}}},"JsonSchema2023":"https://www.w3.org/ns/credentials#JsonSchema2023","Iden3RefreshService2023":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3RefreshService2023"}}`, IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","displayMethod":{"@id":"https://schema.iden3.io/core/vocab/displayMethod.md#displayMethod","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3BasicDisplayMethodV1":"https://schema.iden3.io/core/vocab/displayMethod.md#Iden3BasicDisplayMethodV1"}}}}` }, // JsonSchema2023 JSON schema for verification of Iden3Credential JSON_SCHEMA_VALIDATOR: "JsonSchema2023", SERVICE_TYPE: { // Iden3CommServiceType is service type for iden3comm protocol IDEN3_COMM: "iden3-communication", // PushNotificationServiceType is service type for delivering push notifications to identity PUSH_NOTIFICATION: "push-notification" }, AUTH: { AUTH_BJJ_CREDENTIAL_HASH: "013fd3f623559d850fb5b02ff012d0e2", AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: "https://schema.iden3.io/core/json/auth.json", AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: "https://schema.iden3.io/core/jsonld/auth.jsonld", AUTH_BJJ_CREDENTIAL_TYPE: "AuthBJJCredential", AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: `{"$schema":"http://json-schema.org/draft-07/schema#","$metadata":{"uris":{"jsonLdContext":"https://schema.iden3.io/core/jsonld/auth.jsonld","js