import type { Signer, JWTVerified, JWTHeader, JWTOptions, JWTVerifyOptions } from 'did-jwt'; export declare const JWT_ALG = "ES256K"; export declare const JWT_FORMAT: RegExp; export declare const DEFAULT_CONTEXT = "https://www.w3.org/2018/credentials/v1"; export declare const DEFAULT_VC_TYPE = "VerifiableCredential"; export declare const DEFAULT_VP_TYPE = "VerifiablePresentation"; /** * The `JwtProof2020` is a synthetic proof type, usable for differentiating credentials by proof type when representing * JWT credentials as W3C VC JSON. It is not a registered W3C VC Data Model algorithm and should not be treated as * such. * * This proof type is only intended as a convenience and does not actually prove the validity of a VC/VP in JSON * representation. The actual verifiable credential or presentation is represented in the `jwt` property. */ export declare const DEFAULT_JWT_PROOF_TYPE = "JwtProof2020"; export type JwtCredentialSubject = Record; export interface CredentialStatus { id: string; type: string; } /** * A JWT payload representation of a Credential * @see https://www.w3.org/TR/vc-data-model/#jwt-encoding */ export interface JwtCredentialPayload { iss?: string; sub?: string; vc: Extensible<{ '@context': string[] | string; type: string[] | string; credentialSubject: JwtCredentialSubject; credentialStatus?: CredentialStatus; evidence?: any; termsOfUse?: any; }>; nbf?: number; aud?: string | string[]; exp?: number; jti?: string; [x: string]: any; } /** * A JWT payload representation of a Presentation * @see https://www.w3.org/TR/vc-data-model/#jwt-encoding */ export interface JwtPresentationPayload { vp: Extensible<{ '@context': string[] | string; type: string[] | string; verifiableCredential?: VerifiableCredential[] | VerifiableCredential; }>; iss?: string; aud?: string | string[]; nbf?: number; exp?: number; jti?: string; nonce?: string; [x: string]: any; } export type IssuerType = Extensible<{ id: string; }> | string; export type DateType = string | Date; /** * Used as input when creating Verifiable Credentials */ interface FixedCredentialPayload { '@context': string | string[]; id?: string; type: string | string[]; issuer: IssuerType; issuanceDate: DateType; expirationDate?: DateType; credentialSubject: Extensible<{ id?: string; }>; credentialStatus?: CredentialStatus; evidence?: any; termsOfUse?: any; } /** * A more flexible representation of a {@link W3CCredential} that can be used as input to methods * that expect it. */ export type CredentialPayload = Extensible; /** * This is meant to reflect unambiguous types for the properties in `CredentialPayload` */ interface NarrowCredentialDefinitions { '@context': string[]; type: string[]; issuer: Exclude; issuanceDate: string; expirationDate?: string; } /** * Replaces the matching property types of T with the ones in U */ type Replace = Omit & U; type Extensible = T & { [x: string]: any; }; /** * This data type represents a parsed VerifiableCredential. * It is meant to be an unambiguous representation of the properties of a Credential and is usually the result of a * transformation method. See `transformCredentialInput()` for more details. * * `issuer` is always an object with an `id` property and potentially other app specific issuer claims * `issuanceDate` is an ISO DateTime string * `expirationDate`, is a nullable ISO DateTime string * * Any JWT specific properties are transformed to the broader W3C variant and any app specific properties are left * intact */ export type W3CCredential = Extensible>; /** * used as input when creating Verifiable Presentations */ export interface FixedPresentationPayload { '@context': string | string[]; type: string | string[]; id?: string; verifiableCredential?: VerifiableCredential[]; holder: string; verifier?: string | string[]; issuanceDate?: string; expirationDate?: string; } /** * A more flexible representation of a {@link W3CPresentation} that can be used as input to methods * that expect it. */ export type PresentationPayload = Extensible; interface NarrowPresentationDefinitions { '@context': string[]; type: string[]; verifier: string[]; verifiableCredential?: Verifiable[]; } /** * This data type represents a parsed Presentation payload. * It is meant to be an unambiguous representation of the properties of a Presentation and is usually the result of a * transformation method. See `transformPresentationInput()` for more details. * * The `verifiableCredential` array should contain parsed `Verifiable` elements. * Any JWT specific properties are transformed to the broader W3C variant and any other app specific properties are * left intact. */ export type W3CPresentation = Extensible>; export interface Proof { type?: string; [x: string]: any; } /** * Represents a readonly representation of a verifiable object, including the {@link Proof} * property that can be used to verify it. */ export type Verifiable = Readonly & { readonly proof: Proof; }; export type JWT = string; /** * A union type for both possible representations of a Credential (JWT and W3C standard) * * @see https://www.w3.org/TR/vc-data-model/#proof-formats */ export type VerifiableCredential = JWT | Verifiable; /** * A union type for both possible representations of a Presentation (JWT and W3C standard) * * @see https://www.w3.org/TR/vc-data-model/#proof-formats */ export type VerifiablePresentation = JWT | Verifiable; export type VerifiedJWT = JWTVerified; /** * Represents the result of a Presentation verification. * It includes the properties produced by `did-jwt` and a W3C compliant representation of * the Presentation that was just verified. * * This is usually the result of a verification method and not meant to be created by generic code. */ export type VerifiedPresentation = VerifiedJWT & { verifiablePresentation: Verifiable; }; /** * Represents the result of a Credential verification. * It includes the properties produced by `did-jwt` and a W3C compliant representation of * the Credential that was just verified. * * This is usually the result of a verification method and not meant to be created by generic code. */ export type VerifiedCredential = VerifiedJWT & { verifiableCredential: Verifiable; }; /** * Represents a tuple of a DID-URL with a `Signer` and associated algorithm. */ export interface Issuer { did: string; signer: Signer; alg?: string; } /** * Represents the Creation Options that can be passed to the createVerifiableCredentialJwt method. */ export interface CreateCredentialOptions extends Partial { /** * Determines whether the JSON->JWT transformation will remove the original fields from the input payload. * See https://www.w3.org/TR/vc-data-model/#jwt-encoding * * @default true */ removeOriginalFields?: boolean; /** * Allows including or overriding some header parameters for the resulting JWT. * If the issuer or holder does not list an `alg`, then the one specified in `header` will be used */ header?: Partial; [x: string]: any; } /** * Represents the Verification Options that can be passed to the verifyCredential method. * These options are forwarded to the lower level verification code */ export interface VerifyCredentialOptions extends JWTVerifyOptions { /** * When transforming the result of the verification into a W3C VerifiableCredential, this property dictates whether * the JWT specific properties are removed from the payload or not. Defaults to `true`. */ removeOriginalFields?: boolean; /** * Use this to override the default checks performed during verification */ policies?: VerifyCredentialPolicies; [x: string]: any; } export interface VerifyCredentialPolicies { now?: number; issuanceDate?: boolean; expirationDate?: boolean; format?: boolean; /** * Other policies are forwarded to lower level libs */ [x: string]: any; } /** * Represents the Verification Options that can be passed to the verifyPresentation method. * The verification will fail if given options are NOT satisfied. */ export interface VerifyPresentationOptions extends VerifyCredentialOptions { domain?: string; challenge?: string; } /** * Represents the Creation Options that can be passed to the createVerifiablePresentationJwt method. */ export interface CreatePresentationOptions extends CreateCredentialOptions { domain?: string; challenge?: string; } export {}; //# sourceMappingURL=types.d.ts.map