Documentation
¶
Overview ¶
Package mint makes the NATS user JWT and creds of one policy endpoint: signed by the endpoint's zone scoped signing key, carrying the endpoint's compiled tags and nothing else (the zone key's template grants the permissions). It does no network I/O; the keys come through the Keys seam (ADR 0052, ADR 0053).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keys ¶
type Keys interface {
Account() (nkeys.KeyPair, string, error)
ZoneKey(zone string, create bool) (nkeys.KeyPair, error)
}
Keys is the key store Mint signs with; *ctlkeys.Authority satisfies it.
type Minted ¶
type Minted struct {
Name string
Zone string
UserPub string
AccountPub string
JWT string
Creds []byte // the creds file contents (JWT and seed): a secret
Tags []string
}
Minted is one issued user. Creds holds the user seed: never log or print it.
func Mint ¶
func Mint(keys Keys, c *policy.Compiled, name string, userSeed []byte, createZoneKey bool) (*Minted, error)
Mint issues the user JWT of endpoint name of c. With userSeed nil it makes a fresh user key; with a user seed (a re-issue) it keeps that user key. The caller decides whether the zone's signing key may be created: with createZoneKey false a missing key is an error wrapping ctlkeys.ErrNoZoneKey, since a key made now would not be in the account JWT the zone's existing users were issued under.
type ScopeVerifier ¶
ScopeVerifier is implemented by a Keys that can see the account JWT the zone keys are published in. Mint calls it with the zone key's public key and the zone, and it returns an error unless that key is a jwt.UserScope signing key of the account. The key store alone (ctlkeys.Authority) holds seeds, not the account JWT, so it does not implement it; Mint then relies on the checks in checkZoneKey, and `policy apply` is what publishes and verifies the scope in the account JWT.