/** * @module modules/sns * @description SNS (Solana Name Service) integration module for SAP SDK * * Modular, free-choice design: Agents choose which records to expose. * No roles, no requirements, complete freedom. * * @since v1.0.0 * @packageDocumentation */ import { Connection, PublicKey, Commitment } from '@solana/web3.js'; import { Record } from '@bonfida/spl-name-service'; import type { SnsRegistrationParams, SnsRegistrationResult, SnsResolutionResult } from '../types/sns.js'; /** * SNS Integration Module * * Provides seamless integration between SAP agents and SNS domains. * Modular record system: agents freely choose which records to expose. * All other records are optional and agent-specific. * * @since v1.0.0 */ export declare class SnsModule { private connection; private sapProgramId; private defaultCommitment; constructor(config: { connection: Connection; sapProgramId: string | PublicKey; defaultCommitment?: Commitment; }); /** * Check if a domain is available for registration * * Rate limited to prevent RPC abuse and enumeration attacks. * * @param domainName - Domain name to check (with or without .sol) * @returns True if available */ checkAvailability(domainName: string): Promise; /** * Sanitize and validate domain name * * Prevents homograph attacks, invalid characters, and length violations. */ private sanitizeDomainName; /** * Validate HTTP/HTTPS URL */ private isValidHttpUrl; /** * Calculate required space for SNS records */ private calculateRequiredSpace; /** * Register a .sol domain for a SAP agent * * SECURITY FIXES APPLIED: * 1. Signer verification - ensures signer matches agentWallet * 2. Domain name sanitization - prevents invalid/homograph domains * 3. Complete record PDA tracking - returns all created record PDAs * 4. Commitment level configuration - allows user-specified commitment * 5. Space calculation - dynamically calculates required space * * @param params - Registration parameters with modular records * @returns Registration result with domain, agent info, and records list * * @throws {Error} If signer does not match agentWallet * @throws {Error} If domain is already taken * @throws {Error} If registration fails */ registerAgentDomain(params: SnsRegistrationParams): Promise; /** * Resolve a .sol domain to its SAP agent identity * * SECURITY FIX: Properly derives agent PDA from SAP program instead of copying wallet */ resolveAgentDomain(domain: string): Promise; /** * Get a specific SNS record for a domain * * SECURITY FIX: Proper record data parsing with offset handling and null-byte stripping */ private getSnsRecord; /** * Validate SNS records for SAP agent compliance (on-chain only) */ validateAgentRecords(domain: string): Promise<{ valid: boolean; errors: string[]; warnings: string[]; }>; /** * Validate Base58 string */ private isValidBase58; /** * Validate IPv4 address */ private isValidIPv4; /** * Validate IPv6 address */ private isValidIPv6; /** * Validate domain name */ private isValidDomain; /** * Batch check availability for multiple domains * * Rate limited internally to prevent RPC abuse. */ batchCheckAvailability(domainNames: string[]): Promise>; /** * Get domain PDA for a given domain name */ getDomainPda(domain: string): PublicKey; /** * Get record PDA for a specific record type */ getRecordPda(domain: string, recordType: Record): PublicKey; } export { Record } from '@bonfida/spl-name-service'; //# sourceMappingURL=sns.d.ts.map