/*! * Shape-detection guards and loose-shape normalizers for VC / DID / wallet * objects. * * The Universal Wallet data model has no discriminant field distinguishing its * content types, and incoming request payloads may be a bare Verifiable * Credential, a Verifiable Presentation, or unrelated JSON. These guards * identify each by object shape. * * Two distinct "is this a VC" checks live here on purpose: * * - `isVerifiableCredential` / `isVerifiablePresentation` inspect the `type` * field. VC-vs-VP routing REQUIRES this: a VP carries the same * `credentials/v(1|2)` context as the VCs it wraps, so a context check cannot * tell them apart. * - `isCredential` inspects `@context`. It runs only over already-decrypted * wallet contents (a mix of VC / DID document / key / profile metadata), * where the context cleanly separates a VC from the non-credential entries. * * The `typeArray` / `issuerId` / `subjectId` normalizers read the loosely-typed * `type`, `issuer`, and `credentialSubject.id` fields, each of which the VC data * model allows in more than one form. */ import type { IVerifiableCredential, IVerifiablePresentation } from './VCDM.js'; import type { IDidDocument } from './DID.js'; import type { IKeyPair } from './KeyPair.js'; /** * Whether an object is a Verifiable Credential, by inspecting its `type` for * `'VerifiableCredential'`. */ export declare function isVerifiableCredential(obj: unknown): obj is IVerifiableCredential; /** * Whether an object is a Verifiable Presentation, by inspecting its `type` for * `'VerifiablePresentation'`. */ export declare function isVerifiablePresentation(obj: unknown): obj is IVerifiablePresentation; /** * Whether a decrypted wallet content item is a Verifiable Credential, by * inspecting its `@context` for a VC Data Model v1 or v2 context URL. */ export declare function isCredential(item: unknown): item is IVerifiableCredential; /** * Whether a decrypted wallet content item is a DID Document, by inspecting its * `@context` for the DID v1 context URL. */ export declare function isDidDocument(item: unknown): item is IDidDocument; /** * Whether a decrypted wallet content item is an Ed25519 verification key. */ export declare function isVerificationKey(item: unknown): item is IKeyPair; /** * Normalizes a `type` value (string or array) to an array of strings. * * @param type {unknown} * @returns {string[]} */ export declare function typeArray(type: unknown): string[]; /** * Extracts a DID / id string from an issuer value that may be a string or an * `{ id }` object. * * @param issuer {unknown} * @returns {string | undefined} */ export declare function issuerId(issuer: unknown): string | undefined; /** * The credentialSubject id of a VC, when present. * * @param credential {IVerifiableCredential} * @returns {string | undefined} */ export declare function subjectId(credential: IVerifiableCredential): string | undefined; //# sourceMappingURL=Guards.d.ts.map