22 Commits
Author SHA1 Message Date
nvrl 45d2c5326b perf(drive): read a folder's hash key once, and check a revision's base for free (0.12.8)
Every upload into a folder read the folder's link again for the key that
hashes its children's names. The key is now cached next to the folder's node
key and dropped with it on the folder's events.

upload_new_revision_over uploads a revision only over the revision the caller
expects. It answers Moved or Trashed, sending nothing, when the file moved on
or is in the trash. The check uses the read of the file's link the upload
needs for its keys, so a caller that read the file itself first can drop that
read.

The revision history live test told the superseded revisions apart by
creation time. Small revisions can land within one second, so it now tells
them apart by size.
2026-11-28 00:49:30 +01:00
nvrl 7d9437236c feat(drive): send small streamed uploads in one request
The streaming upload calls now pick the files/small or revisions/small endpoint when small uploads are on and the content, with its thumbnails, fits the 128 KiB budget. They read up to the budget plus one byte ahead to decide, and send a longer reader through the block path whole. The small request now carries thumbnails, the modification time and the AEAD choice of a new file, and returns the sealed revision, as upstream's does. Upload telemetry names the path taken.
2026-11-27 23:44:41 +01:00
nvrl e33cd81b5b feat(drive): return the sealed revision from uploads (0.12.7)
Add upload_file_replacing_draft_sealed and upload_new_revision_sealed.
They return a SealedUpload with the file's uid and the id of the
revision they sealed. Drive often does not list a node made a moment
ago, so reading the file back to learn the id often got nothing.

Sealing a revision now also drops the file's node from the entity
cache. Before, get_node kept reporting the replaced revision as active
until a Drive event invalidated it.
2026-11-25 15:07:40 +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 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
nvrl 3da18b9309 feat(photos): port the C# album capabilities
Ports upstream a36cc423. add_photos_to_album now uses the timeline
transfer driver, generalised over a PhotoTransferTarget. A photo on
another volume, from an album shared with us, is copied into the album
instead of failing. A photo whose group the server reports incomplete
is sent once more with the related photos it named. Outcomes stay in
input order.

New set_album_cover, and delete_album_saving_photos, which saves the
photos that exist only in the album (code 200302, now
AlbumContainsPhotosNotInTimeline) before deleting it.
remove_photos_from_album fails a photo on another volume without
sending it. AlbumUpdateRequest leaves out a missing cover or name, as
C# does.

Pins upstream to b68d64bd. The search commit e861ef99 is not ported:
its engine source is not public.
2026-10-25 20:48:22 +01:00
nvrl c30b107382 feat(drive): copy a node on the server
ProtonDriveClient::copy_node copies a file with its content, or a folder
with its subtree, under a new parent without downloading it, ported from
the TS SDK's copyNode (POST volumes/{vid}/links/{lid}/copy). The crypto
is the move's: the passphrase is rewrapped to the new parent, so the
node and content keys stay the same, and the name is encrypted and
signed to it. An optional name renames the copy.

The new parent may be on another volume, and the returned uid takes the
target's volume, where TS uses the source's. CopyPhotoResponse is now
the shared CopyLinkResponse.

UPSTREAM_SYNC.md logs this, get_folder_size and the read retries.
2026-10-25 20:37:51 +01:00
nvrl 8611989364 feat(drive): report a folder's size from the server
ProtonDriveClient::get_folder_size returns the total size and number of
a folder's descendants without walking the tree, ported from the TS
SDK's getFolderSize (GET volumes/{vid}/folders/{lid}/calculate-
descendents-size). Trashed descendants and folders count, and the size
is encrypted bytes on storage; the live test pins both, which the TS
docs leave open.
2026-10-25 20:33:29 +01:00
nvrl 1b8abf70f8 feat(drive): port upstream C# SDK up to 8ffae007
Port af391cbb (require node type for getting an available name);
c6b45188 (file-backed transfer buffers) is C# memory plumbing and a
no-op here.

- get_available_name takes an AvailableNameTarget. A file keeps its
  extension last (name (1).ext); a folder appends to the whole name
  (name (1)), so a folder named v1.2 no longer resolves to v1 (1).2.
- Split alternate_names into alternate_file_names and
  alternate_folder_names, mirroring AlternateFileNameGenerator.

Breaking: get_available_name gains a parameter.
2026-10-15 19:50:17 +02:00
nvrl 1477fe85d5 fix(drive): give each share root its own parent key in batch enumeration
enumerate_nodes and enumerate_nodes_light cached parent keys per batch by
the link's parent id. Every parentless link in a volume landed on None, so
when several share roots were enumerated together, the first root's share
key was used for the rest and they were dropped with "missing key".

Name a parent key by where it comes from: Parent(folder) for a link with a
parent, Root(link) for a parentless one. The batch cache and the
parent-key single-flight now both use that identity. The single-flight
previously keyed a root and its children on the same link id, although a
root resolves to its share key and its children to its node key, so two
concurrent cold loads could hand one of them the wrong key.

Fixes #2
2026-10-01 18:06:58 +02:00
nvrl e378db6ec8 implemented enumeration for drive 2026-08-10 14:10:43 +02:00
nvrl 4fe7f02ebb version 0.4.0 2026-08-03 00:18:39 +02:00
nvrl 9dd535b374 improved performance, concurrent upload, version 0.2.0 2026-07-24 20:29:15 +02:00
nvrl 24a99e6b9a public link consume, revision history, path helpers
Public links (public_link.rs, ported from the TS SDK — the C# SDK has no
equivalent): ProtonDrivePublicLinkClient lets a visitor with no Proton
account open someone else's share link. `info` reads pre-auth metadata,
`open` runs the SRP handshake against drive/urls/{token}/info + /auth and
unlocks the share key (bcrypt SharePasswordSalt -> key password -> the
SKESK'd SharePassphrase -> ShareKey). The read surface then reuses the
ordinary link/children/revision endpoints. Signature verification is
deliberately absent: an anonymous visitor cannot read core/v4/keys/all,
matching the TS SDK. Supporting primitives: http::get_unauthenticated and
crypto::decrypt_armored_with_password.

Revision history: enumerate_revisions / get_revision / restore_revision /
delete_revision, plus open_revision_at / download_revision{,_to} to read a
specific revision. Drafts are filtered on the wire value, since
RevisionState::from_raw maps 0 to Active. Three server behaviors found
live and worked around: ?NoBlockUrls=true still emits Blocks with null
BareURL, so get_revision deserializes into a DTO without that field; the
restore POST needs an empty object body, not null; and restore is async
(HTTP 202, non-1000 envelope) so the new active revision is not live on
return.

Path and hierarchy helpers: get_node_hierarchy, get_node_path,
get_node_by_path, create_folder_path. Names are encrypted and there is no
name-query endpoint, so lookup walks and decrypts one directory level per
segment.

Fix a silent-corruption path in block-size resolution. RevisionReader
accumulates block sizes to derive where each block starts in the
plaintext, so a vector that overstates any block but the last shifts every
block after it and the reader splices at the wrong offsets — full-length
reads of the wrong bytes, no error raised. resolve_block_sizes previously
guessed all-full blocks when both Common.BlockSizes and Common.Size were
unusable. It now errors for multi-block files and only assumes a full
block when there is exactly one (which cannot be misaligned). Regression
test in revision.rs::padded_block_sizes_shift_later_blocks.

Recover from stale upload drafts. An upload interrupted after the draft
node was created but before it was sealed leaves an unsealed draft, and
every later attempt at that name returns 422 AlreadyExists forever. Draft
creation now deletes the conflicting node and retries when the conflict is
an unsealed draft; by default only our own client's, with
upload_file_replacing_draft_from opting into any client's to recover
across a daemon restart (which rotates our client uid). A committed file
of that name is never touched.

Live tests for the public-link round trip, custom-password links, revision
history, and the path helpers.
2026-07-19 13:17:30 +02:00
nvrl 0a15a8c86e revision handler, parallel block download + gzip 2026-07-17 15:57:00 +02:00
nvrl 64f977edb3 feature (devices+sharing) + upgraded rand and aeds 2026-07-15 19:34:40 +02:00
nvrl 0d07fdb084 added device support 2026-07-10 15:59:56 +02:00
nvrl 800fe7b612 added ci 2026-06-30 04:26:37 +02:00
nvrl f702e56110 clippy + fmt 2026-06-30 03:29:40 +02:00
nvrl c7e8467fe2 added range + live test 2026-06-28 16:14:37 +02:00
nvrl 643f5a2c3b renamed for crate 2026-06-28 11:47:54 +02:00