Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 51 additions & 32 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ members = [
]

[workspace.dependencies]
uniffi = "0.29.1"
uniffi = "0.30.0"

[package]
name = "devolutions-crypto"
Expand Down Expand Up @@ -51,6 +51,7 @@ rand_08 = { package = "rand", version = "0.8" }
thiserror = "2.0.12"
typed-builder = "0.23.2"
rust-argon2 = { version = "3.0", default-features = false }
uniffi = { workspace = true, optional = true }

ed25519-dalek = { version = "2", features = [ "rand_core" ] }
x25519-dalek = { version = "2", features = [ "static_secrets" ] }
Expand All @@ -76,6 +77,7 @@ wasm-bindgen-test = "0.3"
default = []
fuzz = ["arbitrary", "blahaj/fuzzing"]
wbindgen = ["wasm-bindgen", "serde-wasm-bindgen", "js-sys"]
uniffi-support = ["uniffi"]

[dependencies.getrandom_v02]
package = "getrandom"
Expand Down
7 changes: 7 additions & 0 deletions src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use wasm_bindgen::prelude::*;
/// The different data types.
#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Enum))]
#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
#[repr(u16)]
#[derive(Default)]
Expand All @@ -36,6 +37,7 @@ pub enum DataType {
/// The versions of the encryption scheme to use.
#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Enum))]
#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
#[repr(u16)]
#[derive(Default)]
Expand Down Expand Up @@ -66,6 +68,7 @@ pub enum OnlineCiphertextVersion {
/// The versions of the password hashing scheme to use.
#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Enum))]
#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
#[repr(u16)]
#[derive(Default)]
Expand All @@ -80,6 +83,7 @@ pub enum PasswordHashVersion {
/// The versions of the key scheme to use.
#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Enum))]
#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
#[repr(u16)]
#[derive(Default)]
Expand All @@ -93,6 +97,7 @@ pub enum KeyVersion {

#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Enum))]
#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
#[repr(u16)]
#[derive(Default)]
Expand All @@ -107,6 +112,7 @@ pub enum SigningKeyVersion {
/// The versions of the secret sharing scheme to use.
#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Enum))]
#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
#[repr(u16)]
#[derive(Default)]
Expand All @@ -121,6 +127,7 @@ pub enum SecretSharingVersion {
/// The versions of the secret sharing scheme to use.
#[cfg_attr(feature = "wbindgen", wasm_bindgen())]
#[cfg_attr(feature = "fuzz", derive(Arbitrary))]
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Enum))]
#[derive(Clone, Copy, PartialEq, Eq, Zeroize, IntoPrimitive, TryFromPrimitive, Debug)]
#[repr(u16)]
#[derive(Default)]
Expand Down
2 changes: 2 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub type Result<T> = std::result::Result<T, Error>;
// }

/// This crate's error type.
#[cfg_attr(feature = "uniffi-support", derive(uniffi::Error))]
#[cfg_attr(feature = "uniffi-support", uniffi(flat_error))]
#[derive(Debug, IntoStaticStr, thiserror::Error)]
pub enum Error {
/// The provided data has an invalid length. Error code: -1
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,6 @@ pub const DEFAULT_PBKDF2_ITERATIONS: u32 = 10000;

#[cfg(feature = "wbindgen")]
pub mod wasm;

#[cfg(feature = "uniffi-support")]
uniffi::setup_scaffolding!();
7 changes: 2 additions & 5 deletions uniffi/devolutions-crypto-uniffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ version.workspace = true
crate-type = ["cdylib", "staticlib"]

[dependencies]
devolutions-crypto = { path = "../../" }
uniffi-builder-macro = { path = "./uniffi-builder-macro" }
devolutions-crypto = { path = "../../", features = ["uniffi-support"] }
uniffi = { workspace = true }

[build-dependencies]
uniffi = { workspace = true, features = ["build"] }
rust-argon2 = "3.0"
3 changes: 0 additions & 3 deletions uniffi/devolutions-crypto-uniffi/build.rs

This file was deleted.

Loading
Loading