|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Verifies signed bearer tokens against a shared secret. More...
#include <session_auth.hpp>
Public Member Functions | |
| TokenVerifier (std::string secret, MacFunction mac=hmacSha256) | |
Constructs a verifier over secret using mac. | |
| std::expected< SessionToken, AuthError > | verify (std::string_view token, int64_t nowMs) const |
Verifies token's signature and expiry and returns its claims. | |
Verifies signed bearer tokens against a shared secret.
Definition at line 430 of file session_auth.hpp.
|
inlineexplicit |
Constructs a verifier over secret using mac.
| secret | Shared secret (same value the issuer used). |
| mac | MAC primitive; defaults to hmacSha256. Stored and invoked for this verifier's whole lifetime, so anything the callable refers to must outlive the verifier. |
Definition at line 452 of file session_auth.hpp.
|
inlinenodiscard |
Verifies token's signature and expiry and returns its claims.
The MAC is checked before the payload is parsed, so untrusted JSON is never handed to the parser until authenticity is established.
| token | Token string (payload.sig). |
| nowMs | Current time (ms since epoch) to check expiry against. |
Definition at line 463 of file session_auth.hpp.