import { OpenId4VciMetadata } from "../shared/models/index.mjs"; import "../shared/index.mjs"; import { OpenId4VpAcceptAuthorizationRequestOptions, OpenId4VpResolvedAuthorizationRequest, ResolveOpenId4VpAuthorizationRequestOptions } from "./OpenId4vpHolderServiceOptions.mjs"; import { OpenId4VcParseAndVerifyAuthorizationResponseOptions, OpenId4VciAuthCodeFlowOptions, OpenId4VciCredentialRequestOptions, OpenId4VciCredentialResponse, OpenId4VciDeferredCredentialRequestOptions, OpenId4VciDeferredCredentialResponse, OpenId4VciDpopRequestOptions, OpenId4VciRequestTokenResponse, OpenId4VciResolvedAuthorizationRequest, OpenId4VciResolvedCredentialOffer, OpenId4VciRetrieveAuthorizationCodeUsingPresentationOptions, OpenId4VciSendNotificationOptions, OpenId4VciTokenRefreshOptions, OpenId4VciTokenRequestOptions } from "./OpenId4VciHolderServiceOptions.mjs"; import { OpenId4VciHolderService } from "./OpenId4VciHolderService.mjs"; import { OpenId4VpHolderService } from "./OpenId4vpHolderService.mjs"; import * as _credo_ts_core0 from "@credo-ts/core"; import { AgentContext, DcqlQueryResult, DcqlSelectCredentialsForRequestOptions, DcqlService, DifPexCredentialsForRequest, DifPresentationExchangeService } from "@credo-ts/core"; //#region src/openid4vc-holder/OpenId4VcHolderApi.d.ts /** * @public */ declare class OpenId4VcHolderApi { private agentContext; private openId4VciHolderService; private openId4VpHolderService; private difPresentationExchangeService; private dcqlService; constructor(agentContext: AgentContext, openId4VciHolderService: OpenId4VciHolderService, openId4VpHolderService: OpenId4VpHolderService, difPresentationExchangeService: DifPresentationExchangeService, dcqlService: DcqlService); /** * Resolves the authentication request given as URI or JWT to a unified format, and * verifies the validity of the request. * * The resolved request can be accepted with the @see acceptOpenId4VpAuthorizationRequest. * * If the authorization request uses OpenID4VP and included presentation definitions, * a `presentationExchange` property will be defined with credentials that satisfy the * incoming request. When `presentationExchange` is present, you MUST supply `presentationExchange` * when calling `acceptOpenId4VpAuthorizationRequest` as well. * * @param request * Can be: * - JWT * - URI containing request or request_uri param * - Request payload * @returns the resolved and verified authentication request. */ resolveOpenId4VpAuthorizationRequest(request: string | Record, options?: ResolveOpenId4VpAuthorizationRequestOptions): Promise; /** * Accepts the authentication request after it has been resolved and verified with {@link resolveOpenId4VpAuthorizationRequest}. * * If the resolved authorization request included a `presentationExchange` property, you MUST supply `presentationExchange` * in the `options` parameter. The same is true for `dcql`. * * For response mode of `direct_post` or `direct_post.jwt` the response will be submitted directly * to the response url. For `dc_api` and `dc_api.jwt` the response will be returned but without a * `serverResponse`, and you have to submit the response yourself. */ acceptOpenId4VpAuthorizationRequest(options: OpenId4VpAcceptAuthorizationRequestOptions): Promise<{ readonly ok: true; readonly authorizationResponse: ({ [x: string]: unknown; vp_token: string | Record | [string | Record, ...(string | Record)[]] | Record | [string | Record, ...(string | Record)[]]>; state?: string | undefined; id_token?: string | undefined; presentation_submission?: any; refresh_token?: string | undefined; token_type?: string | undefined; access_token?: string | undefined; expires_in?: number | undefined; } & { presentation_submission?: _credo_ts_core0.DifPresentationExchangeSubmission; }) | { response: string; }; readonly authorizationResponsePayload: { [x: string]: unknown; vp_token: string | Record | [string | Record, ...(string | Record)[]] | Record | [string | Record, ...(string | Record)[]]>; state?: string | undefined; id_token?: string | undefined; presentation_submission?: any; refresh_token?: string | undefined; token_type?: string | undefined; access_token?: string | undefined; expires_in?: number | undefined; } & { presentation_submission?: _credo_ts_core0.DifPresentationExchangeSubmission; }; readonly serverResponse?: undefined; readonly redirectUri?: undefined; readonly presentationDuringIssuanceSession?: undefined; } | { readonly ok: false; readonly serverResponse: { readonly status: number; readonly body: string | Record | null; }; readonly authorizationResponse: ({ [x: string]: unknown; vp_token: string | Record | [string | Record, ...(string | Record)[]] | Record | [string | Record, ...(string | Record)[]]>; state?: string | undefined; id_token?: string | undefined; presentation_submission?: any; refresh_token?: string | undefined; token_type?: string | undefined; access_token?: string | undefined; expires_in?: number | undefined; } & { presentation_submission?: _credo_ts_core0.DifPresentationExchangeSubmission; }) | { response: string; }; readonly authorizationResponsePayload: { [x: string]: unknown; vp_token: string | Record | [string | Record, ...(string | Record)[]] | Record | [string | Record, ...(string | Record)[]]>; state?: string | undefined; id_token?: string | undefined; presentation_submission?: any; refresh_token?: string | undefined; token_type?: string | undefined; access_token?: string | undefined; expires_in?: number | undefined; } & { presentation_submission?: _credo_ts_core0.DifPresentationExchangeSubmission; }; readonly redirectUri?: undefined; readonly presentationDuringIssuanceSession?: undefined; } | { readonly ok: true; readonly serverResponse: { readonly status: number; readonly body: Record; }; readonly authorizationResponse: ({ [x: string]: unknown; vp_token: string | Record | [string | Record, ...(string | Record)[]] | Record | [string | Record, ...(string | Record)[]]>; state?: string | undefined; id_token?: string | undefined; presentation_submission?: any; refresh_token?: string | undefined; token_type?: string | undefined; access_token?: string | undefined; expires_in?: number | undefined; } & { presentation_submission?: _credo_ts_core0.DifPresentationExchangeSubmission; }) | { response: string; }; readonly authorizationResponsePayload: { [x: string]: unknown; vp_token: string | Record | [string | Record, ...(string | Record)[]] | Record | [string | Record, ...(string | Record)[]]>; state?: string | undefined; id_token?: string | undefined; presentation_submission?: any; refresh_token?: string | undefined; token_type?: string | undefined; access_token?: string | undefined; expires_in?: number | undefined; } & { presentation_submission?: _credo_ts_core0.DifPresentationExchangeSubmission; }; readonly redirectUri: string | undefined; readonly presentationDuringIssuanceSession: string | undefined; }>; /** * Automatically select credentials from available credentials for a presentation exchange request. Can be called after calling * @see resolveOpenId4VpAuthorizationRequest. */ selectCredentialsForPresentationExchangeRequest(credentialsForRequest: DifPexCredentialsForRequest): _credo_ts_core0.DifPexInputDescriptorToCredentials; /** * Automatically select credentials from available credentials for a dcql request. Can be called after calling * @see resolveOpenId4VpAuthorizationRequest. */ selectCredentialsForDcqlRequest(dcqlQueryResult: DcqlQueryResult, options?: DcqlSelectCredentialsForRequestOptions): _credo_ts_core0.DcqlCredentialsForRequest; resolveIssuerMetadata(credentialIssuer: string): Promise; /** * Resolves a credential offer given as credential offer URL, or issuance initiation URL, * into a unified format with metadata. * * @param credentialOffer the credential offer to resolve * @returns The uniform credential offer payload, the issuer metadata, protocol version, and the offered credentials with metadata. */ resolveCredentialOffer(credentialOffer: string): Promise; /** * This function is to be used to receive an credential in OpenID4VCI using the Authorization Code Flow. * * Not to be confused with the {@link resolveOpenId4VpAuthorizationRequest}, which is only used for OpenID4VP requests. * * It will generate an authorization session based on the provided options. * * There are two possible flows: * - Oauth2Redirect: an authorization request URI is returend which can be used to obtain the authorization code. * This needs to be done manually (e.g. by opening a browser window) * - PresentationDuringIssuance: an openid4vp presentation request needs to be handled. A oid4vpRequestUri is returned * which can be parsed using `resolveOpenId4VpAuthorizationRequest`. After the presentation session has been completed, * the resulting `presentationDuringIssuanceSession` can be used to obtain an authorization code * * Authorization to request credentials can only be requested through scopes. * * @param resolvedCredentialOffer Obtained through @see resolveCredentialOffer * @param authCodeFlowOptions * @returns The authorization request URI alongside the code verifier and original @param authCodeFlowOptions */ resolveOpenId4VciAuthorizationRequest(resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer, authCodeFlowOptions: OpenId4VciAuthCodeFlowOptions): Promise; /** * Retrieve an authorization code using an `presentationDuringIssuanceSession`. * * The authorization code can be exchanged for an `accessToken` @see requestToken */ retrieveAuthorizationCodeUsingPresentation(options: OpenId4VciRetrieveAuthorizationCodeUsingPresentationOptions): Promise<{ authorizationCode: string; dpop?: OpenId4VciDpopRequestOptions; }>; parseAuthorizationCodeFromAuthorizationResponse(options: OpenId4VcParseAndVerifyAuthorizationResponseOptions): { authorizationCode: string; }; /** * Requests the token to be used for credential requests. */ requestToken(options: OpenId4VciTokenRequestOptions): Promise; /** * Requests the token to be used for credential requests. */ refreshToken(options: OpenId4VciTokenRefreshOptions): Promise>; /** * Request a set of credentials from the credential issuer. * Can be used with both the pre-authorized code flow and the authorization code flow. */ requestCredentials(options: OpenId4VciCredentialRequestOptions): Promise<{ credentials: OpenId4VciCredentialResponse[]; deferredCredentials: OpenId4VciDeferredCredentialResponse[]; dpop?: OpenId4VciDpopRequestOptions; cNonce?: string; }>; /** * Request a set of deferred credentials from the credential issuer. */ requestDeferredCredentials(options: OpenId4VciDeferredCredentialRequestOptions): Promise<{ credentials: OpenId4VciCredentialResponse[]; deferredCredentials: OpenId4VciDeferredCredentialResponse[]; dpop?: OpenId4VciDpopRequestOptions; }>; /** * Send a notification event to the credential issuer */ sendNotification(options: OpenId4VciSendNotificationOptions): Promise; } //#endregion export { OpenId4VcHolderApi }; //# sourceMappingURL=OpenId4VcHolderApi.d.mts.map