Files
gitea/services/secrets/masterkey_nop.go
2022-12-02 22:25:31 +08:00

42 lines
1008 B
Go

// Copyright 2021 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package secrets
type nopMasterKeyProvider struct{}
// NewNopMasterKeyProvider returns master key provider that holds no master key and is always unsealed
func NewNopMasterKeyProvider() MasterKeyProvider {
return &nopMasterKeyProvider{}
}
// Init initializes master key provider
func (k *nopMasterKeyProvider) Init() error {
return nil
}
// GenerateMasterKey always returns empty master key
func (k *nopMasterKeyProvider) GenerateMasterKey() ([][]byte, error) {
return nil, nil
}
// Unseal master key by providing unsealing secret
func (k *nopMasterKeyProvider) Unseal(secret []byte) error {
return nil
}
// Seal master key
func (k *nopMasterKeyProvider) Seal() error {
return nil
}
// IsSealed always returns false
func (k *nopMasterKeyProvider) IsSealed() bool {
return false
}
// GetMasterKey returns empty master key
func (k *nopMasterKeyProvider) GetMasterKey() ([]byte, error) {
return nil, nil
}