(ctx context.Context, arg database.UpdateUserSecretByUserIDAndNameParams)
| 915 | } |
| 916 | |
| 917 | func (db *dbCrypt) UpdateUserSecretByUserIDAndName(ctx context.Context, arg database.UpdateUserSecretByUserIDAndNameParams) (database.UserSecret, error) { |
| 918 | if arg.UpdateValue { |
| 919 | if err := db.encryptField(&arg.Value, &arg.ValueKeyID); err != nil { |
| 920 | return database.UserSecret{}, err |
| 921 | } |
| 922 | } |
| 923 | secret, err := db.Store.UpdateUserSecretByUserIDAndName(ctx, arg) |
| 924 | if err != nil { |
| 925 | return database.UserSecret{}, err |
| 926 | } |
| 927 | if err := db.decryptField(&secret.Value, secret.ValueKeyID); err != nil { |
| 928 | return database.UserSecret{}, err |
| 929 | } |
| 930 | return secret, nil |
| 931 | } |
| 932 | |
| 933 | func (db *dbCrypt) encryptField(field *string, digest *sql.NullString) error { |
| 934 | // If no cipher is loaded, then we can't encrypt anything! |
nothing calls this directly
no test coverage detected