(res []*database.ProjectVariable)
| 3886 | } |
| 3887 | |
| 3888 | func (c *connection) decryptProjectVariables(res []*database.ProjectVariable) error { |
| 3889 | for _, v := range res { |
| 3890 | if v.ValueEncryptionKeyID == "" { |
| 3891 | continue |
| 3892 | } |
| 3893 | dec, err := base64.StdEncoding.DecodeString(v.Value) |
| 3894 | if err != nil { |
| 3895 | return err |
| 3896 | } |
| 3897 | |
| 3898 | decryptedValue, err := c.decrypt(dec, v.ValueEncryptionKeyID) |
| 3899 | if err != nil { |
| 3900 | return err |
| 3901 | } |
| 3902 | |
| 3903 | v.Value = string(decryptedValue) |
| 3904 | } |
| 3905 | return nil |
| 3906 | } |
| 3907 | |
| 3908 | // returns the encrypted text and the encryption key id used. The first key in the keyring is used for encryption. If the keyring is empty, the text is returned as is along with an empty key id. |
| 3909 | func (c *connection) encrypt(text []byte) ([]byte, string, error) { |
no test coverage detected