diff --git a/internal/vaultwarden/api_client.go b/internal/vaultwarden/api_client.go index fc8d52a..db61425 100644 --- a/internal/vaultwarden/api_client.go +++ b/internal/vaultwarden/api_client.go @@ -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 {