nostr_tools.validate_keypair

nostr_tools.validate_keypair(private_key, public_key)[source]

Test if a private/public key pair is valid and matches.

This function verifies that the given private key generates the corresponding public key using secp256k1 elliptic curve cryptography.

Parameters:
  • private_key (str) – Private key in hex format (64 characters)

  • public_key (str) – Public key in hex format (64 characters)

Returns:

True if the key pair is valid and matches, False otherwise

Return type:

bool