mirror of
https://github.com/narrrl/proton-sdk-rs.git
synced 2026-11-04 17:06:59 +01:00
renamed for crate
This commit is contained in:
1 parent
c98ec2d55d
commit
643f5a2c3b
19 files changed
+30
-30
No files matched your search
Generated
+1
-1
@@ -1873,7 +1873,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proton-drive-sdk"
|
name = "proton-drive-rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = ["crates/proton-sdk", "crates/proton-drive-sdk"]
|
members = ["crates/proton-sdk", "crates/proton-drive-rs"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ All crypto paths have offline round-trip tests, and the read/write surface
|
|||||||
(upload/download round-trips, AEAD + streaming + thumbnails, enumeration,
|
(upload/download round-trips, AEAD + streaming + thumbnails, enumeration,
|
||||||
folder/node ops, move, and the event feed) is covered by a **live integration
|
folder/node ops, move, and the event feed) is covered by a **live integration
|
||||||
test suite** validated against a real Proton account — see
|
test suite** validated against a real Proton account — see
|
||||||
`crates/proton-drive-sdk/tests/live_*.rs`.
|
`crates/proton-drive-rs/tests/live_*.rs`.
|
||||||
|
|
||||||
## Workspace
|
## Workspace
|
||||||
|
|
||||||
| Crate | Purpose |
|
| Crate | Purpose |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `crates/proton-sdk` | Core account/session/crypto (`Proton.Sdk` analogue) |
|
| `crates/proton-sdk` | Core account/session/crypto (`Proton.Sdk` analogue) |
|
||||||
| `crates/proton-drive-sdk` | High-level Drive client (`Proton.Drive.Sdk` analogue) |
|
| `crates/proton-drive-rs` | High-level Drive client (`Proton.Drive.Sdk` analogue) |
|
||||||
|
|
||||||
OpenPGP is provided by the [`pgp`](https://crates.io/crates/pgp) crate (rPGP 0.16).
|
OpenPGP is provided by the [`pgp`](https://crates.io/crates/pgp) crate (rPGP 0.16).
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ SRP login (with 2FA), then read the my-files root:
|
|||||||
```rust,no_run
|
```rust,no_run
|
||||||
use proton_sdk::config::ProtonClientConfiguration;
|
use proton_sdk::config::ProtonClientConfiguration;
|
||||||
use proton_sdk::session::ProtonApiSession;
|
use proton_sdk::session::ProtonApiSession;
|
||||||
use proton_drive_sdk::ProtonDriveClient;
|
use proton_drive_rs::ProtonDriveClient;
|
||||||
|
|
||||||
async fn run() -> proton_sdk::error::Result<()> {
|
async fn run() -> proton_sdk::error::Result<()> {
|
||||||
let config = ProtonClientConfiguration::new("external-drive-myapp@0.1.0-alpha");
|
let config = ProtonClientConfiguration::new("external-drive-myapp@0.1.0-alpha");
|
||||||
@@ -99,12 +99,12 @@ async fn run() -> proton_sdk::error::Result<()> {
|
|||||||
Already have tokens? Use `ProtonApiSession::resume(config, ResumeParameters {..})`
|
Already have tokens? Use `ProtonApiSession::resume(config, ResumeParameters {..})`
|
||||||
instead of `begin`.
|
instead of `begin`.
|
||||||
|
|
||||||
A live smoke test lives in `crates/proton-drive-sdk/examples/live_login.rs`
|
A live smoke test lives in `crates/proton-drive-rs/examples/live_login.rs`
|
||||||
(reads `username` / `password` from a repo-root `.env`, TOTP from
|
(reads `username` / `password` from a repo-root `.env`, TOTP from
|
||||||
`PROTON_TOTP_SECRET`):
|
`PROTON_TOTP_SECRET`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PROTON_TOTP_SECRET=... cargo run -p proton-drive-sdk --example live_login
|
PROTON_TOTP_SECRET=... cargo run -p proton-drive-rs --example live_login
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build & test
|
## Build & test
|
||||||
@@ -114,14 +114,14 @@ cargo build # 0 warnings / 0 errors
|
|||||||
cargo test # offline crypto + derivation round-trip tests
|
cargo test # offline crypto + derivation round-trip tests
|
||||||
```
|
```
|
||||||
|
|
||||||
The `crates/proton-drive-sdk/tests/live_*.rs` suite runs the read/write surface
|
The `crates/proton-drive-rs/tests/live_*.rs` suite runs the read/write surface
|
||||||
against a real account. These tests are `#[ignore]`d by default (they need
|
against a real account. These tests are `#[ignore]`d by default (they need
|
||||||
credentials) and each cleans up after itself. With `.env` (`username` /
|
credentials) and each cleans up after itself. With `.env` (`username` /
|
||||||
`password`) and `PROTON_TOTP_SECRET` set:
|
`password`) and `PROTON_TOTP_SECRET` set:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# all live tests, single-threaded (shared test account)
|
# all live tests, single-threaded (shared test account)
|
||||||
PROTON_TOTP_SECRET=... cargo test -p proton-drive-sdk --test 'live_*' \
|
PROTON_TOTP_SECRET=... cargo test -p proton-drive-rs --test 'live_*' \
|
||||||
-- --ignored --nocapture --test-threads=1
|
-- --ignored --nocapture --test-threads=1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "proton-drive-sdk"
|
name = "proton-drive-rs"
|
||||||
description = "High-level Proton Drive client for Rust"
|
description = "High-level Proton Drive client for Rust"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
@@ -11,7 +11,7 @@ keywords.workspace = true
|
|||||||
categories.workspace = true
|
categories.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
readme = "../../README.md"
|
readme = "../../README.md"
|
||||||
documentation = "https://docs.rs/proton-drive-sdk"
|
documentation = "https://docs.rs/proton-drive-rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
proton-sdk = { path = "../proton-sdk", version = "0.1.0" }
|
proton-sdk = { path = "../proton-sdk", version = "0.1.0" }
|
||||||
File renamed without changes.
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
//! Reads credentials from `.env` (repo root): `username=`, `password=`.
|
//! Reads credentials from `.env` (repo root): `username=`, `password=`.
|
||||||
//! The TOTP secret comes from the `PROTON_TOTP_SECRET` env var (base32).
|
//! The TOTP secret comes from the `PROTON_TOTP_SECRET` env var (base32).
|
||||||
//!
|
//!
|
||||||
//! Run: `PROTON_TOTP_SECRET=... cargo run -p proton-drive-sdk --example live_login`
|
//! Run: `PROTON_TOTP_SECRET=... cargo run -p proton-drive-rs --example live_login`
|
||||||
//!
|
//!
|
||||||
//! Flow: SRP `begin` → `apply_second_factor_code` (computed TOTP) → construct
|
//! Flow: SRP `begin` → `apply_second_factor_code` (computed TOTP) → construct
|
||||||
//! `ProtonDriveClient` with the data password → `get_my_files_folder` →
|
//! `ProtonDriveClient` with the data password → `get_my_files_folder` →
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
use hmac::{Hmac, KeyInit, Mac};
|
use hmac::{Hmac, KeyInit, Mac};
|
||||||
use proton_drive_sdk::ProtonDriveClient;
|
use proton_drive_rs::ProtonDriveClient;
|
||||||
use proton_sdk::config::ProtonClientConfiguration;
|
use proton_sdk::config::ProtonClientConfiguration;
|
||||||
use proton_sdk::session::ProtonApiSession;
|
use proton_sdk::session::ProtonApiSession;
|
||||||
use sha1::Sha1;
|
use sha1::Sha1;
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -8,7 +8,7 @@
|
|||||||
//! # async fn run() -> proton_sdk::error::Result<()> {
|
//! # async fn run() -> proton_sdk::error::Result<()> {
|
||||||
//! use proton_sdk::config::ProtonClientConfiguration;
|
//! use proton_sdk::config::ProtonClientConfiguration;
|
||||||
//! use proton_sdk::session::{PasswordMode, ProtonApiSession, ResumeParameters};
|
//! use proton_sdk::session::{PasswordMode, ProtonApiSession, ResumeParameters};
|
||||||
//! use proton_drive_sdk::ProtonDriveClient;
|
//! use proton_drive_rs::ProtonDriveClient;
|
||||||
//!
|
//!
|
||||||
//! let config = ProtonClientConfiguration::new("external-drive-myapp@0.1.0-alpha");
|
//! let config = ProtonClientConfiguration::new("external-drive-myapp@0.1.0-alpha");
|
||||||
//! let session = ProtonApiSession::resume(config, ResumeParameters {
|
//! let session = ProtonApiSession::resume(config, ResumeParameters {
|
||||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
use hmac::{Hmac, KeyInit, Mac};
|
use hmac::{Hmac, KeyInit, Mac};
|
||||||
use proton_drive_sdk::ProtonDriveClient;
|
use proton_drive_rs::ProtonDriveClient;
|
||||||
use proton_sdk::config::ProtonClientConfiguration;
|
use proton_sdk::config::ProtonClientConfiguration;
|
||||||
use proton_sdk::session::{PasswordMode, ProtonApiSession, ResumeParameters};
|
use proton_sdk::session::{PasswordMode, ProtonApiSession, ResumeParameters};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
+5
-5
@@ -2,19 +2,19 @@
|
|||||||
//! verification against a real Proton account.
|
//! verification against a real Proton account.
|
||||||
//!
|
//!
|
||||||
//! Skipped by default. Run against the test account with:
|
//! Skipped by default. Run against the test account with:
|
||||||
//! cargo test -p proton-drive-sdk --test live_drive_ops -- --ignored --nocapture
|
//! cargo test -p proton-drive-rs --test live_drive_ops -- --ignored --nocapture
|
||||||
//!
|
//!
|
||||||
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
||||||
//! stays reusable across runs.
|
//! stays reusable across runs.
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use proton_drive_sdk::proton_sdk::crypto::VerificationStatus;
|
use proton_drive_rs::proton_sdk::crypto::VerificationStatus;
|
||||||
use proton_drive_sdk::{Node, NodeKind};
|
use proton_drive_rs::{Node, NodeKind};
|
||||||
use proton_sdk::ids::NodeUid;
|
use proton_sdk::ids::NodeUid;
|
||||||
|
|
||||||
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
||||||
async fn cleanup(client: &proton_drive_sdk::ProtonDriveClient, uids: &[NodeUid]) {
|
async fn cleanup(client: &proton_drive_rs::ProtonDriveClient, uids: &[NodeUid]) {
|
||||||
if let Err(e) = client.trash_nodes(uids).await {
|
if let Err(e) = client.trash_nodes(uids).await {
|
||||||
eprintln!("[cleanup] trash failed: {e}");
|
eprintln!("[cleanup] trash failed: {e}");
|
||||||
return;
|
return;
|
||||||
@@ -25,7 +25,7 @@ async fn cleanup(client: &proton_drive_sdk::ProtonDriveClient, uids: &[NodeUid])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch a node that must exist, panicking with context otherwise.
|
/// Fetch a node that must exist, panicking with context otherwise.
|
||||||
async fn get(client: &proton_drive_sdk::ProtonDriveClient, uid: &NodeUid, what: &str) -> Node {
|
async fn get(client: &proton_drive_rs::ProtonDriveClient, uid: &NodeUid, what: &str) -> Node {
|
||||||
client
|
client
|
||||||
.get_node(uid)
|
.get_node(uid)
|
||||||
.await
|
.await
|
||||||
+5
-5
@@ -2,7 +2,7 @@
|
|||||||
//! `enumerate_events`) against a real Proton account.
|
//! `enumerate_events`) against a real Proton account.
|
||||||
//!
|
//!
|
||||||
//! Skipped by default. Run against the test account with:
|
//! Skipped by default. Run against the test account with:
|
||||||
//! cargo test -p proton-drive-sdk --test live_events -- --ignored --nocapture --test-threads=1
|
//! cargo test -p proton-drive-rs --test live_events -- --ignored --nocapture --test-threads=1
|
||||||
//!
|
//!
|
||||||
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
||||||
//! stays reusable across runs.
|
//! stays reusable across runs.
|
||||||
@@ -16,11 +16,11 @@ mod common;
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use proton_drive_sdk::{DriveEvent, DriveEventScopeId};
|
use proton_drive_rs::{DriveEvent, DriveEventScopeId};
|
||||||
use proton_sdk::ids::{DriveEventId, NodeUid};
|
use proton_sdk::ids::{DriveEventId, NodeUid};
|
||||||
|
|
||||||
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
||||||
async fn cleanup(client: &proton_drive_sdk::ProtonDriveClient, uids: &[NodeUid]) {
|
async fn cleanup(client: &proton_drive_rs::ProtonDriveClient, uids: &[NodeUid]) {
|
||||||
if let Err(e) = client.trash_nodes(uids).await {
|
if let Err(e) = client.trash_nodes(uids).await {
|
||||||
eprintln!("[cleanup] trash failed: {e}");
|
eprintln!("[cleanup] trash failed: {e}");
|
||||||
return;
|
return;
|
||||||
@@ -40,7 +40,7 @@ const POLL_DELAY: Duration = Duration::from_secs(2);
|
|||||||
/// cumulative (everything after the cursor), so we can re-poll the same cursor
|
/// cumulative (everything after the cursor), so we can re-poll the same cursor
|
||||||
/// without losing earlier events. Returns `None` if nothing matched in time.
|
/// without losing earlier events. Returns `None` if nothing matched in time.
|
||||||
async fn poll_for(
|
async fn poll_for(
|
||||||
client: &proton_drive_sdk::ProtonDriveClient,
|
client: &proton_drive_rs::ProtonDriveClient,
|
||||||
scope: &DriveEventScopeId,
|
scope: &DriveEventScopeId,
|
||||||
cursor: &DriveEventId,
|
cursor: &DriveEventId,
|
||||||
mut predicate: impl FnMut(&DriveEvent) -> bool,
|
mut predicate: impl FnMut(&DriveEvent) -> bool,
|
||||||
@@ -300,7 +300,7 @@ async fn permanent_delete_surfaces_node_deleted() {
|
|||||||
|
|
||||||
/// Seed the feed and return the cursor to enumerate from next.
|
/// Seed the feed and return the cursor to enumerate from next.
|
||||||
async fn seed(
|
async fn seed(
|
||||||
client: &proton_drive_sdk::ProtonDriveClient,
|
client: &proton_drive_rs::ProtonDriveClient,
|
||||||
scope: &DriveEventScopeId,
|
scope: &DriveEventScopeId,
|
||||||
) -> DriveEventId {
|
) -> DriveEventId {
|
||||||
let seeded = client
|
let seeded = client
|
||||||
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
//! Proton account.
|
//! Proton account.
|
||||||
//!
|
//!
|
||||||
//! Skipped by default. Run against the test account with:
|
//! Skipped by default. Run against the test account with:
|
||||||
//! cargo test -p proton-drive-sdk --test live_transfer_ops -- --ignored --nocapture --test-threads=1
|
//! cargo test -p proton-drive-rs --test live_transfer_ops -- --ignored --nocapture --test-threads=1
|
||||||
//!
|
//!
|
||||||
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
||||||
//! stays reusable across runs.
|
//! stays reusable across runs.
|
||||||
@@ -12,11 +12,11 @@ mod common;
|
|||||||
|
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use proton_drive_sdk::{NodeKind, Thumbnail, ThumbnailType};
|
use proton_drive_rs::{NodeKind, Thumbnail, ThumbnailType};
|
||||||
use proton_sdk::ids::NodeUid;
|
use proton_sdk::ids::NodeUid;
|
||||||
|
|
||||||
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
||||||
async fn cleanup(client: &proton_drive_sdk::ProtonDriveClient, uids: &[NodeUid]) {
|
async fn cleanup(client: &proton_drive_rs::ProtonDriveClient, uids: &[NodeUid]) {
|
||||||
if let Err(e) = client.trash_nodes(uids).await {
|
if let Err(e) = client.trash_nodes(uids).await {
|
||||||
eprintln!("[cleanup] trash failed: {e}");
|
eprintln!("[cleanup] trash failed: {e}");
|
||||||
return;
|
return;
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
//! Live integration: upload → download → byte-equality round-trips.
|
//! Live integration: upload → download → byte-equality round-trips.
|
||||||
//!
|
//!
|
||||||
//! Skipped by default. Run against the test account with:
|
//! Skipped by default. Run against the test account with:
|
||||||
//! PROTON_TOTP_SECRET=... cargo test -p proton-drive-sdk --test live_upload_download -- --ignored --nocapture
|
//! PROTON_TOTP_SECRET=... cargo test -p proton-drive-rs --test live_upload_download -- --ignored --nocapture
|
||||||
//!
|
//!
|
||||||
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
//! Each test cleans up after itself (trash + delete-from-trash) so the account
|
||||||
//! stays reusable across runs.
|
//! stays reusable across runs.
|
||||||
@@ -11,7 +11,7 @@ mod common;
|
|||||||
use proton_sdk::ids::NodeUid;
|
use proton_sdk::ids::NodeUid;
|
||||||
|
|
||||||
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
/// Trash then permanently delete the given nodes; best-effort, logs on failure.
|
||||||
async fn cleanup(client: &proton_drive_sdk::ProtonDriveClient, uids: &[NodeUid]) {
|
async fn cleanup(client: &proton_drive_rs::ProtonDriveClient, uids: &[NodeUid]) {
|
||||||
if let Err(e) = client.trash_nodes(uids).await {
|
if let Err(e) = client.trash_nodes(uids).await {
|
||||||
eprintln!("[cleanup] trash failed: {e}");
|
eprintln!("[cleanup] trash failed: {e}");
|
||||||
return;
|
return;
|
||||||
Reference in new issue
Block a user