Skip to main content

Crate proton_drive_rs

Crate proton_drive_rs 

Source
Expand description

High-level Proton Drive client (Rust port).

Built on top of proton_sdk. Milestone 1 covers session-backed read operations: resolving the My Files folder, fetching node metadata and enumerating folder children.

use proton_sdk::config::ProtonClientConfiguration;
use proton_sdk::session::{PasswordMode, ProtonApiSession, ResumeParameters};
use proton_drive_rs::ProtonDriveClient;

let config = ProtonClientConfiguration::new("external-drive-myapp@0.1.0-alpha");
let session = ProtonApiSession::resume(config, ResumeParameters {
    session_id: "uid".into(),
    username: "user@proton.me".into(),
    user_id: "user-id".into(),
    access_token: "access".into(),
    refresh_token: "refresh".into(),
    scopes: vec![],
    is_waiting_for_second_factor_code: false,
    password_mode: PasswordMode::Single,
})?;

let drive = ProtonDriveClient::new(&session, b"mailbox-password".to_vec());
let root = drive.get_my_files_folder().await?;
let child_uids = drive.enumerate_folder_children_node_uids(&root.uid).await?;
for child in drive.enumerate_nodes(&child_uids).await? {
    println!("{} ({:?})", child.name, child.kind);
}

Re-exports§

pub use proton_sdk;

Structs§

Bookmark
A public link the user has saved to their account (“bookmark”). Opening it visits the public URL; there is no local copy.
CachedNodeInfo
A cached node plus the two derived values that node-mutating operations (move / rename) would otherwise recompute from the decrypted name.
Device
A registered device. Mirrors C# Device.
DriveEntityCache
Typed entity cache over a shared CacheRepository. Cloning shares the underlying store.
DriveEventScopeId
Identifies an event scope to enumerate. C# DriveEventScopeId.
EncryptedCacheRepository
At-rest-encryption wrapper around any CacheRepository. Mirrors C# EncryptedCacheRepository.
ExternalInvitation
A pending invitation to a non-Proton email address. The invitee must sign up before the share can be finalized; until then it lives as an external invite.
InMemoryCacheRepository
Thread-safe in-memory CacheRepository. Mirrors C# InMemoryCacheRepository.
IncomingInvitation
An invitation addressed to the current user (shared with me), pending accept or reject. The invitation_id is the handle for accept_invitation and reject_invitation.
KeySalt
A per-key bcrypt salt from core/v4/keys/salts.
Node
A decrypted Drive node (folder or file).
PhotoUploadMetadata
Caller-supplied metadata for a photo upload. Mirrors C# PhotosFileUploadMetadata: all fields are optional. capture_time defaults to the upload time when unset; main_photo_uid links a related photo (live/burst) to its main photo; tags classify the photo.
PhotosTimelineItem
One photos-timeline entry: a photo node and its capture time (epoch seconds). C# PhotosTimelineItem(NodeUid Uid, DateTime CaptureTime).
ProtonDriveClient
High-level Proton Drive client.
ProtonPhotosClient
High-level Proton Photos client.
PublicLink
A public share link on a node.
ShareInvitation
A pending invitation to a Proton user (not yet accepted).
ShareMember
A member of a share (an invitation that has been accepted).
Thumbnail
A caller-supplied, already-rendered thumbnail to attach to an upload.

Enums§

DeviceType
The platform a device runs on. Mirrors C# DeviceType; the discriminant is the wire value.
DriveEvent
A remote data-update event in a volume’s event scope.
ExternalInvitationState
State of an external (non-Proton) invitation.
MemberRole
A sharing permission role. The wire form is a permissions bitmask (Read = 4, Write = 2, Admin = 16); Proton only uses three combinations.
NodeKind
Folder- or file-specific node data.
PhotoTag
Photo classification tags. C# Proton.Drive.Sdk.Nodes.PhotoTag.
RevisionState
The state of a file revision. Mirrors C# Proton.Drive.Sdk.Nodes.RevisionState (the wire ApiRevisionState also has a Draft = 0 that never surfaces on a node’s active revision).
ThumbnailType
The kind of a thumbnail. Mirrors C# Proton.Drive.Sdk.Nodes.ThumbnailType.

Traits§

CacheRepository
A string key/value cache with secondary tag indexing.