@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
44 lines • 2.34 kB
TypeScript
import { type EncrypterLike, type Keyring, type KmsAdapter, type LegacyReader, type SealedStatus, type SecretLike } from '../crypto-kit/index.js';
/** Bound into every sealed value: the app's keys never open these values for another use. */
export declare const POPPY_CONNECTIONS_PURPOSE = "agent:poppy-connections";
/** How the connections are sealed at rest (`crypto` in `config/poppy_connections.ts`). */
export interface PoppyCryptoConfig {
/**
* Keys, newest first: the first seals, every one opens (AES-256-GCM through Adonis' encryption).
* With `keys`, `agent:crypto:reseal` moves values off the older ones.
*/
keys?: SecretLike[];
/**
* An Adonis encryption instance to seal with. Default: the app's `encryption` service
* (`config/encryption.ts`), or `secret` when that is set.
*/
encryption?: EncrypterLike;
/** Envelope encryption through a KMS: a fresh data key per value, wrapped by the KMS. */
kms?: KmsAdapter;
}
/** What a value is bound to: copying it to another row makes it unreadable. */
export declare const connectionStateAad: (owner: string, issuer: string) => string;
export declare const pendingFlowAad: (id: string) => string;
/**
* Opens what agent sealed before the crypto kit (`v1.<iv>.<tag>.<body>`, AES-256-GCM under
* sha256("poppy-connections:v1:" + secret)). Read-only: new values use the crypto kit's format.
*/
export declare function legacySealerReader(secret: SecretLike): LegacyReader;
/**
* Seals what a connection keeps at rest — the refresh token, the DPoP and delegated private keys,
* the access tokens, and the sign-in flows — with the Agora crypto kit over Adonis' encryption,
* each value bound to its row. Values sealed by older versions still open; `agent:crypto:reseal`
* rewrites them.
*/
export declare class Sealer {
readonly keyring: Keyring;
/**
* `secret`: the app key (or `secret` of the config). It opens the values older versions sealed,
* and seals new ones unless `crypto` names `keys` or an `encryption`.
*/
constructor(secret: SecretLike, crypto?: PoppyCryptoConfig);
seal(value: unknown, aad: string): Promise<string>;
open<T>(sealed: string, aad: string): Promise<T>;
status(sealed: string, aad: string): Promise<SealedStatus>;
}
//# sourceMappingURL=crypto.d.ts.map