fix: write SecureNote (camelCase secureNote sub-object per Vaultwarden API)
CI / test (push) Has been cancelled
CI / docker (push) Has been cancelled

Vaultwarden post_ciphers expects type=2 data in 'secureNote' field
(camelCase serde), not 'notes'/'secure_note'. Verified end-to-end:
SecureNote create + read works; Login write unchanged.
This commit is contained in:
Hermes committed 2026-08-02 19:04:33 +02:00
1 parent b92880d515
commit b48cb16746
1 file changed
+11 -1
+11 -1
View File
@@ -837,7 +837,13 @@ func (ac *APIClient) CreateCipher(in CipherInput) (string, error) {
cipher["fields"] = fields
}
} else if in.Type == CipherTypeSecureNote {
// notes already set
// Vaultwarden expects type=2 data in the `secureNote` sub-object (camelCase serde).
if in.Notes != "" {
encNotes, e := EncryptStr(in.Notes, key)
if e == nil {
cipher["secureNote"] = map[string]interface{}{"notes": encNotes}
}
}
} else {
return "", fmt.Errorf("cipher type %d write not supported yet", in.Type)
}
@@ -853,6 +859,10 @@ func (ac *APIClient) CreateCipher(in CipherInput) (string, error) {
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Bitwarden-Client-Version", "2024.1.0")
req.Header.Set("User-Agent", "Bitwarden/v2024.1.0")
req.Header.Set("Device-Type", "8")
req.Header.Set("Accept", "application/json")
resp, err := ac.httpClient.Do(req)
if err != nil {