esdb_pubsub_security (reckon_gater v1.1.2)

View Source

HMAC security utilities for reckon-gater PubSub

Provides message signing and verification for critical channels. Uses HMAC-SHA256 for message authentication.

Usage

Sign a message: SignedMsg = esdb_pubsub_security:sign(Message).

Verify a signed message: ok = esdb_pubsub_security:verify(SignedMsg).

Verify with explicit secret: ok = esdb_pubsub_security:verify(SignedMsg, Secret).

Summary

Functions

Get the configured HMAC secret

Set the HMAC secret

Sign a message map using the configured secret

Sign a message map using a specific secret

Verify a signed message using the configured secret

Verify a signed message using a specific secret

Functions

get_secret()

-spec get_secret() -> binary().

Get the configured HMAC secret

set_secret(Secret)

-spec set_secret(binary() | string()) -> ok.

Set the HMAC secret

sign(Message)

-spec sign(map()) -> map().

Sign a message map using the configured secret

sign(Message, Secret)

-spec sign(map(), binary()) -> map().

Sign a message map using a specific secret

verify(Message)

-spec verify(map()) -> ok | {error, term()}.

Verify a signed message using the configured secret

verify(Message, Secret)

-spec verify(map(), binary()) -> ok | {error, term()}.

Verify a signed message using a specific secret