@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
166 lines • 6.46 kB
text/typescript
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 { W3cJwtVerifiableCredential } from "./jwt-vc/W3cJwtVerifiableCredential.mjs";
import { W3cJsonLdVerifiableCredential } from "./linked-data-proofs/models/W3cJsonLdVerifiableCredential.mjs";
import { W3cVerifiableCredential } from "./models/credential/W3cVerifiableCredential.mjs";
import { W3cPresentation } from "./models/presentation/W3cPresentation.mjs";
import { W3cJsonLdVerifiablePresentation } from "./linked-data-proofs/models/W3cJsonLdVerifiablePresentation.mjs";
import "./models/index.mjs";
import { W3cJwtVerifiablePresentation } from "./jwt-vc/W3cJwtVerifiablePresentation.mjs";
import { ProofPurpose } from "./linked-data-proofs/proof-purposes/ProofPurpose.mjs";
import "./linked-data-proofs/index.mjs";
import { W3cCredentialRecord } from "./repository/W3cCredentialRecord.mjs";
import "./repository/index.mjs";
import { TrustedIssuerDid } from "../../agent/TrustedIssuersForVerification.mjs";
import "../kms/index.mjs";
//#region src/modules/vc/W3cCredentialServiceOptions.d.ts
export type W3cSignCredentialOptions<Format extends ClaimFormat.JwtVc | ClaimFormat.LdpVc | undefined = undefined> = Format extends ClaimFormat.JwtVc ? W3cJwtSignCredentialOptions : Format extends ClaimFormat.LdpVc ? W3cJsonLdSignCredentialOptions : W3cJwtSignCredentialOptions | W3cJsonLdSignCredentialOptions;
export type W3cVerifyCredentialOptions<Format extends ClaimFormat.JwtVc | ClaimFormat.LdpVc | undefined = undefined> = Format extends ClaimFormat.JwtVc ? W3cJwtVerifyCredentialOptions : Format extends ClaimFormat.LdpVc ? W3cJsonLdVerifyCredentialOptions : W3cJwtVerifyCredentialOptions | W3cJsonLdVerifyCredentialOptions;
export type W3cSignPresentationOptions<Format extends ClaimFormat.JwtVp | ClaimFormat.LdpVp | undefined = undefined> = Format extends ClaimFormat.JwtVp ? W3cJwtSignPresentationOptions : Format extends ClaimFormat.LdpVp ? W3cJsonLdSignPresentationOptions : W3cJwtSignPresentationOptions | W3cJsonLdSignPresentationOptions;
export 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;
}
export 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;
}
export 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;
/**
* Trusted issuers for the verification.
*/
trustedIssuers?: TrustedIssuerDid[];
}
export interface W3cJwtVerifyCredentialOptions extends W3cVerifyCredentialOptionsBase {
credential: W3cJwtVerifiableCredential | string;
}
export interface W3cJsonLdVerifyCredentialOptions extends W3cVerifyCredentialOptionsBase {
credential: W3cJsonLdVerifiableCredential;
proofPurpose?: ProofPurpose;
}
export 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;
}
export 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;
}
export 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;
/**
* Trusted issuers for the verification.
*/
trustedIssuers?: TrustedIssuerDid[];
}
export interface W3cJwtVerifyPresentationOptions extends W3cVerifyPresentationOptionsBase {
presentation: W3cJwtVerifiablePresentation | string;
}
export interface W3cJsonLdVerifyPresentationOptions extends W3cVerifyPresentationOptionsBase {
presentation: W3cJsonLdVerifiablePresentation;
purpose?: ProofPurpose;
}
export type W3cStoreCredentialOptions = {
record: W3cCredentialRecord;
};
//#endregion
//# sourceMappingURL=W3cCredentialServiceOptions.d.mts.map