import type { JWK } from "jose"; /** * Types from Ledger API v3 */ export interface BesuTransactionReceipt { revertReason: string; status: string; } export type CachedCredentialOffer = CredentialOfferPayload; export interface CachedNonce { nonce: string; } export interface CachedVcJwt { format: "jwt_vc" | "jwt_vc_json"; notBefore?: number; vcJwt: string; } /** * OpenID Provider (OP) Metadata * * Specs: * - https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-11.html#section-10.2.3 */ export interface CredentialIssuerMetadata { /** * Identifier of the OAuth 2.0 Authorization Server (as defined in [RFC8414]) the * Credential Issuer relies on for authorization. If this element is omitted, the entity * providing the Credential Issuer is also acting as the AS, i.e. the Credential Issuer's * identifier is used as the OAuth 2.0 Issuer value to obtain the Authorization Server metadata * as per [RFC8414]. */ authorization_server?: string; /** * URL of the Credential Issuer's Credential Endpoint. This URL MUST use the https scheme and MAY * contain port, path and query parameter components. */ credential_endpoint: string; /** * The Credential Issuer's identifier. */ credential_issuer: string; /** * A JSON array containing a list of JSON objects, each of them representing metadata about a * separate credential type that the Credential Issuer can issue. The JSON objects in the array * MUST conform to the structure of the Section 10.2.3.1. * * @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-11.html#section-10.2.3.1 */ credentials_supported: { /** * An array of objects, where each object contains display properties of a certain claim in the * Credential for a certain language. */ display: { /** * String value that identifies language of this object represented as language tag values * defined in BCP47 [RFC5646]. There MUST be only one object with the same language * identifier. */ locale: string; /** * String value of a display name for the claim. */ name: string; }[]; /** * A JSON string identifying the format of this credential, e.g. `jwt_vc_json` or `ldp_vc`. * Depending on the format value, the object contains further elements defining the type and * (optionally) particular claims the credential MAY contain, and information how to display * the credential. Appendix E defines Credential Format Profiles introduced by this * specification. * * @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-11.html#section-e.1 * * WARNING: https://github.com/Sphereon-Opensource/PEX did not support `jwt_vc_json` in the past. * For this reason, we use `jwt_vc` (legacy) and `jwt_vc_json`. */ format: "jwt_vc" | "jwt_vc_json"; /** * A JSON array of JSON objects with information about the supported trust frameworks. * The 'name' property must uniquely define the trust framework. */ trust_framework?: { /** * Unique Trust Framework name. MUST be 'ebsi'. */ name: "ebsi"; /** * */ type: string; uri: string; }; /** * JSON array designating the types a certain credential type supports according to [VC_DATA], * Section 4.3. */ types: string[]; }[]; /** * URL of the Credential Issuer's Deferred Credential Endpoint. This URL MUST use the https * scheme and MAY contain port, path and query parameter components. */ deferred_credential_endpoint: string; } export interface CredentialOfferPayload { credential_issuer: string; credentials: { format: "jwt_vc" | "jwt_vc_json"; trust_framework: { name: string; type: string; uri: string; }; types: string[]; }[]; grants: { authorization_code?: { issuer_state?: string; }; "urn:ietf:params:oauth:grant-type:pre-authorized_code"?: { "pre-authorized_code": string; user_pin_required: boolean; }; }; } export interface CredentialResponse { credential: string; format: "jwt_vc" | "jwt_vc_json"; } export interface DeferredCredentialResponse { acceptance_token: string; } export type JWKWithKid = JWK & { kid: string }; export interface LevelDbKeyIssuer { credentialOfferId?: string; did: string; nonceAccessToken?: string; } export type LevelDbObjectIssuer = | CachedCredentialOffer | CachedNonce | CachedVcJwt; export interface Logger { error: (message: unknown, description?: string) => void; } export interface UnsignedTransaction { chainId: string; data: string; from: string; gasLimit: string; gasPrice: string; nonce: string; to: string; value: string; }