Documentation
¶
Overview ¶
Package auth implements bearer-token issuance, storage, and verification for v0.1. Tokens are stored in <dataDir>/tokens.json mode 0600. Secrets are shown once on issue; only sha256 hashes are persisted.
Index ¶
- type Store
- func (s *Store) Issue(ctx context.Context, peers []string, label string) (string, string, error)
- func (s *Store) List(ctx context.Context) ([]*types.Token, error)
- func (s *Store) Revoke(ctx context.Context, tokenID string) error
- func (s *Store) Verify(ctx context.Context, secret, peerName string) (*types.Token, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements types.Authority backed by a JSON file on disk.
func (*Store) Issue ¶
Issue generates a new token authorized for the given peer names. Returns the ID and the plaintext secret; the secret is shown to the user once and never persisted.
func (*Store) List ¶
List returns all known tokens (including their hashes; the caller decides what to display).
Click to show internal directories.
Click to hide internal directories.