import { type JWK } from 'jose';
import { type BlindSigner } from './blind.js';
import { type StoredKey } from './keys.js';
import type { ClientMetadata } from './types.js';
import { type SecurityOptions } from './util.js';
export interface IdentityConfig {
    /** Where the identity documents are served, e.g. `https://agent.example`. */
    baseUrl: string;
    clientName: string;
    /** Defaults to `{baseUrl}/logo.svg`, which `serve-identity` serves. */
    logoUri?: string | undefined;
    /** Signing keys; the first one signs. Public halves go in `jwks_uri`. */
    keys: StoredKey[];
    /**
     * Sign client assertions AND delegations blindly with PS384 (10.7): the JWTs are written here, with
     * their `jti`, and the signer (the operator's key service) signs them without seeing them. Its
     * public key is published in `jwks_uri`. `keys` may then be empty.
     */
    blindSigner?: BlindSigner | undefined;
}
/** Lifetime of a client assertion: `exp` MUST be at most 5 minutes after `iat` (4.1). */
export declare const ASSERTION_TTL_SECONDS = 60;
export declare const DELEGATION_TYP = "poppy-delegation+jwt";
/** How long a delegation lasts, within the 24 hours 5.2 allows. */
export declare const DELEGATION_TTL_SECONDS: number;
/**
 * The Personal Agent's identity (4.1): its `client_id` URL, its metadata document, and the
 * keys from `jwks_uri` that sign client assertions and the delegations of Session JWT keys.
 */
export declare class AgentIdentity {
    readonly baseUrl: string;
    readonly clientName: string;
    readonly logoUri: string;
    readonly keys: StoredKey[];
    readonly blindSigner: BlindSigner | undefined;
    constructor(cfg: IdentityConfig, sec?: SecurityOptions);
    /** `client_id` is the URL the metadata document is fetched from (4.1). */
    get clientId(): string;
    get jwksUri(): string;
    /** Same origin as `client_id`, as 4.1 requires for `redirect_uris`. */
    get redirectUri(): string;
    /** Extensions aren't declared here: each request declares them in `Poppy-Extensions` (3.4). */
    metadata(): ClientMetadata;
    /** The public key set. Never contains private members. */
    jwks(): {
        keys: Record<string, unknown>[];
    };
    /**
     * Signs with the first key, or blindly with PS384 when a blind signer is set: then BOTH client
     * assertions and delegations are signed blindly, as 10.7 requires.
     */
    private sign;
    /**
     * `private_key_jwt` client assertion (4.1, RFC 7523): `iss` = `sub` = `client_id`, `aud` = the
     * Company's issuer as a single string, with `iat`, `exp` at most 5 minutes later and a fresh `jti`.
     * The `jti` is generated here, never by a blind signer: it is what keeps a deterministic blind
     * signature safe (10.7).
     */
    clientAssertion(issuer: string): Promise<string>;
    /**
     * A delegation (5.2): vouches for one delegated public key. It names no User or Company. Its
     * times are rounded to the hour, as the guides suggest, so they say less about when it was made.
     */
    delegate(publicJwk: JWK): Promise<{
        jwt: string;
        exp: number;
    }>;
}
//# sourceMappingURL=identity.d.ts.map