/** * H3-DAC Agent Identity System * Creates agent IDs using H3 geospatial indexing + Ethereum addresses * * Agent DID Format: did:opacus:h3::
* Agent ID: keccak256(address + h3Index + timestamp) */ import { ethers } from 'ethers'; /** * H3 Agent Identity */ export interface H3AgentIdentity { agentId: string; did: string; address: string; h3Index: string; publicKey: string; metadata: AgentMetadata; timestamp: number; } export interface AgentMetadata { name: string; description: string; capabilities: string[]; endpoint: string; h3Resolution: number; } /** * H3-DAC Agent Identity Manager */ export declare class H3AgentIdentity { /** * Create a new agent identity * @param signer Ethereum signer (agent owner) * @param h3Index H3 geospatial index (15 hex chars) * @param metadata Agent metadata */ static create(signer: ethers.Signer, h3Index: string, metadata: AgentMetadata): Promise; /** * Parse DID string back to components */ static parseDID(did: string): { h3Index: string; address: string; } | null; /** * Verify DID ownership with signature */ static verifyOwnership(did: string, message: string, signature: string): Promise; /** * Sign a message as an agent */ static signAsAgent(signer: ethers.Signer, agentId: string, message: string): Promise; /** * Create agent ID from coordinates */ static createFromCoordinates(signer: ethers.Signer, lat: number, lng: number, resolution: number, metadata: AgentMetadata): Promise; /** * Simplified H3 index generation from lat/lng * Note: For production, use h3-js library */ static latLngToH3(lat: number, lng: number, resolution?: number): string; /** * Get H3 neighbors (k-ring) */ static getNeighbors(h3Index: string, k?: number): string[]; /** * Calculate H3 distance between two indices */ static getDistance(h3Index1: string, h3Index2: string): number; /** * Export identity for storage */ static export(identity: H3AgentIdentity): string; /** * Import identity from JSON */ static import(json: string): H3AgentIdentity; } /** * Example Usage: * * ```typescript * import { H3AgentIdentity } from '@opacus/sdk'; * * // Create agent identity from coordinates (San Francisco) * const identity = await H3AgentIdentity.createFromCoordinates( * signer, * 37.7749, // latitude * -122.4194, // longitude * 9, // H3 resolution * { * name: 'Payment Agent SF', * description: 'Handles payments in San Francisco area', * capabilities: ['payment', 'escrow', 'gasless'], * endpoint: 'https://agent.opacus.ai', * h3Resolution: 9 * } * ); * * console.log('Agent ID:', identity.agentId); * console.log('DID:', identity.did); * // Output: * // Agent ID: 0xabc123... * // DID: did:opacus:h3:891c0000000000:0x742d35cc... * * // Sign a message as agent * const signature = await H3AgentIdentity.signAsAgent( * signer, * identity.agentId, * 'Process payment for user' * ); * * // Find nearby agents (within k=2 cells) * const neighbors = H3AgentIdentity.getNeighbors(identity.h3Index, 2); * * // Verify ownership * const valid = await H3AgentIdentity.verifyOwnership( * identity.did, * 'Test message', * signature * ); * ``` */ //# sourceMappingURL=h3-registry.d.ts.map