/** * Identity Proof Service for the BrightChain identity system. * * Creates, verifies, and manages cryptographic identity proofs that link * a BrightChain member to external platform accounts (Twitter, GitHub, * Reddit, personal websites, and blockchain addresses). * * Each proof contains a signed statement produced with the member's * SECP256k1 private key. Anyone with the member's public key can * independently verify the proof without contacting BrightChain. * * The signed statement format (Requirement 4.8): * "I am {username} on {platform}. My BrightChain ID is {memberId}. Timestamp: {ISO8601}" * * Requirements: 4.1, 4.2, 4.3, 4.4, 4.6, 4.9 */ import { ECIESService, Member, PlatformID } from '@digitaldefiance/ecies-lib'; import { ProofPlatform } from '../../enumerations/proofPlatform'; import { IIdentityProof } from '../../interfaces/identity/identityProof'; /** * Error thrown when an unsupported platform is specified. */ export declare class UnsupportedPlatformError extends Error { constructor(platform: string); } /** * Error thrown when proof creation fails (e.g. member has no private key). */ export declare class ProofCreationError extends Error { constructor(message: string); } /** * Error thrown when proof URL validation fails. */ export declare class ProofUrlError extends Error { constructor(message: string); } /** * Service for creating and verifying cryptographic identity proofs. * * Identity proofs link a BrightChain member to an external platform * account by signing a standardised statement with the member's * SECP256k1 private key. The proof can be independently verified by * anyone with the member's public key. * * All methods are static — the service is stateless and safe to call * from any context (browser or Node.js). * * @example * ```typescript * const eciesService = ServiceProvider.getInstance().eciesService; * const member = PaperKeyService.recoverFromPaperKey(paperKey, eciesService); * * // Create a proof * const proof = IdentityProofService.create(member, ProofPlatform.GITHUB, 'octocat'); * * // Verify the proof * const isValid = IdentityProofService.verify(proof, member.publicKey, eciesService); * * // Get posting instructions * const instructions = IdentityProofService.getInstructions(ProofPlatform.GITHUB); * ``` */ export declare class IdentityProofService { /** * Create a new identity proof by signing a statement with the member's * SECP256k1 private key. * * The signed statement follows the format defined in Requirement 4.8: * "I am {username} on {platform}. My BrightChain ID is {memberId}. Timestamp: {ISO8601}" * * **Validates: Requirements 4.1, 4.2, 4.3** * * @param member - The member creating the proof (must have private key loaded) * @param platform - The target platform (must be a valid {@link ProofPlatform} value) * @param username - The member's username on the target platform * @returns A new {@link IIdentityProof} with status {@link VerificationStatus.PENDING} * @throws {UnsupportedPlatformError} If the platform is not a valid {@link ProofPlatform} * @throws {ProofCreationError} If the member has no private key loaded */ static create(member: Member, platform: ProofPlatform, username: string): IIdentityProof; /** * Verify an identity proof's signature using a public key. * * Reconstructs the signature from its hex encoding and verifies it * against the signed statement using the ECIESService's ECDSA * verification. * * **Validates: Requirement 4.4** * * @param proof - The identity proof to verify * @param publicKey - The SECP256k1 public key to verify against (raw bytes) * @param eciesService - The ECIES service instance for signature verification * @returns `true` if the signature is valid for the given public key */ static verify(proof: IIdentityProof, publicKey: Uint8Array, eciesService: ECIESService): boolean; /** * Check whether a proof URL contains the expected signed statement. * * Fetches the proof URL and checks that the response body includes * the full signed statement text. This is used for initial verification * and periodic re-verification (Requirement 4.10). * * **Validates: Requirement 4.6** * * @param proof - The identity proof whose URL to check * @returns A promise resolving to `true` if the URL is accessible and * contains the signed statement, `false` otherwise */ static checkProofUrl(proof: IIdentityProof): Promise; /** * Get platform-specific instructions for posting an identity proof. * * Returns human-readable instructions explaining how to post the * signed statement on the specified platform and what URL to provide * for verification. * * **Validates: Requirement 4.9** * * @param platform - The target platform * @returns Instructions string for the specified platform, or a generic * fallback for unrecognised platforms */ static getInstructions(platform: ProofPlatform | string): string; /** * Build the signed statement string for a given set of parameters. * * This is a utility method that produces the statement text without * signing it. Useful for previewing the statement before creation. * * @param username - The member's username on the target platform * @param platform - The target platform * @param memberId - The member's hex-encoded ID * @param timestamp - ISO 8601 timestamp string * @returns The formatted statement string per Requirement 4.8 */ static buildStatement(username: string, platform: ProofPlatform | string, memberId: string, timestamp: string): string; } //# sourceMappingURL=identityProofService.d.ts.map