polysemy-account-api-0.2.0.0: Account management with Servant and Polysemy
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Account.Api.Interpreter.Jwt

Description

Interpreters for Jwt

Synopsis

Documentation

interpretJwtState :: Members [GenJwk, AtomicState (Maybe JWK), Error Text, Embed IO] r => ToJWT a => InterpreterFor (Jwt a) r Source #

Interpret Jwt by storing the key in AtomicState, generating it on the fly if absent.

Generates Ed25519 keys.

Errors originating from the token generator are critical.

interpretJwt :: forall a r. Members [Error Text, Embed IO] r => ToJWT a => InterpreterFor (Jwt a) r Source #

Interpret Jwt by storing the key in AtomicState in memory.

interpretJwtPersistent :: forall a e r. Members [AtomicState JWK !! e, Error Text, Embed IO] r => ToJWT a => InterpreterFor (Jwt a !! e) r Source #

Interpret Jwt by storing the key in AtomicState, requiring the key to be present from the start. This is intended to be used with a database backing the AtomicState, the key being generated when starting the app.

Generates Ed25519 keys.

Errors originating from the token generator are critical.

interpretJwtDb :: forall a r. Members [Database !! DbError, Error InitDbError, Error Text, Log, Mask, Resource, Race, Embed IO] r => ToJWT a => InterpreterFor (Jwt a !! DbError) r Source #

Interpret Jwt using interpretJwtPersistent and interpret AtomicState as a PostgreSQL table using polysemy-hasql, generating the JWK when it is not found in the database.

Orphan instances

(FromJSON i, FromJSON p) => FromJWT (AuthedAccount i p) Source # 
Instance details

(ToJSON i, ToJSON p) => ToJWT (AuthedAccount i p) Source # 
Instance details