@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
104 lines (103 loc) • 4.22 kB
text/typescript
import { BaseRecord, TagsBase } from "../../../storage/BaseRecord.mjs";
import { KnownJwaSignatureAlgorithm } from "../../kms/jwk/jwa.mjs";
import { NonEmptyArray } from "../../../types.mjs";
import { CredentialMultiInstanceState } from "../../../utils/credentialUseTypes.mjs";
import { SdJwtVcTypeMetadata } from "../typeMetadata.mjs";
import { SdJwtVc } from "../SdJwtVcService.mjs";
import "../../kms/index.mjs";
//#region src/modules/sd-jwt-vc/repository/SdJwtVcRecord.d.ts
type DefaultSdJwtVcRecordTags = {
vct: string;
/**
* The sdAlg is the alg used for creating digests for selective disclosures
*/
sdAlg: string;
/**
* The alg is the alg used to sign the SD-JWT
*/
alg: KnownJwaSignatureAlgorithm;
/**
* @since 0.6 - tag was not defined before 0.6
*/
multiInstanceState?: CredentialMultiInstanceState;
};
type SdJwtVcRecordStorageProps = {
id?: string;
createdAt?: Date;
tags?: TagsBase;
/**
* The SD-JWT VC 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: SdJwtVcRecordInstances;
/**
* Optional VCT type metadata associated with the SD JWT VC instances, this type metadata is used for
* all SD JWT VC instances on this record.
*
* The type metadata is the result of resolving and merging the vct value and all `extends` values.
*
* NOTE: This may only include the latest VCT document, if the credential was stored before resolving
* `extends` claims was supported.
*/
typeMetadata?: SdJwtVcTypeMetadata;
/**
* The original chain of SD-JWT VC Type Metadata documents, ordered from the extending type to the last extended type.
* This is stored on the record to allow extensions to the type metadata (e.g. EUDI ARF TS12 for payments) to apply a
* custom merging strategy.
*/
typeMetadataChain?: NonEmptyArray<SdJwtVcTypeMetadata>;
};
type SdJwtVcRecordInstances = NonEmptyArray<{
compactSdJwtVc: string;
/**
* The kms key id to which the credential is bound. If not defined it either:
* - uses a legacy key id (which can be calculated based on the key)
* - is bound to a did (which stores the kms key id on the did record)
*/
kmsKeyId?: string;
}>;
declare class SdJwtVcRecord extends BaseRecord<DefaultSdJwtVcRecordTags> {
static readonly type = "SdJwtVcRecord";
readonly type = "SdJwtVcRecord";
credentialInstances: SdJwtVcRecordInstances;
/**
* 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;
/**
* Only here for class transformation. If compactSdJwtVc is set we transform
* it to the new sdJwtVcs array format
*/
private set compactSdJwtVc(value);
typeMetadata?: SdJwtVcTypeMetadata;
/**
* The original chain of SD-JWT VC Type Metadata documents, ordered from the extending type to the last extended type.
* This is stored on the record to allow extensions to the type metadata (e.g. EUDI ARF TS12 for payments) to apply a
* custom merging strategy.
*/
typeMetadataChain?: NonEmptyArray<SdJwtVcTypeMetadata>;
constructor(props: SdJwtVcRecordStorageProps);
get firstCredential(): SdJwtVc;
static fromSdJwtVc(sdJwtVc: SdJwtVc): SdJwtVcRecord;
get extendedVctValues(): string[];
getTags(): {
vct: string;
extendedVctValues: string[];
sdAlg: string;
alg: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | "Ed25519" | "ES256K";
multiInstanceState: CredentialMultiInstanceState;
};
clone(): this;
/**
* encoded is convenience method added to all credential records
*/
get encoded(): string;
}
//#endregion
export { DefaultSdJwtVcRecordTags, SdJwtVcRecord, SdJwtVcRecordInstances, SdJwtVcRecordStorageProps };
//# sourceMappingURL=SdJwtVcRecord.d.mts.map