@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
43 lines • 2.1 kB
TypeScript
import { type JWK } from 'jose';
/** A key that signs blinded messages without seeing them: the operator's side of blind signing. */
export interface BlindSigner {
/** The key's `kid` in `jwks_uri`. */
readonly kid: string;
/** The RSA public key, published in `jwks_uri` with `alg: PS384`. */
readonly publicJwk: JWK;
/** RSABSSA BlindSign: the blinded message's RSA signature, as many bytes as the modulus. */
blindSign(blinded: Uint8Array): Promise<Uint8Array>;
}
/** RSABSSA Blind (RFC 9474 section 4.2): the blinded message, and the inverse to unblind with. */
export declare function blind(publicJwk: JWK, message: Uint8Array): {
blinded: Uint8Array;
inv: bigint;
};
/**
* RSABSSA BlindSign (RFC 9474 section 4.3), for the operator's key service: signs a blinded message
* with the private key, checking the result before returning it.
*/
export declare function blindSignWith(privateJwk: JWK, blinded: Uint8Array): Uint8Array;
/**
* RSABSSA Finalize (RFC 9474 section 4.4): unblinds the signature and verifies it as RSASSA-PSS over
* `message`. The result is a PS384 signature.
*/
export declare function finalize(publicJwk: JWK, message: Uint8Array, blindSignature: Uint8Array, inv: bigint): Uint8Array;
/** A compact JWS signed blindly with PS384: the header and payload never reach the signer. */
export declare function signJwtBlindly(signer: BlindSigner, header: Record<string, unknown>, payload: Record<string, unknown>): Promise<string>;
/** A fresh RSA key for blind signing (3072 bits), with its public JWK as `jwks_uri` publishes it. */
export declare function generateBlindSigningKey(modulusLength?: number): Promise<{
kid: string;
privateJwk: JWK;
publicJwk: JWK;
}>;
/**
* A signer that holds the private key in this process. The privacy of blind signing comes from the
* key living elsewhere (the operator's key service); use this for tests or for that service itself.
*/
export declare function localBlindSigner(key: {
kid: string;
privateJwk: JWK;
publicJwk: JWK;
}): BlindSigner;
//# sourceMappingURL=blind.d.ts.map