@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
1 lines • 5.03 kB
Source Map (JSON)
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { GetTrustedIssuersForVerification, VerificationSigner } from './agent/TrustedIssuersForVerification'\nimport type { Logger } from './logger'\nimport { Ed25519PublicJwk, PublicJwk } from './modules/kms'\n\nexport interface InitConfig {\n logger?: Logger\n autoUpdateStorageOnStartup?: boolean\n\n /**\n * Allow insecure http urls in places where this is usually required.\n * Unsecure http urls may still be allowed in places where this is not checked (e.g. didcomm)\n *\n * For some flows this config option is set globally, which means that different agent configurations\n * will fight for the configuration. It is meant as a local development option.\n *\n * Use with caution\n *\n * @default false\n */\n allowInsecureHttpUrls?: boolean\n\n /**\n * The allowed skew in seconds that should be allowed for validity time of a credentials and other signed\n * objects (e.g. StatusList). Mobile devices especially can run a bit behind actual time, making validity\n * checks fail based on a milliseconds / seconds.\n *\n * NOTE: this does currently only affects JWT based objects and credentials:\n * - Token Status List\n * - SD-JWT VC\n * - W3C VCDM 1.1 and 2.0 with JWT/SD-JWT\n *\n * It does not cover\n * - W3C VCDM 1.1 JSON-LD\n * - mDOC\n *\n * @default 30\n */\n validitySkewSeconds?: number\n\n /**\n * Optional callback to dynamically resolve trusted issuers for a verification context.\n *\n * This is the primary trust anchor resolution hook. It is called before the X.509-module-level\n * `getTrustedCertificatesForVerification` callback and before the global `trustedCertificates` list.\n *\n * Return `{ trustedIssuers: [] }` to hard-reject (trust nothing, skip remaining fallbacks).\n * Return `undefined` to fall through to the next resolution layer.\n *\n * Extension packages (e.g. `@credo-ts/openid4vc`) export additional verification types that can\n * be composed into the `AdditionalVerificationTypes` generic parameter to get full type coverage\n * on `verification`, e.g.:\n *\n * ```ts\n * getTrustedIssuersForVerification: async (\n * agentContext,\n * context: TrustedIssuersForVerificationContext<VerificationSigner, OpenId4VcVerificationTypes>\n * ) => { ... }\n * ```\n */\n // biome-ignore lint/suspicious/noExplicitAny: the additional verification types are open for extension by other packages\n getTrustedIssuersForVerification?: GetTrustedIssuersForVerification<VerificationSigner, any>\n}\n\nexport type JsonValue = string | number | boolean | null | JsonObject | JsonArray\nexport type JsonArray = Array<JsonValue>\nexport interface JsonObject {\n [property: string]: JsonValue\n}\n\n/**\n * Flatten an array of arrays\n * @example\n * ```\n * type Flattened = FlatArray<[[1], [2]]>\n *\n * // is the same as\n * type Flattened = 1 | 2\n * ```\n */\nexport type FlatArray<Arr> = Arr extends ReadonlyArray<infer InnerArr> ? FlatArray<InnerArr> : Arr\n\n/**\n * Create an exclusive or, setting the other params to 'never' which helps with\n * type narrowing\n *\n * @example\n * ```\n * type Options = XOR<{ name: string }, { dateOfBirth: Date }>\n *\n * type Options =\n * | { name: string; dateOfBirth?: never }\n * | { name?: never; dateOfBirth: Date }\n * ```\n */\nexport type XOR<T, U> =\n | (T & { [P in keyof Omit<U, keyof T>]?: never })\n | (U & { [P in keyof Omit<T, keyof U>]?: never })\n\n/**\n * Get the awaited (resolved promise) type of Promise type.\n */\nexport type Awaited<T> = T extends Promise<infer U> ? U : never\n\n/**\n * Type util that returns `true` or `false` based on whether the input type `T` is of type `any`\n */\nexport type IsAny<T> = unknown extends T ? ([keyof T] extends [never] ? false : true) : false\n\nexport interface ResolvedDidCommService {\n id: string\n serviceEndpoint: string\n recipientKeys: PublicJwk<Ed25519PublicJwk>[]\n routingKeys: PublicJwk<Ed25519PublicJwk>[]\n}\n\nexport const isJsonObject = (value: unknown): value is JsonObject => {\n return value !== undefined && typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport type SingleOrArray<T> = T | T[]\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\nexport type CanBePromise<T> = T | Promise<T>\n\nexport type NonEmptyArray<T> = [T, ...T[]]\nexport function mapNonEmptyArray<U, M extends (item: U, index: number) => unknown>(\n array: NonEmptyArray<U>,\n mapFunction: M\n): NonEmptyArray<ReturnType<M>> {\n return array.map(mapFunction) as NonEmptyArray<ReturnType<M>>\n}\nexport function isNonEmptyArray<U>(array: U[]): array is NonEmptyArray<U> {\n return array.length > 0\n}\n"],"mappings":";;AAmHA,MAAa,gBAAgB,UAAwC;CACnE,OAAO,UAAU,KAAA,KAAa,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AACnG;AAOA,SAAgB,iBACd,OACA,aAC8B;CAC9B,OAAO,MAAM,IAAI,WAAW;AAC9B;AACA,SAAgB,gBAAmB,OAAuC;CACxE,OAAO,MAAM,SAAS;AACxB"}