@agentauth/core
Version:
Core identity and cryptographic primitives for AgentAuth
45 lines • 2.03 kB
TypeScript
export type Algorithm = 'secp256k1';
/**
* Parses a private key from any supported format (aa-, 0x, or raw hex).
* @param token The private key in any format.
* @returns The clean 32-byte hex private key (without prefix).
*/
export declare function parsePrivateKey(token: string): string;
/**
* Derives an EVM-compatible address from a private key.
* @param privateKey The private key in any format (aa-, 0x, or raw hex).
* @returns The EVM-compatible address (0x-prefixed, 20 bytes).
*/
export declare function deriveAddress(privateKey: string): string;
/**
* Generates a stable, deterministic UUIDv5 for a given address.
* @param address The EVM-compatible address (0x-prefixed format).
* @returns The UUIDv5 string representing the stable `agentauth_id`.
*/
export declare function generateId(address: string): string;
/**
* Generates a complete AgentAuth identity with address-based components.
* @param algorithm The algorithm to use. Currently only 'secp256k1' is supported.
* @returns Complete identity with token, address, and ID.
*/
export declare function generateIdentity(algorithm?: Algorithm): {
agentauth_token: string;
agentauth_address: string;
agentauth_id: string;
};
/**
* Signs a payload using a private key.
* @param payload The JSON payload to sign.
* @param privateKey The private key in any format (aa-, 0x, or raw hex).
* @returns The hex-encoded signature with 0x prefix (EVM-standard).
*/
export declare function signPayload(payload: object, privateKey: string): string;
/**
* Verifies a signature against a payload and expected address.
* @param signature The hex-encoded signature with 0x prefix.
* @param payload The JSON payload to verify.
* @param expectedAddress The expected EVM-compatible address (0x-prefixed).
* @returns True if the signature is valid and recovers to the expected address, false otherwise.
*/
export declare function verifySignature(signature: string, payload: object, expectedAddress: string): boolean;
//# sourceMappingURL=index.d.ts.map