export declare const credentialUtils: any; export declare const pexUtils: { generatePresentationFromPexRequest: any; GeneratePresentationStatus: any; }; /** * Checks if a credential uses BBS+ signature * @param {Object} credential - The credential to check * @returns {boolean} True if the credential uses BBS+ signature * @example * const isBBS = isBBSPlusCredential(credential); * if (isBBS) { * console.log('This credential uses BBS+ signatures'); * } */ export declare function isBBSPlusCredential(credential: any): any; /** * Checks if a credential uses KVAC (BBDT16) signature * @param {Object} credential - The credential to check * @returns {boolean} True if the credential uses KVAC signature * @example * const isKVAC = isKvacCredential(credential); */ export declare function isKvacCredential(credential: any): any; /** * Checks if a credential is anonymous (BBS+ or KVAC) * @param {Object} credential - The credential to check * @returns {boolean} True if the credential is anonymous * @example * if (isAnnonymousCredential(credential)) { * console.log('This credential supports selective disclosure'); * } */ export declare function isAnnonymousCredential(credential: any): any; /** * Service class for managing verifiable credentials * @class * @description Provides methods for creating, signing, verifying, and presenting * verifiable credentials with support for various signature types */ declare class CredentialService { /** * Creates a new CredentialService instance * @constructor */ constructor(); rpcMethods: ((params?: {}) => any)[]; prefetchWitnessCache(params: any): Promise; isStatusList2021Revoked(params: any): Promise; createSDJWTPresentation(params: any): Promise; /** * Generates a new verifiable credential template * @param {Object} [params={}] - Generation parameters * @param {Object} [params.subject] - The credential subject * @returns {VerifiableCredential} A new verifiable credential instance * @example * const credential = credentialService.generateCredential({ * subject: { id: 'did:example:123', name: 'Alice' } * }); */ generateCredential(params?: {}): any; /** * Signs a verifiable credential * @param {Object} params - Signing parameters * @param {Object} params.vcJson - The credential JSON to sign * @param {Object} params.keyDoc - The key document for signing * @returns {Promise} The signed verifiable credential * @throws {Error} If validation fails or signing fails * @example * const signedCredential = await credentialService.signCredential({ * vcJson: credentialData, * keyDoc: issuerKeyDocument * }); */ signCredential(params: any): Promise; /** * Creates a verifiable presentation from credentials * @param {Object} params - Presentation parameters * @param {Array} params.credentials - Array of verifiable credentials to include * @param {Object} params.keyDoc - The key document for signing the presentation * @param {string} [params.challenge] - Challenge string for the presentation proof * @param {string} [params.id] - Presentation identifier * @param {string} [params.domain] - Domain for the presentation proof * @returns {Promise} The signed verifiable presentation * @throws {Error} If validation fails * @example * const presentation = await credentialService.createPresentation({ * credentials: [credential1, credential2], * keyDoc: holderKeyDocument, * challenge: 'abc123', * domain: 'example.com' * }); */ createPresentation(params: any): Promise; /** * Verifies a verifiable presentation * @param {Object} params - Verification parameters * @param {Object} params.presentation - The presentation to verify * @param {Object} [params.options] - Verification options * @returns {Promise} Verification result with verified status and any errors * @example * const result = await credentialService.verifyPresentation({ * presentation: presentationData * }); * console.log('Verified:', result.verified); */ verifyPresentation({ presentation, options }: any): Promise; /** * Verifies a verifiable credential including revocation check * @param {Object} params - Verification parameters * @param {Object} params.credential - The credential to verify * @param {Object} [params.membershipWitness] - Membership witness for revocation check * @returns {Promise} Verification result * @returns {boolean} returns.verified - Whether the credential is valid * @returns {string} [returns.error] - Error message if verification failed * @throws {Error} If validation fails * @example * const result = await credentialService.verifyCredential({ * credential: credentialData, * membershipWitness: witnessData * }); * if (!result.verified) { * console.error('Verification failed:', result.error); * } */ verifyCredential(params: any): Promise; /** * Filters credentials based on a presentation definition * @param {Object} params - Filter parameters * @param {Array} params.credentials - Array of credentials to filter * @param {Object} params.presentationDefinition - PEX presentation definition * @param {string} [params.holderDid] - DID of the credential holder * @returns {Object} Filtered credentials matching the presentation definition * @example * const filtered = credentialService.filterCredentials({ * credentials: allCredentials, * presentationDefinition: definition, * holderDid: 'did:example:holder' * }); */ filterCredentials(params: any): import("@sphereon/pex").SelectResults; /** * Evaluates a presentation against a presentation definition * @param {Object} params - Evaluation parameters * @param {Object} params.presentation - The presentation to evaluate * @param {Object} params.presentationDefinition - PEX presentation definition * @returns {Object} Evaluation result with validation details * @example * const evaluation = credentialService.evaluatePresentation({ * presentation: presentationData, * presentationDefinition: definition * }); */ evaluatePresentation(params: any): import("@sphereon/pex").EvaluationResults; /** * Checks if a credential uses BBS+ signature * @param {Object} params - Check parameters * @param {Object} params.credential - The credential to check * @returns {boolean} True if the credential uses BBS+ signature */ isBBSPlusCredential(params: any): any; /** * Checks if a credential uses KVAC signature * @param {Object} params - Check parameters * @param {Object} params.credential - The credential to check * @returns {boolean} True if the credential uses KVAC signature */ isKvacCredential(params: any): any; /** * Checks if a credential is an SD-JWT (Selective Disclosure JWT) credential * @param {Object} params - Check parameters * @param {string} params.credential - The JWT string to check * @returns {boolean} True if the credential is an SD-JWT credential * @example * const isSDJWT = credentialService.isSDJWTCredential({ * credential: 'eyJ0eXAiOiJ2YytzZC1qd3Q...' * }); */ isSDJWTCredential(params: any): boolean; /** * Converts a credential to W3C Verifiable Credential format * @description Handles both SD-JWT credentials (needs decoding) and regular W3C credentials (returns as-is) * @param {Object} params - Conversion parameters * @param {string|Object} params.credential - Either an SD-JWT string or a credential object * @returns {Promise} W3C Verifiable Credential format * @throws {Error} If credential cannot be converted to W3C format * @example * // Convert SD-JWT to W3C format * const w3cCredential = await credentialService.credentialToW3C({ * credential: 'eyJ0eXAiOiJ2YytzZC1qd3Q...' * }); * * // Returns W3C credential as-is * const w3cCredential = await credentialService.credentialToW3C({ * credential: { '@context': [...], type: [...], ... } * }); */ credentialToW3C(params: any): Promise; /** * Acquires a credential through OpenID for Verifiable Credentials (OID4VC) * @param {Object} params - Acquisition parameters * @param {string} params.uri - The credential offer URI * @param {string} [params.authorizationCode] - Authorization code if required * @param {Object} params.holderKeyDocument - Key document for the credential holder * @param {boolean} [params.allowInsecureHttpRequests] - Allow HTTP (non-HTTPS) offer/issuer endpoints. For local development only; bypasses HTTPS enforcement. * @returns {Promise} Result containing the credential or authorization URL * @returns {Object} [returns.credential] - The acquired credential * @returns {string} [returns.authorizationURL] - Authorization URL if auth is required * @example * const result = await credentialService.acquireOIDCredential({ * uri: 'openid-credential-offer://...', * holderKeyDocument: keyDoc * }); */ acquireOIDCredential({ uri, authorizationCode, holderKeyDocument, allowInsecureHttpRequests, }: { uri: string; authorizationCode?: string; holderKeyDocument: any; allowInsecureHttpRequests?: boolean; }): Promise; /** * Creates a BBS+ presentation with selective disclosure * @param {Object} params - Presentation parameters * @param {Array} params.credentials - Array of credentials with attributes to reveal * @param {Object} params.credentials[].credential - The BBS+ credential * @param {Array} [params.credentials[].attributesToReveal] - Attributes to reveal * @returns {Promise} The BBS+ presentation * @throws {Error} If validation fails * @example * const presentation = await credentialService.createBBSPresentation({ * credentials: [{ * credential: bbsCredential, * attributesToReveal: ['name', 'age'] * }] * }); */ createBBSPresentation(params: any): Promise; /** * Gets the accumulator ID from a credential's status * @param {Object} params - Parameters * @param {Object} params.credential - The credential to get accumulator ID from * @returns {string|null} The accumulator ID or null if not present * @throws {Error} If credential is not provided */ getAccumulatorId({ credential }: { credential: any; }): any; /** * Gets accumulator data from the blockchain for a credential * @param {Object} params - Parameters * @param {Object} params.credential - The credential to get accumulator data for * @returns {Promise} The accumulator data or null if not found * @throws {Error} If credential is not provided */ getAccumulatorData({ credential }: { credential: any; }): Promise; /** * Updates the membership witness with the latest accumulator state * @description The witness is generated by the issuer when the credential is created * and is stored in the wallet when the credential is imported. This method updates * it with the latest accumulator changes from the blockchain. * @param {Object} params - Update parameters * @param {Object} params.credential - The credential with revocation status * @param {Object} params.membershipWitnessJSON - Current membership witness in JSON format * @returns {Promise} Updated membership witness in JSON format * @throws {Error} If updates cannot be fetched or applied */ updateMembershipWitness({ credential, membershipWitnessJSON }: { credential: any; membershipWitnessJSON: any; }): Promise; /** * Derives verifiable credentials from a presentation with selective disclosure * @param {Object} params - Derivation parameters * @param {Array} params.credentials - Array of credential objects * @param {Object} params.credentials[].credential - The credential * @param {Array} params.credentials[].attributesToReveal - Attributes to reveal * @param {Object} [params.credentials[].witness] - Membership witness for revocation * @param {Object} [params.options={}] - Additional options for derivation * @param {Object} [params.proofRequest] - Proof request with constraints * @returns {Promise} Array of derived credentials * @throws {Error} If validation fails * @example * const derivedCredentials = await credentialService.deriveVCFromPresentation({ * credentials: [{ * credential: bbsCredential, * attributesToReveal: ['name', 'dateOfBirth'] * }] * }); */ deriveVCFromPresentation(params: any): Promise; generatePresentationFromPex(params: any): Promise; /** * Test method for range proofs * @private * @returns {Promise} */ testRangeProof(): Promise; } /** * Singleton instance of the credential service * @type {CredentialService} * @example * import { credentialService } from '@docknetwork/wallet-sdk-wasm/services/credential'; * * // Create and sign a credential * const credential = credentialService.generateCredential({ * subject: { id: 'did:example:123' } * }); * const signed = await credentialService.signCredential({ * vcJson: credential, * keyDoc: issuerKey * }); * * // Verify a credential * const result = await credentialService.verifyCredential({ * credential: signedCredential * }); */ export declare const credentialService: CredentialService; export {}; //# sourceMappingURL=service.d.ts.map