HAP.Crypto.ECDH (HAP v0.1.0) View Source

Functions to work with Elliptic Curve Diffie-Hellman shared secret generation

Link to this section Summary

Functions

Computes a shared secret from the counterpary's public key and our private key, using the x25519 curve.

Generates a new ECDH key pair using the x25519 curve.

Link to this section Types

Specs

private_key() :: binary()

Specs

public_key() :: binary()

Specs

shared_secret() :: binary()

Link to this section Functions

Link to this function

compute_key(other_pub, my_priv)

View Source

Specs

compute_key(public_key(), private_key()) :: {:ok, shared_secret()}

Computes a shared secret from the counterpary's public key and our private key, using the x25519 curve.

Returns {:ok, shared secret}

Specs

key_gen() :: {:ok, public_key(), private_key()}

Generates a new ECDH key pair using the x25519 curve.

Returns {:ok, public_key, provate_key}