Golang key management API server and library, based on SecuritySuite.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

package keystar
import (
"git.destrealm.org/go/keystar/storage"
kt "git.destrealm.org/go/keystar/types"
)
// KeyStar is the primary entrypoint for clients and servers. All KeyStar
// services are based on this client (including the API server), and in-process
// implementations should start here.
type KeyStar struct {
ks *kt.KeySpace
}
func NewKeyStar(options *kt.Options) (*KeyStar, error) {
loader, err := storage.Loader(options)
if err != nil {
return nil, err
}
ks, err := kt.LoadKeySpace(options, loader)
if err != nil {
return nil, err
}
return &KeyStar{ks: ks}, err
}
// KeySpace returns the configured key space for this KeyStar instance.
//
// API fragility warning: Future versions may be able to retain or configure
// multiple KeySpace instances. Do not expect this method to always accept or
// return the same KeySpace for each call. It may eventually require a string
// identifying a symbolic name for any given KeySpace.
func (ks *KeyStar) KeySpace() *kt.KeySpace {
return ks.ks
}
// Options for conveying configuration information to KeyStar.
func NewOptions(backend string) *kt.Options {
return &kt.Options{
BackendURI: backend,
}
}