Skip to content

Commit

Permalink
Prepare 3.0 (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
giarc3 committed Jul 1, 2024
1 parent 4017348 commit 95405fa
Show file tree
Hide file tree
Showing 17 changed files with 124 additions and 124 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
schedule:
- cron: "0 14 * * 1" # Mondays at 2pm UTC
workflow_dispatch: null

jobs:
cargo-test:
Expand Down Expand Up @@ -36,7 +37,7 @@ jobs:
features: default
# MSRV
- os: ubuntu-22.04
toolchain: 1.74.0
toolchain: 1.75.0
features: default
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Rust Release

on:
workflow_dispatch: null

jobs:
rust-release:
uses: IronCoreLabs/workflows/.github/workflows/rust-release.yaml@rust-release-v1
secrets: inherit
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Changelog

## 3.0.0 (Unreleased)
## 3.0.0

- `itertools` will be updated to the latest version and re-exported for use in public functions.
- After this change, updates to `itertools` will not automatically be breaking changes.
- [[#321](https://github.com/IronCoreLabs/ironoxide/issues/321)]
- Bump MSRV to 1.75.0.
- Upgrade dependencies. This includes an update to `itertools`, which is part of the public API.
- Re-export `itertools::EitherOrBoth`. Updates to `itertools` will not automatically be considered breaking changes going forward.

## 2.1.0

Expand Down
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ironoxide"
version = "2.1.0"
version = "3.0.0"
authors = ["IronCore Labs <[email protected]>"]
readme = "README.md"
license = "AGPL-3.0-only"
Expand All @@ -16,10 +16,9 @@ keywords = [
]
description = "A pure-Rust SDK for accessing IronCore's privacy platform"
edition = "2021"
rust-version = "1.74.0"
rust-version = "1.75.0"

[dependencies]
async-trait = "0.1.21"
base64 = "0.22"
base64-serde = "0.7"
bytes = "1"
Expand Down Expand Up @@ -68,8 +67,8 @@ protobuf-codegen = "3.0"
[features]
beta = ["ironcore-search-helpers"]
blocking = []
# NOTE: ironoxide requires a TLS implementation. Choose one of the following

# NOTE: ironoxide requires a TLS implementation. Choose one of the following
# enable to use statically compiled openssl on supported OpenSSL platforms; use with 'default-features = false'
tls-vendored-openssl = ["reqwest/native-tls-vendored"]
# enable to use rustls-tls; use with 'default-features = false'
Expand Down
6 changes: 5 additions & 1 deletion benches/ironoxide_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ lazy_static! {
"prod" => "prod",
_ => panic!("IRONCORE_ENV can only be set to `stage` or `prod` when running the benchmarks.")
},
_ => "stage",
_ => {
// The core code defaults to `prod`, so we have to set this so the API_URL is set correctly.
std::env::set_var("IRONCORE_ENV", "stage");
"stage"
},
}
.to_string();
}
Expand Down
58 changes: 12 additions & 46 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
profile = "default"
channel = "1.76.0"
channel = "1.79.0"
components = ["rust-src", "rust-analyzer"]
36 changes: 20 additions & 16 deletions src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
user::UserId,
Result,
};
use async_trait::async_trait;
use futures::Future;
use itertools::{Either, EitherOrBoth, Itertools};

pub mod advanced;
Expand Down Expand Up @@ -131,7 +131,6 @@ impl Default for DocumentEncryptOpts {
/// # Key Terms
/// - ID - The ID representing a document. It must be unique within the document's segment and will **not** be encrypted.
/// - Name - The human-readable name of a document. It does not need to be unique and will **not** be encrypted.
#[async_trait]
pub trait DocumentOps {
/// Encrypts the provided document bytes.
///
Expand Down Expand Up @@ -159,11 +158,11 @@ pub trait DocumentOps {
/// # Ok(())
/// # }
/// ```
async fn document_encrypt(
fn document_encrypt(
&self,
document_data: Vec<u8>,
encrypt_opts: &DocumentEncryptOpts,
) -> Result<DocumentEncryptResult>;
) -> impl Future<Output = Result<DocumentEncryptResult>> + Send;

/// Decrypts an IronCore encrypted document.
///
Expand All @@ -188,7 +187,10 @@ pub trait DocumentOps {
/// # Ok(())
/// # }
/// ```
async fn document_decrypt(&self, encrypted_document: &[u8]) -> Result<DocumentDecryptResult>;
fn document_decrypt(
&self,
encrypted_document: &[u8],
) -> impl Future<Output = Result<DocumentDecryptResult>> + Send;

/// Lists metadata for all of the encrypted documents that the calling user can read or decrypt.
///
Expand All @@ -202,7 +204,7 @@ pub trait DocumentOps {
/// let documents: Vec<DocumentListMeta> = document_data.result().to_vec();
/// # Ok(())
/// # }
async fn document_list(&self) -> Result<DocumentListResult>;
fn document_list(&self) -> impl Future<Output = Result<DocumentListResult>> + Send;

/// Returns the metadata for an encrypted document.
///
Expand All @@ -222,7 +224,10 @@ pub trait DocumentOps {
/// # Ok(())
/// # }
/// ```
async fn document_get_metadata(&self, id: &DocumentId) -> Result<DocumentMetadataResult>;
fn document_get_metadata(
&self,
id: &DocumentId,
) -> impl Future<Output = Result<DocumentMetadataResult>> + Send;

/// Returns the document ID from the bytes of an encrypted document.
///
Expand Down Expand Up @@ -267,11 +272,11 @@ pub trait DocumentOps {
/// # Ok(())
/// # }
/// ```
async fn document_update_bytes(
fn document_update_bytes(
&self,
id: &DocumentId,
new_document_data: Vec<u8>,
) -> Result<DocumentEncryptResult>;
) -> impl Future<Output = Result<DocumentEncryptResult>> + Send;

/// Modifies or removes a document's name.
///
Expand All @@ -293,11 +298,11 @@ pub trait DocumentOps {
/// # Ok(())
/// # }
/// ```
async fn document_update_name(
fn document_update_name(
&self,
id: &DocumentId,
name: Option<&DocumentName>,
) -> Result<DocumentMetadataResult>;
) -> impl Future<Output = Result<DocumentMetadataResult>> + Send;

/// Grants decryption access to a document for the provided users and/or groups.
///
Expand Down Expand Up @@ -326,11 +331,11 @@ pub trait DocumentOps {
/// # Ok(())
/// # }
/// ```
async fn document_grant_access(
fn document_grant_access(
&self,
document_id: &DocumentId,
grant_list: &[UserOrGroup],
) -> Result<DocumentAccessResult>;
) -> impl Future<Output = Result<DocumentAccessResult>> + Send;

/// Revokes decryption access to a document for the provided users and/or groups.
///
Expand Down Expand Up @@ -359,14 +364,13 @@ pub trait DocumentOps {
/// # Ok(())
/// # }
/// ```
async fn document_revoke_access(
fn document_revoke_access(
&self,
document_id: &DocumentId,
revoke_list: &[UserOrGroup],
) -> Result<DocumentAccessResult>;
) -> impl Future<Output = Result<DocumentAccessResult>> + Send;
}

#[async_trait]
impl DocumentOps for crate::IronOxide {
async fn document_encrypt(
&self,
Expand Down
12 changes: 5 additions & 7 deletions src/document/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ use crate::{
internal::add_optional_timeout,
Result, SdkOperation,
};
use async_trait::async_trait;
use futures::Future;
use itertools::EitherOrBoth;

/// IronOxide Advanced Document Operations
///
/// # Key Terms
/// - EDEKs - Encrypted document encryption keys produced by unmanaged document encryption and required for unmanaged
/// document decryption.
#[async_trait]
pub trait DocumentAdvancedOps {
/// Encrypts the provided document bytes without being managed by the IronCore service.
///
Expand All @@ -31,11 +30,11 @@ pub trait DocumentAdvancedOps {
/// - `data` - Bytes of the document to encrypt
/// - `encrypt_opts` - Document encryption parameters. Default values are provided with
/// [DocumentEncryptOpts::default()](../struct.DocumentEncryptOpts.html#method.default).
async fn document_encrypt_unmanaged(
fn document_encrypt_unmanaged(
&self,
data: Vec<u8>,
encrypt_opts: &DocumentEncryptOpts,
) -> Result<DocumentEncryptUnmanagedResult>;
) -> impl Future<Output = Result<DocumentEncryptUnmanagedResult>> + Send;

/// Decrypts a document not managed by the IronCore service.
///
Expand All @@ -47,14 +46,13 @@ pub trait DocumentAdvancedOps {
/// # Arguments
/// - `encrypted_data` - Bytes of the encrypted document
/// - `encrypted_deks` - EDEKs associated with the encrypted document
async fn document_decrypt_unmanaged(
fn document_decrypt_unmanaged(
&self,
encrypted_data: &[u8],
encrypted_deks: &[u8],
) -> Result<DocumentDecryptUnmanagedResult>;
) -> impl Future<Output = Result<DocumentDecryptUnmanagedResult>> + Send;
}

#[async_trait]
impl DocumentAdvancedOps for crate::IronOxide {
async fn document_encrypt_unmanaged(
&self,
Expand Down
Loading

0 comments on commit 95405fa

Please sign in to comment.