import { Logger, URI, Result, Option } from "@adviser/cement"; import { KeyBagRuntime, KeysByFingerprint } from "./types.js"; import { JWKPrivate } from "./jwk-private.zod.js"; import { DeviceIdKeyBagItem } from "./device-id-keybag-item.zod.js"; import { OpenJWTPayload } from "./jwt-payload.zod.js"; import type { JWK, JWTVerifyOptions, KeyObject } from "jose"; import { KeyedJwtKeyBagItem } from "./keybag-storage.zod.js"; export interface DeviceIdResult { readonly deviceId: Option; readonly cert: Option; readonly error?: Error; } export interface JWTResult { readonly key: string; readonly jwt: string; readonly claims?: OpenJWTPayload; } export interface KeyBagIf { readonly logger: Logger; readonly rt: KeyBagRuntime; hash(): string; subtleKey(materialStrOrUint8: string | Uint8Array): Promise; ensureKeyFromUrl(url: URI, keyFactory: () => string): Promise>; getNamedKey(name: string, failIfNotFound?: boolean, material?: string | Uint8Array): Promise>; setJwt(name: string, jwtStr: string): Promise>; getJwt(name: string, key?: CryptoKey | KeyObject | JWK | Uint8Array, opts?: JWTVerifyOptions): Promise>; delete(name: string): Promise; getDeviceId(): Promise; setDeviceId(deviceId: JWKPrivate, rIssueCert?: DeviceIdKeyBagItem["cert"]): Promise; }