AXIAM C++ SDK 1.0.0-alpha8
Authentication, authorization, JWKS & route guards (REST + mTLS)
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
axiam::webhook Namespace Reference

Classes

struct  Event
 A verified delivery. More...
 
struct  Options
 Optional inputs to verify(). More...
 
struct  Result
 Outcome of verify(). Contextually convertible to bool; falsy means rejected. More...
 
class  VerifyException
 Thrown by verify_or_throw() when a delivery does not verify. More...
 

Enumerations

enum class  VerifyError {
  kNone = 0 , kEmptySecret , kMalformedHeader , kMissingSignature ,
  kMalformedTimestamp , kTimestampHeaderMismatch , kSignatureMismatch , kTimestampOutOfTolerance
}
 Why verification failed. More...
 

Functions

const char * to_string (VerifyError error) noexcept
 Stable, secret-free description of a VerifyError.
 
Result verify (const Sensitive< std::string > &secret, const std::string &signature_header, const std::string &body, const Options &options=Options{})
 Verify a webhook delivery.
 
Result verify (const std::string &secret, const std::string &signature_header, const std::string &body, const Options &options=Options{})
 Overload for a secret that is not already wrapped. Prefer the Sensitive form.
 
Event verify_or_throw (const Sensitive< std::string > &secret, const std::string &signature_header, const std::string &body, const Options &options=Options{})
 Throwing twin of verify(), for handlers that prefer an exception.
 

Enumeration Type Documentation

◆ VerifyError

enum class axiam::webhook::VerifyError
strong

Why verification failed.

Deliberately coarse: nothing here, and nothing in the matching message, discloses the expected signature.

Enumerator
kNone 
kEmptySecret 

no secret configured — fail closed, never skip

kMalformedHeader 

unparseable, empty, or no/duplicate t=

kMissingSignature 

header parsed but carried no v1= value

kMalformedTimestamp 

t= was not a non-negative decimal integer

kTimestampHeaderMismatch 

X-Axiam-Timestamp disagreed with t=

kSignatureMismatch 

no supplied v1 matched the computed MAC

kTimestampOutOfTolerance 

|now - t| exceeded the freshness window

Function Documentation

◆ to_string()

const char * axiam::webhook::to_string ( VerifyError  error)
noexcept

Stable, secret-free description of a VerifyError.

◆ verify() [1/2]

Result axiam::webhook::verify ( const Sensitive< std::string > &  secret,
const std::string &  signature_header,
const std::string &  body,
const Options options = Options{} 
)

Verify a webhook delivery.

Never throws; fails closed on anything unexpected.

Parameters
secretthe webhook's plaintext secret (§7 Sensitive).
signature_headerthe raw X-Axiam-Signature value.
bodythe RAW request body bytes, exactly as received.
optionsfreshness window, clock seam, optional headers.

◆ verify() [2/2]

Result axiam::webhook::verify ( const std::string &  secret,
const std::string &  signature_header,
const std::string &  body,
const Options options = Options{} 
)

Overload for a secret that is not already wrapped. Prefer the Sensitive form.

◆ verify_or_throw()

Event axiam::webhook::verify_or_throw ( const Sensitive< std::string > &  secret,
const std::string &  signature_header,
const std::string &  body,
const Options options = Options{} 
)

Throwing twin of verify(), for handlers that prefer an exception.

Exceptions
VerifyException— the message names the failure class only, never the expected signature.