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

67 lines (66 loc) • 2.69 kB
import { BaseRecord, Tags, TagsBase } from "../../../storage/BaseRecord.mjs"; import { NonEmptyArray } from "../../../types.mjs"; import { CredentialMultiInstanceState } from "../../../utils/credentialUseTypes.mjs"; import { W3cV2VerifiableCredential } from "../models/credential/W3cV2VerifiableCredential.mjs"; import "../models/index.mjs"; //#region src/modules/vc/repository/W3cV2CredentialRecord.d.ts interface W3cV2CredentialRecordOptions { id?: string; createdAt?: Date; credentialInstances: W3cV2CredentialRecordInstances; } type W3cV2CredentialRecordInstances = NonEmptyArray<{ /** * NOTE: String for now, might change in the future if we add other types. */ credential: string; }>; type DefaultW3cV2CredentialTags = { issuerId: string; subjectIds: Array<string>; schemaIds: Array<string>; contexts: Array<string>; givenId?: string; claimFormat: W3cV2VerifiableCredential['claimFormat']; types: Array<string>; algs?: Array<string>; /** * @since 0.6 - tag was not defined before 0.6 */ multiInstanceState?: CredentialMultiInstanceState; }; declare class W3cV2CredentialRecord extends BaseRecord<DefaultW3cV2CredentialTags> { static readonly type = "W3cV2CredentialRecord"; readonly type = "W3cV2CredentialRecord"; credentialInstances: W3cV2CredentialRecordInstances; /** * 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: W3cV2CredentialRecordOptions); /** * Only here for class transformation. If credential is set we transform * it to the new credentialInstances array format */ private set credential(value); get firstCredential(): W3cV2VerifiableCredential; static fromCredential(credential: W3cV2VerifiableCredential): W3cV2CredentialRecord; getTags(): Tags<DefaultW3cV2CredentialTags, TagsBase>; /** * This overwrites the default `clone` method for records, as the W3cV3CredentialRecord * has issues with the default clone method due to the way the JWT and SD-JWT * records are 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; } //#endregion export { DefaultW3cV2CredentialTags, W3cV2CredentialRecord, W3cV2CredentialRecordInstances, W3cV2CredentialRecordOptions }; //# sourceMappingURL=W3cV2CredentialRecord.d.mts.map