UNPKG

@vecrea/oid4vc-verifier-endpoint-core

Version:
1,349 lines (1,302 loc) 182 kB
import { DescriptorMapJSON } from '@vecrea/oid4vc-prex'; import { Duration as Duration_2 } from 'luxon'; import { IdTokenType as IdTokenType_2 } from './IdTokenType'; import { PresentationDefinition } from '@vecrea/oid4vc-prex'; import { PresentationDefinitionJSON } from '@vecrea/oid4vc-prex'; import { PresentationSubmission } from '@vecrea/oid4vc-prex'; import { Result } from '@vecrea/oid4vc-core/utils'; import { z } from 'zod'; /** * Abstract class that implements the Configuration interface * @abstract * @class AbstractConfiguration * @implements {Configuration} */ export declare abstract class AbstractConfiguration implements Configuration { #private; /** * Abstract method to get the private JWK used for signing the JAR * @abstract * @returns {string} Private JWK used for signing the JAR */ abstract jarSigningPrivateJwk(): string; /** * Abstract method to get the client ID * @abstract * @returns {string} Client ID */ abstract clientId(): string; /** * Abstract method to get the client ID scheme name * @abstract * @returns {ClientIdSchemeName} Client ID scheme name */ abstract clientIdSchemeName(): ClientIdSchemeName; /** * Abstract method to get the public URL * @abstract * @returns {string} Public URL */ abstract publicUrl(): string; /** * Abstract method to get the JAR option name * @abstract * @returns {EmbedOptionName} JAR option name */ abstract jarOptionName(): EmbedOptionName; /** * Abstract method to get the response mode option name * @abstract * @returns {ResponseModeOptionName} Response mode option name */ abstract responseModeOptionName(): ResponseModeOptionName; /** * Abstract method to get the presentation definition option name * @abstract * @returns {EmbedOptionName} Presentation definition option name */ abstract presentationDefinitionOptionName(): EmbedOptionName; /** * Abstract method to get the maximum age * @abstract * @returns {Duration} Maximum age */ abstract maxAge(): Duration; /** * Abstract method to get the frontend cors origin * @abstract * @returns {string} Frontend cors origin */ abstract frontendCorsOrigin(): string | string[]; /** * Function to get the byte length of the transaction ID * @type {() => number} */ transactionIdByteLength: () => number; /** * Function to get the byte length of the request ID * @type {() => number} */ requestIdByteLength: () => number; /** * Function to get the current date * @type {() => Date} */ now: () => () => Date; /** * Function to get the signing configuration for the JAR * @type {() => SigningConfig} */ jarSigning: () => SigningConfig; /** * Function to get the client ID scheme * @type {() => ClientIdScheme} */ clientIdScheme: () => ClientIdScheme; /** * Retrieves the JAR by reference option. * @returns {EmbedOption.ByReference} The JAR by reference option. */ jarByReference: () => EmbedOption.ByReference; /** * Determines and returns the JAR embed option. * @returns {EmbedOption} The JAR embed option, either ByValue or ByReference. * @description This method checks the JAR option name and returns the appropriate EmbedOption. * If the option name is 'by_value', it returns the ByValue singleton instance. * Otherwise, it returns the ByReference option. * * @example * const embedOption = instance.jarOption(); * if (embedOption instanceof EmbedOption.ByValue) { * console.log('JAR is embedded by value'); * } else { * console.log('JAR is embedded by reference'); * } */ jarOption: () => EmbedOption; /** * Function to get the response mode option * @type {() => ResponseModeOption} */ responseModeOption: () => ResponseModeOption; /** * Function to get the presentation definition option by reference * @type {() => EmbedOption.ByReference} */ presentationDefinitionByReference: () => EmbedOption.ByReference; /** * Function to get the presentation definition option * @type {() => EmbedOption} */ presentationDefinitionOption: () => EmbedOption; /** * Function to get the JWK option * @type {() => EmbedOption} */ jwkOption: () => EmbedOption; /** * Function to get the signed response algorithm for the ID token * @type {() => string | undefined} */ idTokenSignedResponseAlg: () => string | undefined; /** * Function to get the encrypted response algorithm for the ID token * @type {() => string | undefined} */ idTokenEncryptedResponseAlg: () => string | undefined; /** * Function to get the encrypted response encryption for the ID token * @type {() => string | undefined} */ idTokenEncryptedResponseEnc: () => string | undefined; /** * Function to get the supported subject syntax types * @type {() => string[]} */ subjectSyntaxTypesSupported: () => string[]; /** * Function to get the signed response algorithm for the authorization * @type {() => string | undefined} */ authorizationSignedResponseAlg: () => string | undefined; /** * Function to get the encrypted response algorithm for the authorization * @type {() => string | undefined} */ authorizationEncryptedResponseAlg: () => string | undefined; /** * Function to get the encrypted response encryption for the authorization * @type {() => string | undefined} */ authorizationEncryptedResponseEnc: () => string | undefined; /** * Function to get the JARM option * @type {() => JarmOption} */ jarmOption: () => JarmOption; /** * Function to get the client metadata * @type {() => ClientMetaData} */ clientMetaData: () => ClientMetaData; /** * Function to get the response URL builder * @type {() => UrlBuilder} */ responseUrlBuilder: () => UrlBuilder; /** * Function to get the verifier configuration * @type {() => VerifierConfig} */ verifierConfig: () => VerifierConfig; /** * Asynchronous method to validate the configuration * @async */ validate(): Promise<void>; /** * initiate transaction path for Verifier Frontend */ initTransactionPath: () => string; /** * get wallet response path for Verifier Frontend * @param {string} placeholder - Placeholder for path parameter */ getWalletResponsePath: (placeholder: string) => string; /** * get public JWK set path for Wallet */ getPublicJWKSetPath: () => string; /** * get request object path for Wallet * @param {string} placeholder - Placeholder for path parameter */ requestJWTPath: (placeholder: string) => string; /** * get presentation definition path for Wallet * @param {string} placeholder - Placeholder for path parameter */ presentationDefinitionPath: (placeholder: string) => string; /** * get jarm JWK set path for Wallet * @param {string} placeholder - Placeholder for path parameter */ jarmJWKSetPath: (placeholder: string) => string; /** * post wallet response path for Wallet */ walletResponsePath: () => string; } /** * Represents either a DirectPost or DirectPostJwt authorization response. */ export declare type AuthorizationResponse = AuthorizationResponse.DirectPost | AuthorizationResponse.DirectPostJwt; export declare namespace AuthorizationResponse { /** * AuthorizationResponse interface represents the response from an authorization endpoint. * It can be either a 'DirectPost' or 'DirectPostJwt' response type. * * @interface AuthorizationResponse * @property {('DirectPost' | 'DirectPostJwt')} __type - The type of the authorization response. * It can be one of the following values: * - 'DirectPost': Indicates that the response is a direct POST response. * - 'DirectPostJwt': Indicates that the response is a direct POST response with a JWT (JSON Web Token). */ export interface AuthorizationResponseBase { __type: 'DirectPost' | 'DirectPostJwt'; } /** * Converts a JSON object to an AuthorizationResponse instance. * @param json - The JSON object to convert. * @returns The AuthorizationResponse instance. */ const fromJSON: FromJSON<AuthorizationResponseJSON, AuthorizationResponse>; /** * Represents a direct post authorization response. */ export class DirectPost implements AuthorizationResponseBase { readonly response: AuthorizationResponseData; /** Discriminator for the DirectPost type. */ readonly __type: "DirectPost"; /** * Creates a new DirectPost instance. * @param response - The authorization response data. */ constructor(response: AuthorizationResponseData); /** * Converts the DirectPost instance to a JSON object. * @returns The JSON representation of the DirectPost instance. */ toJSON(): DirectPostJSON; /** * Creates a new DirectPost instance from a JSON object. * @param json - The JSON object to create the DirectPost instance from. * @returns The DirectPost instance. */ static fromJSON(json: DirectPostJSON): DirectPost; } /** * Represents a direct post JWT authorization response. */ export class DirectPostJwt implements AuthorizationResponseBase { readonly state: string; readonly jarm: Jwt; /** Discriminator for the DirectPostJwt type. */ readonly __type: "DirectPostJwt"; /** * Creates a new DirectPostJwt instance. * @param state - The state parameter. * @param jarm - The JWT Authorization Response Mode (JARM) token. */ constructor(state: string, jarm: Jwt); /** * Converts the DirectPostJwt instance to a JSON object. * @returns The JSON representation of the DirectPostJwt instance. */ toJSON(): DirectPostJwtJSON; /** * Creates a new DirectPostJwt instance from a JSON object. * @param json - The JSON object to create the DirectPostJwt instance from. * @returns The DirectPostJwt instance. */ static fromJSON(json: DirectPostJwtJSON): DirectPostJwt; } {}; } /** * Represents the data structure for an authorization response. */ export declare interface AuthorizationResponseData { /** The state parameter, typically used as a request identifier. */ state?: string; /** The ID token, if present in the response. */ idToken?: string; /** The Verifiable Presentation token, if present in the response. */ vpToken?: string; /** The Presentation Submission object, if present in the response. */ presentationSubmission?: PresentationSubmission; /** Error code, if an error occurred during the authorization process. */ error?: string; /** Detailed description of the error, if an error occurred. */ errorDescription?: string; } /** * JSON representation of the AuthorizationResponse data. * @typedef {Object} AuthorizationResponseJSON@typedef {Object} AuthorizationResponseJSON * @property {Object} response - The response object. */ export declare type AuthorizationResponseJSON = z.infer<typeof authorizationResponseSchema>; /** * Schema for the AuthorizationResponse data. * @typedef {Object} AuthorizationResponseSchema * @property {string} state - The state parameter. * @property {string} response - The response parameter. * */ export declare const authorizationResponseSchema: z.ZodUnion<[z.ZodObject<{ response: z.ZodObject<{ state: z.ZodOptional<z.ZodString>; id_token: z.ZodOptional<z.ZodString>; vp_token: z.ZodOptional<z.ZodString>; presentation_submission: z.ZodOptional<z.ZodObject<{ id: z.ZodString; definition_id: z.ZodString; descriptor_map: z.ZodArray<z.ZodType<DescriptorMapJSON, z.ZodTypeDef, DescriptorMapJSON>, "many">; }, "strip", z.ZodTypeAny, { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; }, { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; }>>; error: z.ZodOptional<z.ZodString>; error_description: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }, { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }>; }, "strip", z.ZodTypeAny, { response: { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }; }, { response: { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }; }>, z.ZodObject<{ state: z.ZodString; response: z.ZodString; }, "strip", z.ZodTypeAny, { response: string; state: string; }, { response: string; state: string; }>]>; /** * Represents a client ID scheme configuration. * This type can be one of the following: * - PreRegistered: A pre-registered client ID scheme. * - X509SanDns: A client ID scheme using X.509 Subject Alternative Name DNS. * - X509SanUri: A client ID scheme using X.509 Subject Alternative Name URI. * * @typedef {ClientIdScheme.PreRegistered | ClientIdScheme.X509SanDns | ClientIdScheme.X509SanUri} ClientIdScheme */ export declare type ClientIdScheme = ClientIdScheme.PreRegistered | ClientIdScheme.X509SanDns | ClientIdScheme.X509SanUri; /** * Namespace containing implementations and type guards for various ClientIdScheme types. */ export declare namespace ClientIdScheme { /** * ClientIdScheme interface represents the scheme used for client identification. * It specifies the type of client ID scheme, the client ID value, and the JAR signing configuration. * * @interface ClientIdScheme * @property {('PreRegistered' | 'X509SanDns' | 'X509SanUri')} __type - The type of the client ID scheme. * It can be one of the following values: * - 'PreRegistered': Indicates that the client ID is pre-registered. * - 'X509SanDns': Indicates that the client ID is based on the X.509 Subject Alternative Name (SAN) DNS entry. * - 'X509SanUri': Indicates that the client ID is based on the X.509 Subject Alternative Name (SAN) URI entry. * @property {string} clientId - The client ID value. * @property {SigningConfig} jarSigning - The configuration for JAR signing. */ export interface ClientIdScheme { __type: 'PreRegistered' | 'X509SanDns' | 'X509SanUri'; clientId: string; jarSigning: SigningConfig; } /** * Represents a pre-registered client ID scheme. */ export class PreRegistered implements ClientIdScheme { clientId: string; jarSigning: SigningConfig; readonly __type: "PreRegistered"; constructor(clientId: string, jarSigning: SigningConfig); } /** * Represents a client ID scheme using X.509 Subject Alternative Name DNS. */ export class X509SanDns implements ClientIdScheme { clientId: string; jarSigning: SigningConfig; readonly __type: "X509SanDns"; constructor(clientId: string, jarSigning: SigningConfig); } /** * Represents a client ID scheme using X.509 Subject Alternative Name URI. */ export class X509SanUri implements ClientIdScheme { clientId: string; jarSigning: SigningConfig; readonly __type: "X509SanUri"; constructor(clientId: string, jarSigning: SigningConfig); } {}; } /** * Type definition for client ID scheme names * @typedef {'pre-registered' | 'x509_san_dns' | 'x509_san_uri'} ClientIdSchemeName */ export declare type ClientIdSchemeName = 'pre-registered' | 'x509_san_dns' | 'x509_san_uri'; declare type ClientIdSchemeName_2 = 'pre-registered' | 'x509_san_dns' | 'x509_san_uri'; /** * Represents the metadata of a client in the authentication process. */ export declare class ClientMetaData { jwkOption: EmbedOption; idTokenSignedResponseAlg: string | undefined; idTokenEncryptedResponseAlg: string | undefined; idTokenEncryptedResponseEnc: string | undefined; subjectSyntaxTypesSupported: string[]; jarmOption: JarmOption; /** * Constructor for the class. * @param {EmbedOption} jwkOption - The JWK (JSON Web Key) option for the request ID. * @param {string|undefined} idTokenSignedResponseAlg - The algorithm used for signing the ID token response. * @param {string|undefined} idTokenEncryptedResponseAlg - The algorithm used for encrypting the ID token response. * @param {string|undefined} idTokenEncryptedResponseEnc - The encryption method used for the ID token response. * @param {string[]} subjectSyntaxTypesSupported - An array of supported subject syntax types. * @param {JarmOption} jarmOption - The JARM (JWT Secured Authorization Response Mode) option. */ constructor(jwkOption: EmbedOption, idTokenSignedResponseAlg: string | undefined, idTokenEncryptedResponseAlg: string | undefined, idTokenEncryptedResponseEnc: string | undefined, subjectSyntaxTypesSupported: string[], jarmOption: JarmOption); } /** * Configuration interface * @interface Configuration */ export declare interface Configuration { /** * Function to get the byte length of the transaction ID * @returns {number} Byte length of the transaction ID */ transactionIdByteLength(): number; /** * Function to get the byte length of the request ID * @returns {number} Byte length of the request ID */ requestIdByteLength(): number; /** * Function to get a function that returns the current date * @returns {() => Date} Function that returns the current date */ now(): () => Date; /** * Function to get the private JWK used for signing the JAR * @returns {string} Private JWK used for signing the JAR */ jarSigningPrivateJwk(): string; /** * Function to get the signing configuration for the JAR * @returns {SigningConfig} Signing configuration for the JAR */ jarSigning(): SigningConfig; /** * Function to get the client ID * @returns {string} Client ID */ clientId(): string; /** * Function to get the client ID scheme name * @returns {ClientIdSchemeName} Client ID scheme name */ clientIdSchemeName(): ClientIdSchemeName; /** * Function to get the client ID scheme * @returns {ClientIdScheme} Client ID scheme */ clientIdScheme(): ClientIdScheme; /** * Function to get the public URL * @returns {string} Public URL */ publicUrl(): string; /** * Function to get the JAR option name * @returns {EmbedOptionName} JAR option name */ jarOptionName(): EmbedOptionName; /** * Function to get the JAR option by reference * @returns {EmbedOption.ByReference} JAR option by reference */ jarByReference(): EmbedOption.ByReference; /** * Function to get the JAR option * @returns {EmbedOption<RequestId>} JAR option */ jarOption(): EmbedOption; /** * Function to get the response mode option name * @returns {ResponseModeOptionName} Response mode option name */ responseModeOptionName(): ResponseModeOptionName; /** * Function to get the response mode option * @returns {ResponseModeOption} Response mode option */ responseModeOption(): ResponseModeOption; /** * Function to get the presentation definition option name * @returns {EmbedOptionName} Presentation definition option name */ presentationDefinitionOptionName(): EmbedOptionName; /** * Function to get the presentation definition option by reference * @returns {EmbedOption.ByReference} Presentation definition option by reference */ presentationDefinitionByReference(): EmbedOption.ByReference; /** * Function to get the presentation definition option * @returns {EmbedOption} Presentation definition option */ presentationDefinitionOption(): EmbedOption; /** * Function to get the maximum age * @returns {Duration} Maximum age */ maxAge(): Duration; /** * Function to get the JWK option * @returns {EmbedOption} JWK option */ jwkOption(): EmbedOption; /** * Function to get the signed response algorithm for the ID token * @returns {string | undefined} Signed response algorithm for the ID token */ idTokenSignedResponseAlg(): string | undefined; /** * Function to get the encrypted response algorithm for the ID token * @returns {string | undefined} Encrypted response algorithm for the ID token */ idTokenEncryptedResponseAlg(): string | undefined; /** * Function to get the encrypted response encryption for the ID token * @returns {string | undefined} Encrypted response encryption for the ID token */ idTokenEncryptedResponseEnc(): string | undefined; /** * Function to get the supported subject syntax types * @returns {string[]} Supported subject syntax types */ subjectSyntaxTypesSupported(): string[]; /** * Function to get the signed response algorithm for the authorization * @returns {string | undefined} Signed response algorithm for the authorization */ authorizationSignedResponseAlg(): string | undefined; /** * Function to get the encrypted response algorithm for the authorization * @returns {string | undefined} Encrypted response algorithm for the authorization */ authorizationEncryptedResponseAlg(): string | undefined; /** * Function to get the encrypted response encryption for the authorization * @returns {string | undefined} Encrypted response encryption for the authorization */ authorizationEncryptedResponseEnc(): string | undefined; /** * Function to get the JARM option * @returns {JarmOption} JARM option */ jarmOption(): JarmOption; /** * Function to get the client metadata * @returns {ClientMetaData} Client metadata */ clientMetaData(): ClientMetaData; /** * Function to get the response URI builder * @returns {UrlBuilder} Response URI builder */ responseUrlBuilder(): UrlBuilder; /** * Function to get the verifier configuration * @returns {VerifierConfig} Verifier configuration */ verifierConfig(): VerifierConfig; /** * initiate transaction path for Verifier Frontend */ initTransactionPath(): string; /** * get wallet response path for Verifier Frontend * @param {string} placeholder - Placeholder for path parameter */ getWalletResponsePath(placeholder: string): string; /** * get public JWK set path for Wallet */ getPublicJWKSetPath(): string; /** * get request object path for Wallet * @param {string} placeholder - Placeholder for path parameter */ requestJWTPath(placeholder: string): string; /** * get presentation definition path for Wallet * @param {string} placeholder - Placeholder for path parameter */ presentationDefinitionPath(placeholder: string): string; /** * get jarm JWK set path for Wallet * @param {string} placeholder - Placeholder for path parameter */ jarmJWKSetPath(placeholder: string): string; /** * post wallet response path for Wallet */ walletResponsePath(): string; /** * frontend cors origin */ frontendCorsOrigin(): string | string[]; } /** * Creates a function to generate a query wallet response redirect URI invoker * @returns {CreateQueryWalletResponseRedirectUri} A function that creates a wallet response redirect URI */ export declare const createCreateQueryWalletResponseRedirectUriInvoker: () => CreateQueryWalletResponseRedirectUri; /** * Creates a DurationFactory that uses DurationLuxon.Factory to create Duration objects. * * @returns A DurationFactory object with methods to create Duration instances. * * @example * const durationFactory = createDurationFactoryLuxon(); * const duration = durationFactory.ofDays(2); */ export declare const createDurationFactoryLuxon: () => DurationFactory; export declare const createGenerateEphemeralECDHPrivateJwkJoseInvoker: () => GenerateEphemeralECDHPrivateJwk; /** * Creates a function that generates a request ID using the GenerateRequestIdJose class. * * @param byteLength The byte length of the generated request ID. * @returns A function that generates a request ID. * @throws {Error} If the byte length is less than 32. * * @example * const generateRequestId = createGenerateRequestIdHoseInvoker(32); * const requestId = await generateRequestId(); */ export declare const createGenerateRequestIdHoseInvoker: (byteLength?: number) => GenerateRequestId; /** * Creates a function to generate a response code * @returns {GenerateResponseCode} A function that generates a response code */ export declare const createGenerateResponseCodeInvoker: () => GenerateResponseCode; /** * Creates a function that generates a transaction ID. * * @param byteLength The byte length of the generated transaction ID. * @returns A function that generates a transaction ID. * @throws {Error} If the byte length is less than 32. * * @example * const generateTransactionId = createGenerateTransactionIdInvoker(32); * const transactionId = await generateTransactionId(); */ export declare const createGenerateTransactionIdJoseInvoker: (byteLength?: number) => GenerateTransactionId; export declare const createGetRequestObjectServiceInvoker: ({ loadPresentationByRequestId, storePresentation, signRequestObject, verifierConfig, now, }: GetRequestObjectServiceCreateParams) => GetRequestObject; export declare const createGetWalletResponseServiceInvoker: ({ loadPresentationById, now, maxAge, }: GetWalletResponseCreateParams) => GetWalletResponse; /** * Creates a function that initiates a transaction based on the provided parameters. * @param {Object} params - The parameters for creating the InitTransaction function. * @param {GenerateTransactionId} params.generateTransactionId - Function to generate a transaction ID. * @param {GenerateRequestId} params.generateRequestId - Function to generate a request ID. * @param {StorePresentation} params.storePresentation - Function to store a presentation. * @param {SignRequestObject} params.signRequestObject - Function to sign a request object. * @param {VerifierConfig} params.verifierConfig - The verifier configuration. * @param {Now} params.now - Function to get the current date and time. * @param {GenerateEphemeralECDHPrivateJwk} params.generateEphemeralECDHPrivateJwk - Function to generate an ephemeral ECDH private JWK. * @param {EmbedOption.ByReference<RequestId>} params.jarByReference - Option to embed JAR by reference. * @param {EmbedOption.ByReference<RequestId>} params.presentationDefinitionByReference - Option to embed presentation definition by reference. * @param {CreateQueryWalletResponseRedirectUri} params.createQueryWalletResponseRedirectUri - Function to create a query wallet response redirect URI. * @returns {InitTransaction} A function that initiates a transaction based on the provided InitTransactionTO. */ export declare const createInitTransactionServiceInvoker: ({ generateTransactionId, generateRequestId, storePresentation, signRequestObject, verifierConfig, now, jarByReference, presentationDefinitionByReference, createQueryWalletResponseRedirectUri, }: CreateParams) => InitTransaction; export declare const createLoadPresentationByIdInMemoryInvoker: () => LoadPresentationById; export declare const createLoadPresentationByRequestIdInMemoryInvoker: () => LoadPresentationByRequestId; declare type CreateParams = { generateTransactionId: GenerateTransactionId; generateRequestId: GenerateRequestId; storePresentation: StorePresentation; signRequestObject: SignRequestObject; verifierConfig: VerifierConfig; now: () => Date; generateEphemeralECDHPrivateJwk: GenerateEphemeralECDHPrivateJwk; jarByReference: EmbedOption.ByReference; presentationDefinitionByReference: EmbedOption.ByReference; createQueryWalletResponseRedirectUri: CreateQueryWalletResponseRedirectUri; }; declare type CreateParams_2 = { loadPresentationByRequestId: LoadPresentationByRequestId; storePresentation: StorePresentation; verifyJarmJwt: VerifyJarmJwt; now: () => Date; verifierConfig: VerifierConfig; generateResponseCode: GenerateResponseCode; createQueryWalletResponseRedirectUri: CreateQueryWalletResponseRedirectUri; }; export declare const createPostWalletResponseServiceInvoker: ({ loadPresentationByRequestId, storePresentation, now, generateResponseCode, createQueryWalletResponseRedirectUri, }: CreateParams_2) => PostWalletResponse; export declare interface CreateQueryWalletResponseRedirectUri { (template: string, responseCode: ResponseCode): Result<URL>; } /** * Creates a SignRequestObject function using the Jose library. * @returns {SignRequestObject} A function that signs request objects. */ export declare const createSignRequestObjectJoseInvoker: () => SignRequestObject; export declare const createStorePresentationInMemoryInvoker: () => StorePresentation; export declare const createVerifyJarmJwtJoseInvoker: () => VerifyJarmJwt; /** * JSON representation of the DirectPost data. * @typedef {Object} DirectPostJSON@typedef {Object} DirectPostJSON * @property {Object} response - The response object. */ export declare type DirectPostJSON = z.infer<typeof directPostSchema>; /** * JSON representation of the DirectPostJwt data. * @typedef {Object} DirectPostJwtJSON@typedef {Object} DirectPostJwtJSON * @property {string} state - The state parameter. * @property {string} response - The response parameter. */ export declare type DirectPostJwtJSON = z.infer<typeof directPostJwtSchema>; /** * Schema for the DirectPostJwt data. * @typedef {Object} DirectPostJwtSchema * @property {string} state - The state parameter. * @property {string} response - The response parameter. */ export declare const directPostJwtSchema: z.ZodObject<{ state: z.ZodString; response: z.ZodString; }, "strip", z.ZodTypeAny, { response: string; state: string; }, { response: string; state: string; }>; /** * Schema for the DirectPost data. * @typedef {Object} DirectPostSchema * @property {Object} response - The response object. * * TODO - confirm this schema is correct */ export declare const directPostSchema: z.ZodObject<{ response: z.ZodObject<{ state: z.ZodOptional<z.ZodString>; id_token: z.ZodOptional<z.ZodString>; vp_token: z.ZodOptional<z.ZodString>; presentation_submission: z.ZodOptional<z.ZodObject<{ id: z.ZodString; definition_id: z.ZodString; descriptor_map: z.ZodArray<z.ZodType<DescriptorMapJSON, z.ZodTypeDef, DescriptorMapJSON>, "many">; }, "strip", z.ZodTypeAny, { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; }, { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; }>>; error: z.ZodOptional<z.ZodString>; error_description: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }, { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }>; }, "strip", z.ZodTypeAny, { response: { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }; }, { response: { state?: string | undefined; id_token?: string | undefined; vp_token?: string | undefined; presentation_submission?: { id: string; definition_id: string; descriptor_map: DescriptorMapJSON[]; } | undefined; error?: string | undefined; error_description?: string | undefined; }; }>; /** * Represents a duration of time. * This interface provides methods for creating, manipulating, and querying time-based amounts of time. */ export declare interface Duration { /** * The number of whole seconds in this duration. */ readonly seconds: number; /** * The number of milliseconds in this duration, excluding whole seconds. */ readonly millis: number; /** * Checks if this duration is zero length. * @returns true if this duration has a total length of zero, false otherwise. */ isZero(): boolean; /** * Checks if this duration is negative. * @returns true if this duration has a total length less than zero, false otherwise. */ isNegative(): boolean; /** * Returns a copy of this duration with the specified duration added. * @param other - The duration to add. * @returns A new Duration instance with the addition applied. */ plus(other: Duration): Duration; /** * Returns a copy of this duration with the specified duration subtracted. * @param other - The duration to subtract. * @returns A new Duration instance with the subtraction applied. */ minus(other: Duration): Duration; /** * Returns a copy of this duration multiplied by the scalar. * @param multiplicand - The scalar to multiply by. * @returns A new Duration instance with the multiplication applied. */ multipliedBy(multiplicand: number): Duration; /** * Returns a copy of this duration divided by the scalar. * @param divisor - The scalar to divide by. * @returns A new Duration instance with the division applied. */ dividedBy(divisor: number): Duration; /** * Returns a copy of this duration with the length negated. * @returns A new Duration instance with the negation applied. */ negated(): Duration; /** * Returns a copy of this duration with a positive length. * @returns A new Duration instance with the absolute value of the length. */ abs(): Duration; /** * Converts this duration to the total length in milliseconds. * @returns The total length of the duration in milliseconds. */ toMillis(): number; /** * Returns a string representation of this duration. * The format of the returned string may vary depending on the implementation. * @returns A string representation of this duration. */ toString(): string; } /** * Interface for creating Duration objects */ export declare interface DurationFactory { /** * Creates a Duration object representing a number of days * @param days - The number of days * @returns A Duration object */ ofDays(days: number): Duration; /** * Creates a Duration object representing a number of hours * @param hours - The number of hours * @returns A Duration object */ ofHours(hours: number): Duration; /** * Creates a Duration object representing a number of minutes * @param minutes - The number of minutes * @returns A Duration object */ ofMinutes(minutes: number): Duration; /** * Creates a Duration object representing a number of seconds, with an optional millisecond adjustment * @param seconds - The number of seconds * @param millisAdjustment - Optional millisecond adjustment * @returns A Duration object */ ofSeconds(seconds: number, millisAdjustment?: number): Duration; /** * Creates a Duration object representing a number of milliseconds * @param millis - The number of milliseconds * @returns A Duration object */ ofMillis(millis: number): Duration; /** * Parses a string representation of a duration into a Duration object * @param text - The string representation of the duration * @returns A Duration object */ parse(text: string): Duration; } /** * Implements the Duration interface using the Luxon library. * This class provides a concrete implementation of Duration using Luxon's Duration class. */ export declare class DurationLuxon implements Duration { private duration; /** * Creates a DurationLuxon instance. * @param seconds - The number of seconds in the duration. * @param millis - The number of milliseconds in the duration, in addition to the seconds. */ constructor(seconds?: number, millis?: number); /** * Factory for creating Duration instances. * This factory provides static methods to create Duration objects * from various time units or by parsing ISO 8601 duration strings. */ static readonly Factory: DurationFactory; /** * Retrieves the number of whole seconds from a Luxon Duration. * * This static method calculates the total number of whole seconds * represented by the given Luxon Duration object. It floors the result * to ensure only complete seconds are counted. * * @param duration - The Luxon Duration object to extract seconds from. * @returns The number of whole seconds in the duration. * * @example * const luxonDuration = Duration.fromObject({ seconds: 65.5 }); * const seconds = DurationLuxon.getSeconds(luxonDuration); * console.log(seconds); // Outputs: 65 */ static getSeconds(duration: Duration_2): number; /** * Gets the number of whole seconds in this duration. * @returns The number of whole seconds. */ get seconds(): number; /** * Gets the number of milliseconds in this duration, excluding whole seconds. * @returns The number of milliseconds, excluding whole seconds. */ get millis(): number; /** * Checks if this duration is zero length. * @returns true if this duration has a total length of zero, false otherwise. */ isZero(): boolean; /** * Checks if this duration is negative. * @returns true if this duration has a total length less than zero, false otherwise. */ isNegative(): boolean; /** * Returns a copy of this duration with the specified duration added. * @param other - The duration to add. * @returns A new Duration instance with the addition applied. */ plus(other: Duration): Duration; /** * Returns a copy of this duration with the specified duration subtracted. * @param other - The duration to subtract. * @returns A new Duration instance with the subtraction applied. */ minus(other: Duration): Duration; /** * Returns a copy of this duration multiplied by the scalar. * @param multiplicand - The scalar to multiply by. * @returns A new Duration instance with the multiplication applied. */ multipliedBy(multiplicand: number): Duration; /** * Returns a copy of this duration divided by the scalar. * @param divisor - The scalar to divide by. * @returns A new Duration instance with the division applied. */ dividedBy(divisor: number): Duration; /** * Returns a copy of this duration with the length negated. * @returns A new Duration instance with the negation applied. */ negated(): Duration; /** * Returns a copy of this duration with a positive length. * @returns A new Duration instance with the absolute value of the length. */ abs(): Duration; /** * Converts this duration to the total length in milliseconds. * @returns The total length of the duration in milliseconds. */ toMillis(): number; /** * Returns an ISO 8601 representation of this duration. * @returns An ISO 8601 representation of this duration. */ toString(): string; } /** * Enumeration of embed modes for the transaction. * @enum {string} */ export declare enum EmbedModeTO { ByValue = "by_value", ByReference = "by_reference" } export declare type EmbedOption = EmbedOption.ByValue | EmbedOption.ByReference; export declare namespace EmbedOption { const fromJSON: FromJSON<EmbedOptionJSON, EmbedOption>; export interface Base { readonly __type: 'ByValue' | 'ByReference'; toJSON(): EmbedOptionJSON; } export class ByValue implements Base { static readonly INSTANCE: ByValue; readonly __type: "ByValue"; private constructor(); toJSON(): { __type: "ByValue"; }; } export class ByReference implements Base { urlBuilder: UrlBuilder; readonly __type: "ByReference"; constructor(urlBuilder: UrlBuilder); toJSON(): { __type: "ByReference"; url_builder: { __type: "WithRequestId"; base_url: string; } | { __type: "WithRequestIdTemplate"; template: string; } | { __type: "Fix"; url: string; }; }; } {}; } export declare type EmbedOptionJSON = z.infer<typeof embedOptionSchema>; /** * Type definition for embed option names * @typedef {'by_value' | 'by_reference'} EmbedOptionName */ export declare type EmbedOptionName = 'by_value' | 'by_reference'; export declare const embedOptionSchema: z.ZodDiscriminatedUnion<"__type", [z.ZodObject<{ __type: z.ZodLiteral<"ByValue">; }, "strip", z.ZodTypeAny, { __type: "ByValue"; }, { __type: "ByValue"; }>, z.ZodObject<{ __type: z.ZodLiteral<"ByReference">; url_builder: z.ZodDiscriminatedUnion<"__type", [z.ZodObject<{ __type: z.ZodLiteral<"WithRequestId">; base_url: z.ZodString; }, "strip", z.ZodTypeAny, { __type: "WithRequestId"; base_url: string; }, { __type: "WithRequestId"; base_url: string; }>, z.ZodObject<{ __type: z.ZodLiteral<"WithRequestIdTemplate">; template: z.ZodString; }, "strip", z.ZodTypeAny, { __type: "WithRequestIdTemplate"; template: string; }, { __type: "WithRequestIdTemplate"; template: string; }>, z.ZodObject<{ __type: z.ZodLiteral<"Fix">; url: z.ZodString; }, "strip", z.ZodTypeAny, { __type: "Fix"; url: string; }, { __type: "Fix"; url: string; }>]>; }, "strip", z.ZodTypeAny, { __type: "ByReference"; url_builder: { __type: "WithRequestId"; base_url: string; } | { __type: "WithRequestIdTemplate"; template: string; } | { __type: "Fix"; url: string; }; }, { __type: "ByReference"; url_builder: { __type: "WithRequestId"; base_url: string; } | { __type: "WithRequestIdTemplate"; template: string; } | { __type: "Fix"; url: string; }; }>]>; /** * Represents an ephemeral ECDH private key in JWK format. * * This class encapsulates a JWK string representing an ephemeral ECDH private key. * It provides methods for JSON serialization. */ export declare class EphemeralECDHPrivateJwk { value: string; /** * Creates a new instance of EphemeralECDHPrivateJwk. * * @param {string} value - The JWK string representing the ephemeral ECDH private key. */ constructor(value: string); /** * Returns the JWK string for JSON serialization. * * This method is used by JSON.stringify() to serialize the object. * * @returns {string} The JWK string. */ toJSON(): string; } /** * Zod schema for validating an ephemeral ECDH private key in JWK format as a JSON string. * * This schema applies the following validations: * 1. The input must be a string. * 2. The string must be a valid JSON. * 3. The parsed JSON object must conform to the jwkSchema structure. * * @type {z.ZodEffects<z.ZodString>} * * @example * // Valid usage * const validJwk = '{"kty":"EC","crv":"P-256","x":"example-x","y":"example-y","d":"example-d"}'; * ephemeralECDHPrivateJwkSchema.parse(validJwk); // Returns the validJwk string * * // Invalid usage (will throw ZodError) * ephemeralECDHPrivateJwkSchema.parse('{"kty":"EC"}'); // Missing required properties * ephemeralECDHPrivateJwkSchema.parse('not a json'); // Not a valid JSON string * * @throws {z.ZodError} Throws a ZodError if the input fails validation */ export declare const ephemeralECDHPrivateJwkSchema: z.ZodEffects<z.ZodString, string, string>; /** * Represents an ephemeral ECDH public key in JWK format. * * This class encapsulates a JWK string representing an ephemeral ECDH public key. * It provides methods for JSON serialization. */ export declare class EphemeralECDHPublicJwk { value: string; /** * Creates a new instance of EphemeralECDHPublicJwk. * * @param {string} value - The JWK string representing the ephemeral ECDH public key. */ constructor(value: string); /** * Returns the JWK string for JSON serialization. * * This method is used by JSON.stringify() to serialize the object. * * @returns {string} The JWK string. */ toJSON(): string; } /** * Zod schema for validating an ephemeral ECDH public key in JWK format as a JSON string. * * This schema applies the following validations: * 1. The input must be a string. * 2. The string must be a valid JSON. * 3. The parsed JSON object must conform to the jwkSchema structure. * * @type {z.ZodEffects<z.ZodString>} * * @example * // Valid usage * const validJwk = '{"kty":"EC","crv":"P-256","x":"example-x","y":"example-y"}'; * ephemeralECDHPublicJwkSchema.parse(validJwk); // Returns the validJwk string * * // Invalid usage (will throw ZodError) * ephemeralECDHPublicJwkSchema.parse('{"kty":"EC"