Documentation ¶
Overview ¶
Messages are prepended with a HMAC SHA256 signature (the signature makes up the first 32 bytes of a signed message; the remainder is the original message in cleartext).
Index ¶
Constants ¶
const SIGNATURE_LENGTH = 32
Variables ¶
This section is empty.
Functions ¶
func SignMessage ¶
SignMessage returns a message signed with the provided secret, with the signature prepended to the original message.
Types ¶
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
A SignatureVerifier is a self-instrumenting pipeline object that validates and removes signatures.
func NewVerifier ¶
NewSignatureVerifier returns a SignatureVerifier with the provided shared signing secret.
func (*Verifier) Run ¶
Run validates signatures. It consumes signed messages from inputChan, verifies the signature, and sends the message (sans signature) to outputChan. Invalid messages are dropped and nothing is sent to outputChan. Thus a reader of outputChan is guaranteed to receive only messages with a valid signature.
Run blocks on sending to outputChan, so the channel must be drained for the function to continue consuming from inputChan.