Files
kopia/auth/master_key_creds.go
2017-08-01 17:47:28 +02:00

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
}