UNPKG

@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

79 lines • 3.17 kB
import { BaseRecord, Tags } from "../../../storage/BaseRecord.mjs"; import { NonEmptyArray } from "../../../types.mjs"; import { CredentialMultiInstanceState } from "../../../utils/credentialUseTypes.mjs"; import { W3cJsonCredential } from "../models/credential/W3cJsonCredential.mjs"; import { W3cVerifiableCredential } from "../models/credential/W3cVerifiableCredential.mjs"; import "../models/index.mjs"; //#region src/modules/vc/repository/W3cCredentialRecord.d.ts export interface W3cCredentialRecordOptions { id?: string; createdAt?: Date; tags?: CustomW3cCredentialTags; /** * The W3C credential instances to store on the record. * * NOTE that all instances should contain roughly the same data (e.g. exp can differ slighty), as they should be usable * interchangeably for presentations (allowing single-use credentials and batch issuance). */ credentialInstances: W3cCredentialRecordInstances; } export type W3cCredentialRecordInstances = NonEmptyArray<{ credential: string | W3cJsonCredential; }>; export type CustomW3cCredentialTags = { /** * Expanded types are used for JSON-LD credentials to allow for filtering on the expanded type. */ expandedTypes?: Array<string>; }; export type DefaultW3cCredentialTags = { issuerId: string; subjectIds: Array<string>; schemaIds: Array<string>; contexts: Array<string>; givenId?: string; claimFormat: W3cVerifiableCredential['claimFormat']; proofTypes?: Array<string>; cryptosuites?: Array<string>; types: Array<string>; algs?: Array<string>; /** * @since 0.6 - tag was not defined before 0.6 */ multiInstanceState?: CredentialMultiInstanceState; }; export declare class W3cCredentialRecord extends BaseRecord<DefaultW3cCredentialTags, CustomW3cCredentialTags> { static readonly type = "W3cCredentialRecord"; readonly type = "W3cCredentialRecord"; credentialInstances: W3cCredentialRecordInstances; /** * Tracks the state of credential instances on this record. * * NOTE: This defaults to `CredentialMultiInstanceState.SingleInstanceUsed` for records that * don't have a value set from before 0.6. We assume the credential has already been used. */ multiInstanceState: CredentialMultiInstanceState; constructor(props: W3cCredentialRecordOptions); /** * Only here for class transformation. If credential is set we transform * it to the new credentialInstances array format */ private set credential(value); get firstCredential(): W3cVerifiableCredential; static fromCredential(credential: W3cVerifiableCredential): W3cCredentialRecord; getTags(): Tags<DefaultW3cCredentialTags, CustomW3cCredentialTags>; /** * This overwrites the default clone method for records * as the W3cRecord has issues with the default clone method * due to how W3cJwtVerifiableCredential is implemented. This is * a temporary way to make sure the clone still works, but ideally * we find an alternative. */ clone(): this; /** * encoded is convenience method added to all credential records */ get encoded(): string | W3cJsonCredential; } //#endregion //# sourceMappingURL=W3cCredentialRecord.d.mts.map