import type { ProviderAuthPlugin, ProviderAuthValidationResult } from './provider-auth-plugin.js'; /** * Options for creating a {@link JwtProviderAuthPlugin}. * Exactly one of `secret` or `jwksUrl` must be provided. */ export type JwtProviderAuthPluginOptions = { /** HMAC shared secret for HS256/HS384/HS512 tokens. */ secret?: string; /** JWKS endpoint URL for RS256/ES256/EdDSA tokens. */ jwksUrl?: string; /** Expected JWT `iss` claim. If set, tokens without a matching issuer are rejected. */ issuer?: string; /** Expected JWT `aud` claim. If set, tokens without a matching audience are rejected. */ audience?: string; }; /** * Built-in {@link ProviderAuthPlugin} that validates JWT registration tokens. * * Supports two modes: * - **HMAC secret** (`DWN_PROVIDER_AUTH_JWT_SECRET`): symmetric HS256 verification. * - **JWKS URL** (`DWN_PROVIDER_AUTH_JWT_JWKS_URL`): asymmetric verification via * a remote JWKS endpoint (RS256, ES256, EdDSA, etc.). Keys are cached and * rotated automatically by `jose`. * * The JWT payload may include: * - `sub` — mapped to `accountId` in the validation result. * - `metadata` — arbitrary provider-defined object stored with the tenant. * * This plugin ships with `@enbox/dwn-server` and requires no external code. * Providers who need custom validation logic can implement their own * {@link ProviderAuthPlugin} instead. */ export declare class JwtProviderAuthPlugin implements ProviderAuthPlugin { #private; private constructor(); /** * Create a {@link JwtProviderAuthPlugin} from options. * * @param options - Must include exactly one of `secret` or `jwksUrl`. * @throws If neither `secret` nor `jwksUrl` is provided. */ static create(options: JwtProviderAuthPluginOptions): Promise; /** * Create a {@link JwtProviderAuthPlugin} from environment variables. * * Reads `DWN_PROVIDER_AUTH_JWT_SECRET`, `DWN_PROVIDER_AUTH_JWT_JWKS_URL`, * and optionally `DWN_PROVIDER_AUTH_JWT_ISSUER` / `DWN_PROVIDER_AUTH_JWT_AUDIENCE`. */ static fromEnv(): Promise; /** @inheritdoc */ validateRegistrationToken(token: string): Promise; } //# sourceMappingURL=jwt-provider-auth-plugin.d.ts.map