BSV.Auth.Nonce (bsv_sdk v1.1.0)

Copy Markdown View Source

Cryptographic nonce creation and verification for auth protocols.

A nonce is base64(random_16_bytes || HMAC(random_16_bytes)).

Summary

Functions

Create a cryptographic nonce derived from the wallet.

Verify that a nonce was derived from the given wallet.

Functions

create(wallet, counterparty)

@spec create(BSV.Wallet.ProtoWallet.t(), BSV.Wallet.Types.Counterparty.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Create a cryptographic nonce derived from the wallet.

verify(nonce, wallet, counterparty)

@spec verify(
  String.t(),
  BSV.Wallet.ProtoWallet.t(),
  BSV.Wallet.Types.Counterparty.t()
) ::
  {:ok, boolean()} | {:error, String.t()}

Verify that a nonce was derived from the given wallet.