Documentation
¶
Overview ¶
Package service implements the Sign-In with Ethereum (EIP-4361) login flow: it issues single-use nonces, verifies signed SIWE messages, and mints the JWTs that authenticate read endpoints. The cryptographic primitives (JWT issuer, SIWE verifier, JWKS) live in pkg/auth/jwt and the nonce store in pkg/auth/service/nonce_provider; this package orchestrates them and binds the authenticated address to a registered user's Canton party.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Issuer ¶
type Issuer interface {
Issue(evmAddress, cantonPartyID string) (string, time.Time, error)
JWKS() jwt.JWKS
}
Issuer mints session JWTs and publishes the signing key set. Satisfied by *jwt.Issuer.
type NonceStore ¶
type NonceStore interface {
// Issue returns a nonce for address, valid for the store's TTL. Calling it again
// for an address that still holds a live nonce returns the same value. It may
// return an error if the store is at capacity.
Issue(address string) (string, error)
// Consume returns true exactly once for a live, previously-issued nonce and
// removes it; false for unknown, expired, or already-consumed nonces.
Consume(nonce string) bool
}
NonceStore issues and consumes single-use login nonces keyed by address. Consume must be atomic so a given nonce satisfies at most one login. Implementations live under nonce_provider (e.g. nonceprovider.InMemory).
type Service ¶
type Service interface {
// Nonce issues a single-use login nonce for the given EVM address.
Nonce(address string) (string, error)
// JWKS returns the public signing key set for token validation by other services.
JWKS() jwt.JWKS
// Login verifies a signed SIWE message and, if the recovered address belongs to
// a registered user, issues a JWT bound to that user's Canton party.
Login(ctx context.Context, message, signature string) (*auth.LoginResponse, error)
}
Service orchestrates the SIWE login flow.
func New ¶
func New( verifier Verifier, issuer Issuer, nonces NonceStore, users UserLookup, ) Service
New builds a login Service from its collaborators.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package nonceprovider contains implementations of the login nonce store.
|
Package nonceprovider contains implementations of the login nonce store. |