9 Commits
Author SHA1 Message Date
nvrl a93d571603 feat(sdk): sign-in state machine, resume parameters, public link parser
Move the sign-in sequence the apps shared through proton-auth-rs into
proton_sdk::login: begin -> Step::{SecondFactor, MailboxPassword, Unlock},
retryable unlock by reference, and LoginError for the cases a frontend
acts on (CAPTCHA, security-key-only, blocked, refused, wrong code, wrong
mailbox password).

Also public: ProtonApiSession::resume_parameters(_with), PasswordMode
from_wire/to_wire, HumanVerification::token_from_message and
proton_drive_rs::parse_public_link_url (now ignoring whitespace and a
query string). ResumeParameters' Debug hides the tokens.
2026-11-20 17:05:57 +01:00
nvrl 98e214ecfe fix(crypto): date new node keys with the server's clock
Proton's servers ignore a key's self-signatures when they are dated after
the server's own clock. rPGP dates generated keys and their self-signatures
with the device clock, so a phone running a few seconds fast created node
keys without a usable encryption subkey, and every new file or photo failed
with 422 "Could not verify the nodeKey was used for encrypting
contentKeyPacket" (code 200501).

ApiHttpClient now records the server time from each response's Date header,
and node keys, their subkeys and their certification and binding signatures
are dated with it, as the C# SDK's CryptographyTimeProvisionHandler does.
Before the first response the device clock is used.
2026-11-17 23:54:42 +01:00
nvrl a017dca000 fix(drive)!: tolerate null duplicate hashes, clean up failed drafts
The photo duplicates endpoint sends Hash and ContentHash as null for a
draft left by an interrupted upload. The fields were String with
serde(default), which only covers a missing key, so one draft failed
every duplicate check. That broke resuming a Google Takeout import in
proton-drive-linux (issue 94 there). Drafts, trashed links and
candidates without hashes are now skipped, as in the TypeScript SDK.
Defaulted DTO fields read an explicit null as their default.

A new file or photo whose upload fails deletes its draft, as C# and TS
do. After a failed seal only a non-retriable API rejection is cleaned
up, because a seal lost in transit may have been applied.

Photo uploads gain replace_existing_draft (C#
overrideExistingDraftByOtherClient) and location, written to the
Location extended attribute. Undecodable responses log their path.

BREAKING CHANGE: PhotoUploadMetadata has the fields
replace_existing_draft and location; FoundPhotoDuplicateDto hashes are
Option<String>; ExtendedAttributes has location.
2026-11-15 16:13:59 +01:00
nvrl 7ac5b485d7 feat(drive)!: preserve modification time offsets
Port upstream 271f64e4. Folder creation and streaming file/revision
uploads retain the UTC offset and fractional seconds in encrypted
attributes. Downloaded claimed timestamps stay verbatim strings.

PhotoUploadMetadata has a separate last_modification_time; capture_time
no longer supplies it. Reconcile the remaining upstream commits and pin
to 05c91159.

BREAKING CHANGE: modification-time inputs take Option<ModificationTime>
(DateTime<FixedOffset>) instead of epoch seconds. Photo metadata literals
need the new field or Default; set both times to preserve the former
capture-time fallback.
2026-11-05 17:17:13 +01:00
nvrl 48dd410e41 chore(VER) bumped to 0.10.1 2026-10-31 13:27:43 +01:00
nvrl fe42f6c972 fix(account): open address tokens with inactive account keys, skip a broken address
An address key's token was decrypted with the active account keys only.
A token encrypted to an account key that is now inactive never opened,
although that key still opens with the password, so the address failed
with "has no primary key". proton-drive-linux issue #40 shows this as a
mount that retries "missing key" forever. Tokens are now tried with
every account key that opens, active ones first; signing still uses
active keys only. The key report walks the same chain.

addresses() also failed as a whole when one address did not open. That
address is now left out with a warning and the rest work; the call fails
only when none opens. address_private_keys and the new address(id) name
the reason for a left-out address, and default_address fails with it
when the left-out address is the default rather than signing with
another one.
2026-10-31 13:07:09 +01:00
nvrl 5c29ef88fc chore(VER) bumped to 0.10.0 2026-10-26 16:57:50 +01:00
nvrl 2c5d62e9cf feat(sharing): expose a public link's custom password
get_public_link recovers the custom password along with the URL fragment,
so a caller can keep it while update_public_link changes the role or the
expiry. Debug for PublicLink and Bookmark redacts the URL and the custom
password.
2026-10-25 22:01:13 +01:00
nvrl 781301a77b feat(sharing,public-link): update public links, name bookmarks, walk shared trees
- update_public_link sets the role, custom password and expiry of a node's
  public link and keeps its URL (TS updateSharedLink). Create and update
  share the sealing of the share key and SRP verifier.
- list_bookmarks decrypts the bookmarked item's name with the share key the
  stored password unlocks, and returns the custom password in the new
  Bookmark::custom_password. The URL fragment is now only the generated
  password.
- ProtonDrivePublicLinkClient::enumerate_subtree walks a shared folder
  breadth first, several folders of a level at a time.
- Add CHANGELOG.md, update the README feature table for this and the
  previous unreleased commits, and record the TS ports in UPSTREAM_SYNC.
2026-10-25 21:27:05 +01:00