UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

159 lines (158 loc) • 6.52 kB
import { KnownJwaSignatureAlgorithm } from "../kms/jwk/jwa.mjs"; import { SingleOrArray } from "../../types.mjs"; import { ClaimFormat } from "./models/ClaimFormat.mjs"; import { W3cCredential } from "./models/credential/W3cCredential.mjs"; import { W3cJsonLdVerifiableCredential } from "./data-integrity/models/W3cJsonLdVerifiableCredential.mjs"; import { W3cCredentialRecord } from "./repository/W3cCredentialRecord.mjs"; import "./repository/index.mjs"; import { W3cJwtVerifiableCredential } from "./jwt-vc/W3cJwtVerifiableCredential.mjs"; import { W3cVerifiableCredential } from "./models/credential/W3cVerifiableCredential.mjs"; import { W3cPresentation } from "./models/presentation/W3cPresentation.mjs"; import "./models/index.mjs"; import { W3cJwtVerifiablePresentation } from "./jwt-vc/W3cJwtVerifiablePresentation.mjs"; import { W3cJsonLdVerifiablePresentation } from "./data-integrity/models/W3cJsonLdVerifiablePresentation.mjs"; import { ProofPurpose } from "./data-integrity/proof-purposes/ProofPurpose.mjs"; import "./data-integrity/index.mjs"; import "../kms/index.mjs"; //#region src/modules/vc/W3cCredentialServiceOptions.d.ts type W3cSignCredentialOptions<Format extends ClaimFormat.JwtVc | ClaimFormat.LdpVc | undefined = undefined> = Format extends ClaimFormat.JwtVc ? W3cJwtSignCredentialOptions : Format extends ClaimFormat.LdpVc ? W3cJsonLdSignCredentialOptions : W3cJwtSignCredentialOptions | W3cJsonLdSignCredentialOptions; type W3cVerifyCredentialOptions<Format extends ClaimFormat.JwtVc | ClaimFormat.LdpVc | undefined = undefined> = Format extends ClaimFormat.JwtVc ? W3cJwtVerifyCredentialOptions : Format extends ClaimFormat.LdpVc ? W3cJsonLdVerifyCredentialOptions : W3cJwtVerifyCredentialOptions | W3cJsonLdVerifyCredentialOptions; type W3cSignPresentationOptions<Format extends ClaimFormat.JwtVp | ClaimFormat.LdpVp | undefined = undefined> = Format extends ClaimFormat.JwtVp ? W3cJwtSignPresentationOptions : Format extends ClaimFormat.LdpVp ? W3cJsonLdSignPresentationOptions : W3cJwtSignPresentationOptions | W3cJsonLdSignPresentationOptions; type W3cVerifyPresentationOptions = W3cJwtVerifyPresentationOptions | W3cJsonLdVerifyPresentationOptions; interface W3cSignCredentialOptionsBase { /** * The format of the credential to be signed. * * @see https://identity.foundation/claim-format-registry */ format: ClaimFormat; /** * The credential to be signed. */ credential: W3cCredential; /** * URI of the verificationMethod to be used for signing the credential. * * Must be a valid did url pointing to a key. */ verificationMethod: string; } interface W3cJwtSignCredentialOptions extends W3cSignCredentialOptionsBase { format: ClaimFormat.JwtVc; /** * The alg to be used for signing the credential. * * Must be a valid JWA signature algorithm. */ alg: KnownJwaSignatureAlgorithm; } interface W3cJsonLdSignCredentialOptions extends W3cSignCredentialOptionsBase { /** * The format of the credential to be signed. Must be either `jwt_vc` or `ldp_vc`. * @see https://identity.foundation/claim-format-registry */ format: ClaimFormat.LdpVc; /** * The proofType to be used for signing the credential. * * Must be a valid Linked Data Signature suite. */ proofType: string; proofPurpose?: ProofPurpose; created?: string; } interface W3cVerifyCredentialOptionsBase { credential: unknown; /** * Whether to verify the credentialStatus, if present. */ verifyCredentialStatus?: boolean; } interface W3cJwtVerifyCredentialOptions extends W3cVerifyCredentialOptionsBase { credential: W3cJwtVerifiableCredential | string; } interface W3cJsonLdVerifyCredentialOptions extends W3cVerifyCredentialOptionsBase { credential: W3cJsonLdVerifiableCredential; proofPurpose?: ProofPurpose; } interface W3cCreatePresentationOptions { credentials: SingleOrArray<W3cVerifiableCredential>; id?: string; holder?: string; } interface W3cSignPresentationOptionsBase { /** * The format of the presentation to be signed. * * @see https://identity.foundation/claim-format-registry */ format: ClaimFormat; /** * The presentation to be signed. */ presentation: W3cPresentation; /** * URI of the verificationMethod to be used for signing the presentation. * * Must be a valid did url pointing to a key. */ verificationMethod: string; /** * The challenge / nonce to be used in the proof to prevent replay attacks. */ challenge?: string; /** * The domain / aud to be used in the proof to assert the intended recipient. */ domain?: string; } interface W3cJsonLdSignPresentationOptions extends W3cSignPresentationOptionsBase { format: ClaimFormat.LdpVp; /** * The proofType to be used for signing the presentation. * * Must be a valid Linked Data Signature suite. */ proofType: string; proofPurpose: ProofPurpose; } interface W3cJwtSignPresentationOptions extends W3cSignPresentationOptionsBase { format: ClaimFormat.JwtVp; /** * The alg to be used for signing the presentation. * * Must be a valid JWA signature algorithm. */ alg: KnownJwaSignatureAlgorithm; } interface W3cVerifyPresentationOptionsBase { /** * The presentation to be verified. */ presentation: unknown; /** * The challenge / nonce that must present in the presentation prevent replay attacks. */ challenge: string; /** * The domain / aud to be used in the proof to assert the intended recipient. */ domain?: string; /** * Whether to verify the credentialStatus, if present. */ verifyCredentialStatus?: boolean; } interface W3cJwtVerifyPresentationOptions extends W3cVerifyPresentationOptionsBase { presentation: W3cJwtVerifiablePresentation | string; } interface W3cJsonLdVerifyPresentationOptions extends W3cVerifyPresentationOptionsBase { presentation: W3cJsonLdVerifiablePresentation; purpose?: ProofPurpose; } type W3cStoreCredentialOptions = { record: W3cCredentialRecord; }; //#endregion export { W3cCreatePresentationOptions, W3cJsonLdSignCredentialOptions, W3cJsonLdSignPresentationOptions, W3cJsonLdVerifyCredentialOptions, W3cJsonLdVerifyPresentationOptions, W3cJwtSignCredentialOptions, W3cJwtSignPresentationOptions, W3cJwtVerifyCredentialOptions, W3cJwtVerifyPresentationOptions, W3cSignCredentialOptions, W3cSignPresentationOptions, W3cStoreCredentialOptions, W3cVerifyCredentialOptions, W3cVerifyPresentationOptions }; //# sourceMappingURL=W3cCredentialServiceOptions.d.mts.map