10 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 e378db6ec8 implemented enumeration for drive 2026-08-10 14:10:43 +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 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