@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
156 lines (155 loc) • 6.82 kB
text/typescript
import { KnownJwaSignatureAlgorithm } from "../kms/jwk/jwa.mjs";
import { HashName } from "../../crypto/hashes/Hasher.mjs";
import { ClaimFormat } from "./models/ClaimFormat.mjs";
import { IDisclosureFrame, IPresentationFrame, SdJwtVcHolderBinding } from "../sd-jwt-vc/SdJwtVcOptions.mjs";
import "../sd-jwt-vc/index.mjs";
import { W3cV2Credential } from "./models/credential/W3cV2Credential.mjs";
import { W3cV2JwtVerifiableCredential } from "./jwt-vc/W3cV2JwtVerifiableCredential.mjs";
import { W3cV2SdJwtVerifiableCredential } from "./sd-jwt-vc/W3cV2SdJwtVerifiableCredential.mjs";
import { W3cV2CredentialRecord } from "./repository/W3cV2CredentialRecord.mjs";
import "./repository/index.mjs";
import { W3cV2Presentation } from "./models/presentation/W3cV2Presentation.mjs";
import { W3cV2SdJwtVerifiablePresentation } from "./sd-jwt-vc/W3cV2SdJwtVerifiablePresentation.mjs";
import "./sd-jwt-vc/index.mjs";
import "./models/index.mjs";
import { W3cV2JwtVerifiablePresentation } from "./jwt-vc/W3cV2JwtVerifiablePresentation.mjs";
import "./jwt-vc/index.mjs";
import "../../crypto/index.mjs";
import "../kms/index.mjs";
//#region src/modules/vc/W3cV2CredentialServiceOptions.d.ts
type W3cV2SignCredentialOptions<Format extends ClaimFormat.JwtW3cVc | ClaimFormat.SdJwtW3cVc | undefined = undefined> = Format extends ClaimFormat.JwtW3cVc ? W3cV2JwtSignCredentialOptions : Format extends ClaimFormat.SdJwtW3cVc ? W3cV2SdJwtSignCredentialOptions : W3cV2JwtSignCredentialOptions | W3cV2SdJwtSignCredentialOptions;
type W3cV2VerifyCredentialOptions<Format extends ClaimFormat.JwtW3cVc | ClaimFormat.SdJwtW3cVc | undefined = undefined> = Format extends ClaimFormat.JwtW3cVc ? W3cV2JwtVerifyCredentialOptions : Format extends ClaimFormat.SdJwtW3cVc ? W3cV2SdJwtVerifyCredentialOptions : W3cV2JwtVerifyCredentialOptions | W3cV2SdJwtVerifyCredentialOptions;
type W3cV2SignPresentationOptions<Format extends ClaimFormat.JwtW3cVp | ClaimFormat.SdJwtW3cVp | undefined = undefined> = Format extends ClaimFormat.JwtW3cVp ? W3cV2JwtSignPresentationOptions : Format extends ClaimFormat.SdJwtW3cVp ? W3cV2SdJwtSignPresentationOptions : W3cV2JwtSignPresentationOptions | W3cV2SdJwtSignPresentationOptions;
type W3cV2VerifyPresentationOptions = W3cV2JwtVerifyPresentationOptions | W3cV2SdJwtVerifyPresentationOptions;
interface W3cV2SignCredentialOptionsBase {
/**
* The format of the credential to be signed.
*
* @see https://identity.foundation/claim-format-registry
*/
format: ClaimFormat;
/**
* The credential to be signed.
*/
credential: W3cV2Credential;
/**
* URI of the verificationMethod to be used for signing the credential.
*
* Must be a valid did url pointing to a key.
*/
verificationMethod: string;
}
interface W3cV2JwtSignCredentialOptions extends W3cV2SignCredentialOptionsBase {
format: ClaimFormat.JwtW3cVc;
/**
* The algorithm used to sign the JWT VC.
*/
alg: KnownJwaSignatureAlgorithm;
/**
* The holder to bind the credential to. When an holder is provided, a `cnf`
* claim will be added to the produced credential, binding it to the holder.
*/
holder?: SdJwtVcHolderBinding;
}
interface W3cV2SdJwtSignCredentialOptions extends W3cV2SignCredentialOptionsBase {
format: ClaimFormat.SdJwtW3cVc;
/**
* The algorithm used to sign the SD-JWT VC.
*/
alg: KnownJwaSignatureAlgorithm;
/**
* The hashing algorithm to use for creating digests of the disclosures.
*
* @default 'sha-256'
*/
hashingAlgorithm?: Exclude<HashName, 'sha-1'>;
/**
* The holder to bind the credential to. When an holder is provided, a `cnf`
* claim will be added to the produced credential, binding it to the holder.
*/
holder?: SdJwtVcHolderBinding;
/**
* Disclosure frame defining which claims should be selectively disclosable.
* If not provided, all claims will be disclosable.
*/
disclosureFrame?: IDisclosureFrame;
}
interface W3cV2VerifyCredentialOptionsBase {
credential: unknown;
}
interface W3cV2JwtVerifyCredentialOptions extends W3cV2VerifyCredentialOptionsBase {
credential: W3cV2JwtVerifiableCredential | string;
}
interface W3cV2SdJwtVerifyCredentialOptions extends W3cV2VerifyCredentialOptionsBase {
credential: W3cV2SdJwtVerifiableCredential | string;
}
interface W3cV2SignPresentationOptionsBase {
/**
* The format of the presentation to be signed.
*
* @see https://identity.foundation/claim-format-registry
*/
format: ClaimFormat;
/**
* The presentation to be signed.
*/
presentation: W3cV2Presentation;
/**
* 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 W3cV2JwtSignPresentationOptions extends W3cV2SignPresentationOptionsBase {
format: ClaimFormat.JwtW3cVp;
}
interface W3cV2SdJwtSignPresentationOptions extends W3cV2SignPresentationOptionsBase {
format: ClaimFormat.SdJwtW3cVp;
/**
* The hashing algorithm to use for creating digests of the disclosures.
*
* @default 'sha-256'
*/
hashingAlgorithm?: Exclude<HashName, 'sha-1'>;
/**
* Disclosure frame defining which claims should be selectively disclosable.
* If not provided, all claims will be disclosable.
*/
disclosureFrame?: IDisclosureFrame;
}
interface W3cV2VerifyPresentationOptionsBase {
/**
* 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;
}
interface W3cV2JwtVerifyPresentationOptions extends W3cV2VerifyPresentationOptionsBase {
presentation: W3cV2JwtVerifiablePresentation | string;
}
interface W3cV2SdJwtVerifyPresentationOptions extends W3cV2VerifyPresentationOptionsBase {
presentation: W3cV2SdJwtVerifiablePresentation | string;
}
interface W3cV2StoreCredentialOptions {
record: W3cV2CredentialRecord;
}
interface W3cV2SdJwtVcPresentOptions {
credential: W3cV2SdJwtVerifiableCredential | string;
/**
* Use true to disclose everything
*/
presentationFrame?: IPresentationFrame | true;
}
//#endregion
export { W3cV2JwtSignCredentialOptions, W3cV2JwtSignPresentationOptions, W3cV2JwtVerifyCredentialOptions, W3cV2JwtVerifyPresentationOptions, W3cV2SdJwtSignCredentialOptions, W3cV2SdJwtSignPresentationOptions, W3cV2SdJwtVcPresentOptions, W3cV2SdJwtVerifyCredentialOptions, W3cV2SdJwtVerifyPresentationOptions, W3cV2SignCredentialOptions, W3cV2SignPresentationOptions, W3cV2StoreCredentialOptions, W3cV2VerifyCredentialOptions, W3cV2VerifyPresentationOptions };
//# sourceMappingURL=W3cV2CredentialServiceOptions.d.mts.map