Documentation ¶
Index ¶
- Constants
- Variables
- func AbbrevHomePaths(fp string) string
- func AddGitIgnore(dir string) error
- func ExtractSeed(s string) (nkeys.KeyPair, error)
- func GetKeyPath(pubkey string) string
- func GetKeysDir() string
- func IndentMessage(s string, prefix string) string
- func IsAccountServerURL(u string) bool
- func IsJwtName(name string) bool
- func IsNatsUrl(url string) bool
- func IsNotExist(err error) bool
- func IsOldKeyRing(dir string) (bool, error)
- func IsPublicKey(kind nkeys.PrefixByte, key string) bool
- func IsReport(s Status) bool
- func IsResolverURL(u string) bool
- func JwtName(name string) string
- func KeyPairTypeOk(kind nkeys.PrefixByte, kp nkeys.KeyPair) bool
- func KeyType(kp nkeys.KeyPair) (nkeys.PrefixByte, error)
- func KeysNeedMigration() (bool, error)
- func Match(pubkey string, kp nkeys.KeyPair) bool
- func MaybeMakeDir(dir string) error
- func Migrate() (string, error)
- func NewAccountNotExistErr(name string) error
- func NewOperatorNotExistErr(name string) error
- func NewResourceNotExistErr(kind string, name string) error
- func NewUserNotExistErr(name string) error
- func PlainName(name string) string
- func PubKeyType(pk string) (nkeys.PrefixByte, error)
- func ResolveKey(value string) (nkeys.KeyPair, error)
- func SafeName(n string) string
- func StoreKey(kp nkeys.KeyPair) (string, error)
- func Walk(root *Node, walkFn WalkFunc) error
- func Write(name string, data []byte) error
- type Context
- func (ctx *Context) DefaultUser(accountName string) *string
- func (ctx *Context) DefaultUserClaim(accountName string) (*jwt.UserClaims, error)
- func (ctx *Context) GetAccountKeys(name string) ([]string, error)
- func (ctx *Context) GetOperatorKeys() ([]string, error)
- func (ctx *Context) ResolveKey(flagValue string, kinds ...nkeys.PrefixByte) (nkeys.KeyPair, error)
- func (ctx *Context) SetContext(name string, pub string) error
- type Entity
- type Formatter
- type IStore
- type Info
- type JobStatus
- type KeyStore
- func (k *KeyStore) AllKeys() ([]string, error)
- func (k *KeyStore) CalcAccountCredsDir(account string) string
- func (k *KeyStore) CalcUserCredsPath(account string, user string) string
- func (k *KeyStore) GetKeyPair(pubkey string) (nkeys.KeyPair, error)
- func (k *KeyStore) GetKeyPath(pubkey string) string
- func (k *KeyStore) GetPublicKey(pubkey string) (string, error)
- func (k *KeyStore) GetSeed(pubkey string) (string, error)
- func (k *KeyStore) GetUserCredsPath(account string, user string) string
- func (k *KeyStore) HasPrivateKey(pubkey string) bool
- func (k *KeyStore) MaybeStoreUserCreds(account string, user string, data []byte) (string, error)
- func (k *KeyStore) Read(path string) (nkeys.KeyPair, error)
- func (k *KeyStore) Remove(pubkey string) error
- func (k *KeyStore) Store(kp nkeys.KeyPair) (string, error)
- type KeyTypeFn
- type MultiJob
- type NKeyFactory
- type NamedKey
- type Node
- type PrintOption
- type Report
- func (r *Report) Add(status ...Status)
- func (r *Report) AddError(format string, args ...interface{}) *Report
- func (r *Report) AddFromError(err error)
- func (r *Report) AddOK(format string, args ...interface{}) *Report
- func (r *Report) AddStatus(code StatusCode, format string, args ...interface{}) *Report
- func (r *Report) AddWarning(format string, args ...interface{}) *Report
- func (r *Report) Code() StatusCode
- func (r *Report) Format(indent string) string
- func (r *Report) HasErrors() bool
- func (r *Report) HasNoErrors() bool
- func (r *Report) HasServerMessages() bool
- func (r *Report) Message() string
- func (r *Report) OK() bool
- func (r *Report) Summary() (string, error)
- type ResourceErr
- type ServerMessage
- type Status
- func ErrorStatus(format string, args ...interface{}) Status
- func FromError(err error) Status
- func HoistChildren(s Status) []Status
- func NewServerMessage(format string, args ...interface{}) Status
- func OKStatus(format string, args ...interface{}) Status
- func PullAccount(u string) (Status, error)
- func PullReport(code int, data []byte) Status
- func PushAccount(u string, data []byte) (Status, error)
- func PushReport(code int, data []byte) Status
- func WarningStatus(format string, args ...interface{}) Status
- type StatusCode
- type Statuses
- type Store
- func (s *Store) ClaimType(data []byte) (jwt.ClaimType, error)
- func (s *Store) Delete(name ...string) error
- func (s *Store) GetContext() (*Context, error)
- func (s *Store) GetName() string
- func (s *Store) GetRootPublicKey() (string, error)
- func (s *Store) Has(name ...string) bool
- func (s *Store) HasAccount(name string) bool
- func (s *Store) IsManaged() bool
- func (s *Store) List(path ...string) ([]fs.DirEntry, error)
- func (s *Store) ListEntries(name ...string) ([]string, error)
- func (s *Store) ListSubContainers(name ...string) ([]string, error)
- func (s *Store) LoadClaim(name ...string) (*jwt.GenericClaims, error)
- func (s *Store) LoadDefaultEntity(kind string) (*jwt.GenericClaims, error)
- func (s *Store) LoadRootClaim() (*jwt.GenericClaims, error)
- func (s *Store) Read(name ...string) ([]byte, error)
- func (s *Store) ReadAccountClaim(name string) (*jwt.AccountClaims, error)
- func (s *Store) ReadOperatorClaim() (*jwt.OperatorClaims, error)
- func (s *Store) ReadRawAccountClaim(name string) ([]byte, error)
- func (s *Store) ReadRawOperatorClaim() ([]byte, error)
- func (s *Store) ReadRawUserClaim(accountName string, name string) ([]byte, error)
- func (s *Store) ReadUserClaim(accountName string, name string) (*jwt.UserClaims, error)
- func (s *Store) Resolve(name ...string) string
- func (s *Store) StoreClaim(data []byte) (*Report, error)
- func (s *Store) StoreRaw(data []byte) error
- func (s *Store) Write(data []byte, name ...string) error
- type Summarizer
- type WalkFunc
Constants ¶
View Source
const Accounts = "accounts"
View Source
const CredsDir = "creds"
View Source
const CredsExtension = ".creds"
View Source
const Empty = ""
View Source
const KeysDir = "keys"
View Source
const NKeyExtension = ".nk"
View Source
const NKeysPathEnv = "NKEYS_PATH"
View Source
const NSCFile = ".nsc"
View Source
const NoStoreSetError = "no store set"
View Source
const Users = "users"
View Source
const Version = "1"
Variables ¶
View Source
var ErrNoStoreSet = errors.New(NoStoreSetError)
View Source
var ErrNotExist = errors.New("resource does not exist")
View Source
var ErrSkipChildren = errors.New("skip node")
View Source
var ErrStopWalking = errors.New("found node")
View Source
var KeyStorePath string
View Source
var NscNotGitIgnore bool
Functions ¶
func AbbrevHomePaths ¶
func AddGitIgnore ¶
func GetKeyPath ¶
func GetKeysDir ¶
func GetKeysDir() string
func IndentMessage ¶
func IsAccountServerURL ¶ added in v2.8.3
func IsNotExist ¶
func IsOldKeyRing ¶
func IsPublicKey ¶
func IsPublicKey(kind nkeys.PrefixByte, key string) bool
func IsResolverURL ¶ added in v2.8.3
func KeyPairTypeOk ¶
func KeyPairTypeOk(kind nkeys.PrefixByte, kp nkeys.KeyPair) bool
func KeysNeedMigration ¶
func MaybeMakeDir ¶
func NewAccountNotExistErr ¶
func NewOperatorNotExistErr ¶
func NewResourceNotExistErr ¶
func NewUserNotExistErr ¶
func PubKeyType ¶
func PubKeyType(pk string) (nkeys.PrefixByte, error)
func ResolveKey ¶
Resolve a key value provided as a flag - value could be an actual nkey or a path to an nkey
Types ¶
type Context ¶
func (*Context) DefaultUser ¶
Returns an user name for the account if there's only one user
func (*Context) DefaultUserClaim ¶
func (*Context) GetAccountKeys ¶
GetAccountKeys returns the public keys for the named account followed by its signing keys
func (*Context) GetOperatorKeys ¶
GetOperatorKeys returns the public keys for the operator followed by its signing keys
func (*Context) ResolveKey ¶
type IStore ¶ added in v2.8.1
type IStore interface { IsManaged() bool Resolve(name ...string) string Has(name ...string) bool HasAccount(name string) bool Read(name ...string) ([]byte, error) Write(data []byte, name ...string) error Delete(name ...string) error ListSubContainers(name ...string) ([]string, error) ListEntries(name ...string) ([]string, error) StoreClaim(data []byte) (*Report, error) StoreRaw(data []byte) error GetName() string LoadClaim(name ...string) (*jwt.GenericClaims, error) ReadOperatorClaim() (*jwt.OperatorClaims, error) ReadRawOperatorClaim() ([]byte, error) ReadAccountClaim(name string) (*jwt.AccountClaims, error) ReadRawAccountClaim(name string) ([]byte, error) ReadUserClaim(accountName string, name string) (*jwt.UserClaims, error) ReadRawUserClaim(accountName string, name string) ([]byte, error) }
type Info ¶
type KeyStore ¶
type KeyStore struct {
Env string
}
func NewKeyStore ¶
func (*KeyStore) CalcAccountCredsDir ¶
func (*KeyStore) CalcUserCredsPath ¶
func (*KeyStore) GetKeyPath ¶
func (*KeyStore) GetUserCredsPath ¶
func (*KeyStore) HasPrivateKey ¶
func (*KeyStore) MaybeStoreUserCreds ¶
type NKeyFactory ¶
type PrintOption ¶
type PrintOption int
const ( ALL PrintOption = iota DetailsOnly DetailsOnErrorOrWarning )
type Report ¶
type Report struct { Label string StatusCode StatusCode Details []Status Opt PrintOption Data []byte ReportSum bool }
func NewDetailedReport ¶
func NewReport ¶
func NewReport(code StatusCode, format string, args ...interface{}) *Report
func (*Report) AddFromError ¶
func (*Report) AddStatus ¶
func (r *Report) AddStatus(code StatusCode, format string, args ...interface{}) *Report
func (*Report) AddWarning ¶
func (*Report) Code ¶
func (r *Report) Code() StatusCode
func (*Report) HasNoErrors ¶
func (*Report) HasServerMessages ¶
type ResourceErr ¶
func (*ResourceErr) Error ¶
func (e *ResourceErr) Error() string
type ServerMessage ¶
type ServerMessage struct {
SrvMessage string
}
func (*ServerMessage) Code ¶
func (s *ServerMessage) Code() StatusCode
func (*ServerMessage) Format ¶
func (s *ServerMessage) Format(prefix string) string
func (*ServerMessage) Message ¶
func (s *ServerMessage) Message() string
type Status ¶
type Status interface { Code() StatusCode Message() string }
func ErrorStatus ¶
func HoistChildren ¶
func NewServerMessage ¶
func PullAccount ¶
func PullReport ¶
func PushReport ¶
func WarningStatus ¶
type Store ¶
Store is a directory that contains nsc assets
func CreateStore ¶
CreateStore creates a new Store in the specified directory. CreateStore will create the necessary directories and store the public key.
func (*Store) GetContext ¶
func (*Store) GetRootPublicKey ¶
func (*Store) HasAccount ¶
func (*Store) ListSubContainers ¶
func (*Store) LoadDefaultEntity ¶
func (*Store) LoadRootClaim ¶
func (*Store) ReadAccountClaim ¶
func (*Store) ReadOperatorClaim ¶
func (*Store) ReadRawAccountClaim ¶
func (*Store) ReadRawOperatorClaim ¶
func (*Store) ReadRawUserClaim ¶
func (*Store) ReadUserClaim ¶
type Summarizer ¶
Click to show internal directories.
Click to hide internal directories.