import { Result } from "@adviser/cement"; import { importJWK as joseImportJWK } from "jose"; import type { JWK } from "jose"; import { z } from "zod"; import type { SuperThis } from "../types/sthis.js"; import type { JWKPublic, JWKPrivate } from "../types/wire.js"; type JoseKey = Awaited>; export declare const envKeyDefaults: { SECRET: string; PUBLIC: string; }; export declare function importJWK(jwk: JWK, alg?: string, options?: { extractable?: boolean; }): Promise>; export declare function jwk2env(jwk: CryptoKey | JWK, sthis?: SuperThis): Promise; export declare function env2jwk(env: string, alg?: string, sthis?: SuperThis): Promise; export declare function coerceJWKWithSchema(sthis: SuperThis, validator: z.ZodTypeAny, ...inputs: unknown[]): Promise[]>; export declare function coerceJWK(sthis: SuperThis, ...i: unknown[]): Promise; export declare function coerceJWKPublic(sthis: SuperThis, ...i: unknown[]): Promise; export declare function coerceJWKPrivate(sthis: SuperThis, ...i: unknown[]): Promise; interface VerifyTokenOptions { fetchTimeoutMs: number; parseSchema: (payload: unknown) => Result; fetch: typeof globalThis.fetch; verifyToken: (token: string, pubKey: JWK) => Promise>; sthis: SuperThis; } export declare function verifyToken(token: string, presetPubKey: readonly (JWK | string)[], wellKnownUrls: readonly string[], iopts?: Partial): Promise>; interface FetchWellKnownJwksResultOk { readonly type: "ok"; readonly keys: JWKPublic[]; readonly url: string; } interface FetchWellKnownJwksResultErr { readonly type: "error"; readonly error: unknown; readonly url: string; } interface FetchWellKnownJwksResultTimeout { readonly type: "timeout"; readonly url: string; } type FetchWellKnownJwksResult = FetchWellKnownJwksResultOk | FetchWellKnownJwksResultErr | FetchWellKnownJwksResultTimeout; export declare function isFetchWellKnownJwksResultOk(r: FetchWellKnownJwksResult): r is FetchWellKnownJwksResultOk; export declare function isFetchWellKnownJwksResultErr(r: FetchWellKnownJwksResult): r is FetchWellKnownJwksResultErr; export declare function isFetchWellKnownJwksResultTimeout(r: FetchWellKnownJwksResult): r is FetchWellKnownJwksResultTimeout; export declare function fetchWellKnownJwks(urls: string | (string | undefined)[], iopts?: Partial>): Promise; export {};