mint

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 7 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 endpoint: signed by the account signing key and carrying the endpoint's own permission set (admin.Permissions). There is no per-zone scoped signing key and no tag (ADR 0091): the address is the fence, and the key that signs a user is the account's own. It does no network I/O; the key comes through the Keys seam (ADR 0052).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignUser added in v0.5.5

func SignUser(keys Keys, addr sap.Address, userPub string) (token, acctPub string, err error)

SignUser signs the user JWT of the endpoint at addr for userPub, a user public key the endpoint made: no seed is involved. The claims are Mint's: the dotted address as name, admin.Permissions(addr), no tag, signed by the account signing key. It returns the JWT and the account public key.

Types

type Keys

type Keys interface {
	Account() (nkeys.KeyPair, string, error)
	Signing() (nkeys.KeyPair, string, error)
}

Keys is the key store Mint signs with; *ctlkeys.Authority satisfies it.

Account is the account IDENTITY key. Signing is the account SIGNING key an operator with strict_signing_key_usage requires; it returns ctlkeys.ErrNoSigningKey (tested with errors.Is) when none is configured, and then the identity key signs, as before.

type Minted

type Minted struct {
	Name       string
	UserPub    string
	AccountPub string
	JWT        string
	Creds      []byte // the creds file contents (JWT and seed): a secret
}

Minted is one issued user. Creds holds the user seed: never log or print it.

func Mint

func Mint(keys Keys, addr sap.Address, userSeed []byte) (*Minted, error)

Mint issues the user JWT of the endpoint at addr, named by its flat key, signed by the account signing key with the permission set of admin.Permissions(addr). With userSeed nil it makes a fresh user key; with a user seed (a re-issue) it keeps that user key.

Jump to

Keyboard shortcuts

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