Documentation
¶
Overview ¶
Package token signs and checks Devopus access tokens: JWTs signed with Ed25519 (alg EdDSA) whose public keys Auth publishes as JWKS. Workspace servers check tokens with a Remote key set, without calling Auth on every request.
Index ¶
Constants ¶
View Source
const DefaultAudience = "devopus"
DefaultAudience is the audience of tokens for Devopus itself rather than one workspace.
Variables ¶
View Source
var ( ErrMalformed = errors.New("malformed token") ErrSignature = errors.New("bad token signature") ErrExpired = errors.New("token expired") ErrClaims = errors.New("token is not for this service") )
Errors of Verify.
Functions ¶
Types ¶
type Claims ¶
type Claims struct {
Issuer string `json:"iss"`
Subject string `json:"sub"`
Session string `json:"sid"`
// Email is the user's email: workspace servers match invites by it.
Email string `json:"email,omitempty"`
Audience string `json:"aud"`
IssuedAt int64 `json:"iat"`
Expiry int64 `json:"exp"`
}
Claims are what an access token says: the user (sub) and the session (sid).
type JWK ¶
type JWK struct {
Kty string `json:"kty"`
Crv string `json:"crv"`
X string `json:"x"`
Kid string `json:"kid"`
Use string `json:"use"`
Alg string `json:"alg"`
}
JWK is a public Ed25519 key (RFC 8037).
Click to show internal directories.
Click to hide internal directories.