Hedera.PublicKey (Hedera v0.8.0)

Copy Markdown View Source

A Hedera public key — Ed25519 (32-byte point) or ECDSA secp256k1 (stored as the uncompressed point for crypto operations, serialized as the 33-byte compressed form for the Hedera wire protocol).

Summary

Functions

Raw public-key bytes in Hedera wire form: Ed25519 → 32 bytes; ECDSA → 33-byte compressed point.

Lowercase hex of the wire-form public key.

Verify a signature produced by the matching private key. Returns false for a malformed or wrong-size signature rather than raising.

Types

t()

@type t() :: %Hedera.PublicKey{point: binary(), type: Hedera.PrivateKey.key_type()}

Functions

to_bytes(public_key)

@spec to_bytes(t()) :: binary()

Raw public-key bytes in Hedera wire form: Ed25519 → 32 bytes; ECDSA → 33-byte compressed point.

to_string(key)

@spec to_string(t()) :: binary()

Lowercase hex of the wire-form public key.

verify(public_key, message, signature)

@spec verify(t(), binary(), binary()) :: boolean()

Verify a signature produced by the matching private key. Returns false for a malformed or wrong-size signature rather than raising.