Module BSV::Wallet::Client::Crypto ¶
Cryptographic operations for the BRC-100 wallet client.
Provides the 9 crypto public methods defined by the BRC-100 interface: key derivation, symmetric encryption/decryption, HMAC creation/verification, ECDSA signing/verification, and key linkage revelation.
All methods delegate to @substrate when present. Otherwise they operate against @key_deriver directly.
Public Instance Methods¶
create_hmac(args, originator: = nil) ¶
Creates an HMAC-SHA256 using a derived symmetric key. - @option args - @option args - @option args - @option args - @param args [Hash] - @return [Hash] { hmac: Array
create_signature(args, originator: = nil) ¶
Creates an ECDSA signature using a derived private key. - @option args - @option args - @option args - @option args - @option args - @param args [Hash] - @return [Hash] { signature: Array
decrypt(args, originator: = nil) ¶
Decrypts ciphertext using AES-256-GCM with a derived symmetric key. - @option args - @option args - @option args - @option args - @param args [Hash] - @return [Hash] { plaintext: Array
encrypt(args, originator: = nil) ¶
Encrypts plaintext using AES-256-GCM with a derived symmetric key. - @option args - @option args - @option args - @option args - @param args [Hash] - @return [Hash] { ciphertext: Array
get_public_key(args, originator: = nil) ¶
Returns a derived or identity public key. - @option args - @option args - @option args - @option args - @option args - @param args [Hash] - @return [Hash] { public_key: String } hex-encoded compressed public key
reveal_counterparty_key_linkage(args, originator: = nil) ¶
Reveals counterparty key linkage to a verifier (BRC-69 Method 1). - @option args - @option args - @param args [Hash] - @raise [InvalidParameterError] - @return [Hash] with :prover, :verifier, :counterparty, :revelation_time, :encrypted_linkage, :encrypted_linkage_proof
reveal_specific_key_linkage(args, originator: = nil) ¶
Reveals specific key linkage for a particular interaction (BRC-69 Method 2). - @option args - @option args - @option args - @option args - @param args [Hash] - @raise [InvalidParameterError] - @return [Hash] with :prover, :verifier, :counterparty, :protocol_id, :key_id, :encrypted_linkage, :encrypted_linkage_proof, :proof_type
verify_hmac(args, originator: = nil) ¶
Verifies an HMAC-SHA256 using a derived symmetric key. - @option args - @option args - @option args - @option args - @option args - @param args [Hash] - @raise [InvalidHmacError] if the HMAC does not match - @return [Hash] { valid: true }
verify_signature(args, originator: = nil) ¶
Verifies an ECDSA signature using a derived public key. - @option args - @option args - @option args - @option args - @option args - @option args - @option args - @param args [Hash] - @raise [InvalidSignatureError] if the signature does not verify - @return [Hash] { valid: true }