macaroons: add SetRootKey method
This adds a SetRootKey method which can be used to set the default macaroon root key to a specified value.
This commit is contained in:
3 files changed
+77
No files matched your search
@@ -68,6 +68,10 @@ type ExtendedRootKeyStore interface {
|
||||
// GenerateNewRootKey calls the underlying root key store's
|
||||
// GenerateNewRootKey and returns the result.
|
||||
GenerateNewRootKey() error
|
||||
|
||||
// SetRootKey calls the underlying root key store's SetRootKey and
|
||||
// returns the result.
|
||||
SetRootKey(rootKey []byte) error
|
||||
}
|
||||
|
||||
// Service encapsulates bakery.Bakery and adds a Close() method that zeroes the
|
||||
@@ -300,6 +304,16 @@ func (svc *Service) GenerateNewRootKey() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetRootKey calls the underlying root key store's SetRootKey and returns the
|
||||
// result.
|
||||
func (svc *Service) SetRootKey(rootKey []byte) error {
|
||||
if boltRKS, ok := svc.rks.(ExtendedRootKeyStore); ok {
|
||||
return boltRKS.SetRootKey(rootKey)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ChangePassword calls the underlying root key store's ChangePassword and
|
||||
// returns the result.
|
||||
func (svc *Service) ChangePassword(oldPw, newPw []byte) error {
|
||||
|
||||
Reference in new issue
Block a user