enrolltoken

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Prefix is the string prefix for all enrollment tokens.
	Prefix = "mren_"

	// SecretBytes is the number of random bytes in an enrollment secret.
	SecretBytes = 32
)

Variables

This section is empty.

Functions

func Decode

func Decode(token string) (addr, secret string, err error)

Decode parses an enrollment token and returns the coordinator address and secret it contains.

func Encode

func Encode(addr, secret string) string

Encode produces an enrollment token string from a coordinator address and secret. The token has the form mren_<base64url(json)>.

func GenerateSecret

func GenerateSecret() (string, error)

GenerateSecret produces a cryptographically random hex-encoded secret suitable for use in an enrollment token.

func Hash

func Hash(secret string) string

Hash returns the SHA-256 hash of a secret, using the same scheme as invite code hashing for consistency.

func IsHexSecret

func IsHexSecret(s string) bool

IsHexSecret reports whether s is a valid hex-encoded enrollment secret (64 lowercase hex characters = 32 bytes).

func IsToken

func IsToken(s string) bool

IsToken reports whether s looks like an enrollment token.

Types

This section is empty.

Jump to

Keyboard shortcuts

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