mint

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type ScopeVerifier interface {
	VerifyZoneScope(zone, zonePub string) error
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL