MCPcopy
hub / github.com/getsops/sops / createVaultKey

Function createVaultKey

hcvault/keysource_test.go:529–544  ·  view source on GitHub ↗

createVaultKey creates a new RSA-4096 Vault key using the data from the provided MasterKey.

(key *MasterKey)

Source from the content-addressed store, hash-verified

527// createVaultKey creates a new RSA-4096 Vault key using the data from the
528// provided MasterKey.
529func createVaultKey(key *MasterKey) error {
530 client, err := vaultClient(key.VaultAddress, key.token, nil)
531 if err != nil {
532 return fmt.Errorf("cannot create Vault client: %w", err)
533 }
534
535 p := path.Join(key.EnginePath, "keys", key.KeyName)
536 payload := make(map[string]interface{})
537 payload["type"] = "rsa-4096"
538 if _, err = client.Logical().Write(p, payload); err != nil {
539 return err
540 }
541
542 _, err = client.Logical().Read(p)
543 return err
544}
545
546func TestAllowlistParse(t *testing.T) {
547 t.Run("success", func(t *testing.T) {

Callers 4

TestMasterKey_EncryptFunction · 0.85
TestMasterKey_DecryptFunction · 0.85

Calls 1

vaultClientFunction · 0.85

Tested by

no test coverage detected