access

package
v0.1.641 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package access keeps the named API keys issued by the gateway.

Index

Constants

View Source
const Prefix = "sk-magpie-key-"

Variables

This section is empty.

Functions

func ConfigureLAN

func ConfigureLAN(on, rotate bool) error

ConfigureLAN starts sharing with a named key. Rotation preserves the key's identity, name and enabled state.

func Managed

func Managed(secret string) bool

func MigrateLegacyLANKey

func MigrateLegacyLANKey() error

MigrateLegacyLANKey makes the old Settings key a normal, revocable caller key. Keep LANKey for older Magpie versions; LANKeyID marks a completed migration so the retained credential cannot resurrect a removed key.

func MigrateLegacyLANKeyBestEffort

func MigrateLegacyLANKeyBestEffort()

func Path

func Path() string

func Restore

func Restore(keys []Key) error

Restore replaces the gateway credentials when restoring their settings.

func Update

func Update(action string, in Change) (string, error)

Update writes the named key store atomically.

func WithIdentity

func WithIdentity(ctx context.Context, who Identity) context.Context

Types

type Change

type Change struct {
	Key  string `json:"key"`
	Name string `json:"name"`
}

type Identity

type Identity struct{ KeyID, KeyName string }

func Authenticate

func Authenticate(secret string) (Identity, bool)

Authenticate reloads the store so revocation takes effect in running gateways.

func Caller

func Caller(ctx context.Context) Identity

type Key

type Key struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Off    bool   `json:"off,omitempty"`
	LAN    bool   `json:"lan,omitempty"` // default key and durable migration marker
	Secret string `json:"secret,omitempty"`
	Masked string `json:"masked,omitempty"`
}

func Export

func Export() ([]Key, error)

Export returns credentials only for the encrypted backup bundle.

func List

func List() ([]Key, error)

List never returns credentials; only the administrator's copy action does.

Jump to

Keyboard shortcuts

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