Documentation ¶
Index ¶
- func CreateMockAESGCMKeyHandle() (*keyset.Handle, error)
- func CreateMockED25519KeyHandle() (*keyset.Handle, error)
- type KeyManager
- func (k *KeyManager) Create(kt kmsservice.KeyType) (string, interface{}, error)
- func (k *KeyManager) CreateAndExportPubKeyBytes(kt kmsservice.KeyType) (string, []byte, error)
- func (k *KeyManager) ExportPubKeyBytes(keyID string) ([]byte, error)
- func (k *KeyManager) Get(keyID string) (interface{}, error)
- func (k *KeyManager) ImportPrivateKey(privKey interface{}, keyType kmsservice.KeyType, ...) (string, interface{}, error)
- func (k *KeyManager) PubKeyBytesToHandle(pubKey []byte, keyType kmsservice.KeyType) (interface{}, error)
- func (k *KeyManager) Rotate(kt kmsservice.KeyType, keyID string) (string, interface{}, error)
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMockAESGCMKeyHandle ¶
CreateMockAESGCMKeyHandle is a utility function that returns a mock key (for tests only, not registered in Tink).
func CreateMockED25519KeyHandle ¶
CreateMockED25519KeyHandle is a utility function that returns a mock key (for tests only, not registered in Tink).
Types ¶
type KeyManager ¶
type KeyManager struct { CreateKeyID string CreateKeyValue *keyset.Handle CreateKeyErr error GetKeyValue *keyset.Handle GetKeyErr error RotateKeyID string RotateKeyValue *keyset.Handle RotateKeyErr error ExportPubKeyBytesErr error ExportPubKeyBytesValue []byte CrAndExportPubKeyValue []byte CrAndExportPubKeyID string CrAndExportPubKeyErr error PubKeyBytesToHandleErr error PubKeyBytesToHandleValue *keyset.Handle ImportPrivateKeyErr error ImportPrivateKeyID string ImportPrivateKeyValue *keyset.Handle }
KeyManager mocks a local Key Management Service + ExportableKeyManager.
func (*KeyManager) Create ¶
func (k *KeyManager) Create(kt kmsservice.KeyType) (string, interface{}, error)
Create a new mock ey/keyset/key handle for the type kt.
func (*KeyManager) CreateAndExportPubKeyBytes ¶
func (k *KeyManager) CreateAndExportPubKeyBytes(kt kmsservice.KeyType) (string, []byte, error)
CreateAndExportPubKeyBytes return a mocked kid and []byte public key.
func (*KeyManager) ExportPubKeyBytes ¶
func (k *KeyManager) ExportPubKeyBytes(keyID string) ([]byte, error)
ExportPubKeyBytes will return a mocked []bytes public key.
func (*KeyManager) Get ¶
func (k *KeyManager) Get(keyID string) (interface{}, error)
Get a mock key handle for the given keyID.
func (*KeyManager) ImportPrivateKey ¶
func (k *KeyManager) ImportPrivateKey(privKey interface{}, keyType kmsservice.KeyType, opts ...kmsservice.PrivateKeyOpts) (string, interface{}, error)
ImportPrivateKey will emulate importing a private key and returns a mocked keyID, private key handle.
func (*KeyManager) PubKeyBytesToHandle ¶
func (k *KeyManager) PubKeyBytesToHandle(pubKey []byte, keyType kmsservice.KeyType) (interface{}, error)
PubKeyBytesToHandle will return a mocked keyset.Handle representing a public key handle.
func (*KeyManager) Rotate ¶
func (k *KeyManager) Rotate(kt kmsservice.KeyType, keyID string) (string, interface{}, error)
Rotate returns a mocked rotated keyset handle and its ID.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider provides mock Provider implementation.
func NewProviderForKMS ¶
func NewProviderForKMS(storeProvider storage.Provider, secretLock secretlock.Service) *Provider
NewProviderForKMS creates a new mock Provider to create a KMS.
func (*Provider) SecretLock ¶
func (p *Provider) SecretLock() secretlock.Service
SecretLock returns a secret lock service.
func (*Provider) StorageProvider ¶
StorageProvider return a storage provider.