Documentation
¶
Overview ¶
Package keys provides APIs to manage configured keys and load them into an SSH agent.
Index ¶
- type ConfiguredKey
- type DefaultManager
- func (m *DefaultManager) Add(ctx jsutil.AsyncContext, name string, pemPrivateKey string) error
- func (m *DefaultManager) Configured(ctx jsutil.AsyncContext) ([]*ConfiguredKey, error)
- func (m *DefaultManager) Load(ctx jsutil.AsyncContext, id ID, passphrase string) error
- func (m *DefaultManager) LoadFromSession(ctx jsutil.AsyncContext) error
- func (m *DefaultManager) Loaded(ctx jsutil.AsyncContext) ([]*LoadedKey, error)
- func (m *DefaultManager) Remove(ctx jsutil.AsyncContext, id ID) error
- func (m *DefaultManager) Unload(ctx jsutil.AsyncContext, id ID) error
- type ID
- type LoadedKey
- type Manager
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfiguredKey ¶
type ConfiguredKey struct {
// Id is the unique ID for this key.
ID string `js:"id"`
// Name is a name allocated to key.
Name string `js:"name"`
// Encrypted indicates if the key is encrypted and requires a passphrase
// to load.
Encrypted bool `js:"encrypted"`
}
ConfiguredKey is a key configured for use.
type DefaultManager ¶ added in v0.0.20
type DefaultManager struct {
// contains filtered or unexported fields
}
DefaultManager is an implementation of Manager.
func NewManager ¶
func NewManager(agt agent.Agent, syncStorage, sessionStorage storage.Area) *DefaultManager
NewManager returns a Manager implementation that can manage keys in the supplied agent, and store configured keys in the supplied storage.
func (*DefaultManager) Add ¶ added in v0.0.20
func (m *DefaultManager) Add(ctx jsutil.AsyncContext, name string, pemPrivateKey string) error
Add implements Manager.Add.
func (*DefaultManager) Configured ¶ added in v0.0.20
func (m *DefaultManager) Configured(ctx jsutil.AsyncContext) ([]*ConfiguredKey, error)
Configured implements Manager.Configured.
func (*DefaultManager) Load ¶ added in v0.0.20
func (m *DefaultManager) Load(ctx jsutil.AsyncContext, id ID, passphrase string) error
Load implements Manager.Load.
func (*DefaultManager) LoadFromSession ¶ added in v0.0.20
func (m *DefaultManager) LoadFromSession(ctx jsutil.AsyncContext) error
LoadFromSession loads all keys for the current session into the agent.
func (*DefaultManager) Loaded ¶ added in v0.0.20
func (m *DefaultManager) Loaded(ctx jsutil.AsyncContext) ([]*LoadedKey, error)
Loaded implements Manager.Loaded.
func (*DefaultManager) Remove ¶ added in v0.0.20
func (m *DefaultManager) Remove(ctx jsutil.AsyncContext, id ID) error
Remove implements Manager.Remove.
func (*DefaultManager) Unload ¶ added in v0.0.20
func (m *DefaultManager) Unload(ctx jsutil.AsyncContext, id ID) error
Unload implements Manager.Unload.
type ID ¶
type ID string
ID is a unique identifier for a configured key.
const ( // InvalidID is a special ID that will not be assigned to any key. InvalidID ID = "" )
type LoadedKey ¶
type LoadedKey struct {
// Type is the type of key loaded in the agent (e.g., 'ssh-rsa').
Type string `js:"type"`
// InternalBlob is the public key material for the loaded key. Must
// be exported to be handled correctly in conversion to/from js.Value.
InternalBlob string `js:"blob"`
// Comment is a comment for the loaded key.
Comment string `js:"comment"`
}
LoadedKey is a key loaded into the agent.
type Manager ¶
type Manager interface {
// Configured returns the full set of keys that are configured.
Configured(ctx jsutil.AsyncContext) ([]*ConfiguredKey, error)
// Add configures a new key. name is a human-readable name describing
// the key, and pemPrivateKey is the PEM-encoded private key.
Add(ctx jsutil.AsyncContext, name string, pemPrivateKey string) error
// Remove removes the key with the specified ID.
//
// Note that it might be nice to return an error here, but
// the underlying Chrome APIs don't make it trivial to determine
// if the requested key was removed, or ignored because it didn't
// exist. This could be improved, but it doesn't seem worth it at
// the moment.
Remove(ctx jsutil.AsyncContext, id ID) error
// Loaded returns the full set of keys loaded into the agent.
Loaded(ctx jsutil.AsyncContext) ([]*LoadedKey, error)
// Load loads a new key into to the agent, using the passphrase to
// decrypt the private key.
//
// NOTE: Unencrypted private keys are not currently supported.
Load(ctx jsutil.AsyncContext, id ID, passphrase string) error
// Unload unloads a key from the agent.
Unload(ctx jsutil.AsyncContext, id ID) error
}
Manager provides an API for managing configured keys and loading them into an SSH agent.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server exposes a Manager instance via a messaging API so that a shared instance can be invoked from a different page.