Header menu logo FSharp.ATProto

ServiceAuth Module

Service-to-service JWT authentication for AT Protocol backend services (labelers, feed generators, etc.).

Types

Type Description

Algorithm

JWT signing algorithm.

Claims

Claims in a service auth JWT.

Functions and values

Function or value Description

createToken alg sign claims

Full Usage: createToken alg sign claims

Parameters:
Returns: string

Create a service auth JWT token. The sign function should produce a 64-byte compact ECDSA signature over the input bytes.

alg : Algorithm
sign : byte[] -> byte[]
claims : Claims
Returns: string

createTokenNow alg sign iss aud lxm

Full Usage: createTokenNow alg sign iss aud lxm

Parameters:
Returns: string

Create a service auth JWT with default timing (issued now, expires in 60 seconds).

alg : Algorithm
sign : byte[] -> byte[]
iss : Did
aud : Did
lxm : Nsid option
Returns: string

parseClaims token

Full Usage: parseClaims token

Parameters:
    token : string

Returns: Result<(Claims * Algorithm), string>

Parse JWT claims without verifying the signature.

token : string
Returns: Result<(Claims * Algorithm), string>

validateToken verify token

Full Usage: validateToken verify token

Parameters:
    verify : byte[] -> byte[] -> bool
    token : string

Returns: Result<Claims, string>

Validate a service auth JWT: verify signature, check expiry. The verify function should check a 64-byte compact ECDSA signature against data.

verify : byte[] -> byte[] -> bool
token : string
Returns: Result<Claims, string>

withServiceAuth alg sign iss aud agent

Full Usage: withServiceAuth alg sign iss aud agent

Parameters:
Returns: AtpAgent

Configure an AtpAgent to use service auth for requests. The sign function should produce a 64-byte compact ECDSA signature.

alg : Algorithm
sign : byte[] -> byte[]
iss : Did
aud : Did
agent : AtpAgent
Returns: AtpAgent

Type something to start searching.