createVaultKey creates a new RSA-4096 Vault key using the data from the provided MasterKey.
(key *MasterKey)
| 527 | // createVaultKey creates a new RSA-4096 Vault key using the data from the |
| 528 | // provided MasterKey. |
| 529 | func 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 | |
| 546 | func TestAllowlistParse(t *testing.T) { |
| 547 | t.Run("success", func(t *testing.T) { |
no test coverage detected