mirror of
https://github.com/kopia/kopia.git
synced 2026-03-19 22:56:29 -04:00
21 lines
440 B
Go
21 lines
440 B
Go
package auth
|
|
|
|
import "fmt"
|
|
|
|
type masterKeyCredentials struct {
|
|
key []byte
|
|
}
|
|
|
|
func (mkc *masterKeyCredentials) GetMasterKey(f SecurityOptions) ([]byte, error) {
|
|
return mkc.key, nil
|
|
}
|
|
|
|
// MasterKey returns master key-based Credentials with the specified key.
|
|
func MasterKey(key []byte) (Credentials, error) {
|
|
if len(key) < MinMasterKeyLength {
|
|
return nil, fmt.Errorf("master key too short")
|
|
}
|
|
|
|
return &masterKeyCredentials{key}, nil
|
|
}
|