Compare commits

..

6 Commits

Author SHA1 Message Date
t ef58f92577 chore: update deps 2026-02-19 20:57:57 +01:00
t eb5827c234 style(crdt-enc): move utils mod into sub dir 2026-02-16 22:52:05 +01:00
t 0779ad0367 chore: use rust edition 2024 2026-02-15 19:35:59 +01:00
t eb7b09d137 chore: remove nix flake 2026-02-15 19:22:18 +01:00
t 9de792e07d style: fmt 2024-02-04 16:55:32 +01:00
t fb7477decf build: use new resolver for workspace 2023-07-14 19:27:16 +02:00
16 changed files with 30 additions and 60 deletions
-1
View File
@@ -1,3 +1,2 @@
/target/
/Cargo.lock
/flake.lock
+2
View File
@@ -1,5 +1,7 @@
[workspace]
resolver = "2"
members = [
"crdt-enc",
"crdt-enc-gpgme",
+2 -2
View File
@@ -2,7 +2,7 @@
name = "crdt-enc-gpgme"
version = "0.1.0"
authors = ["Thomas Heck <t@b128.net>"]
edition = "2021"
edition = "2024"
[dependencies]
serde = "1"
@@ -14,7 +14,7 @@ uuid = "1"
crdts = "7"
gpgme = "0.11"
dyn-clone = "1"
phf = {version = "0.11", features = ["macros"]}
phf = {version = "0.13", features = ["macros"]}
[dependencies.crdt-enc]
path = "../crdt-enc"
+4 -4
View File
@@ -1,14 +1,14 @@
use ::anyhow::{Context, Result};
use ::async_trait::async_trait;
use ::crdt_enc::{
CoreSubHandle, Info,
key_cryptor::Keys,
utils::{
decode_version_bytes_mvreg_custom_phf, encode_version_bytes_mvreg_custom, LockBox,
VersionBytes,
LockBox, VersionBytes, decode_version_bytes_mvreg_custom_phf,
encode_version_bytes_mvreg_custom,
},
CoreSubHandle, Info,
};
use ::crdts::{ctx::ReadCtx, CvRDT, MVReg, Orswot};
use ::crdts::{CvRDT, MVReg, Orswot, ctx::ReadCtx};
use ::serde::{Deserialize, Serialize};
use ::std::{convert::Infallible, fmt::Debug};
use ::uuid::Uuid;
+1 -1
View File
@@ -2,7 +2,7 @@
name = "crdt-enc-tokio"
version = "0.1.0"
authors = ["Thomas Heck <t@b128.net>"]
edition = "2021"
edition = "2024"
[dependencies]
crdts = "7"
+1 -1
View File
@@ -1,4 +1,4 @@
use ::anyhow::{ensure, Context, Error, Result};
use ::anyhow::{Context, Error, Result, ensure};
use ::async_trait::async_trait;
use ::bytes::Buf;
use ::crdt_enc::utils::{VersionBytes, VersionBytesRef};
+2 -2
View File
@@ -2,11 +2,11 @@
name = "crdt-enc-xchacha20poly1305"
version = "0.1.0"
authors = ["Thomas Heck <t@b128.net>"]
edition = "2021"
edition = "2024"
[dependencies]
crdts = "7"
rand = "0.8"
rand = { version = "0.10", features = ["thread_rng"] }
anyhow = "1"
serde = "1"
rmp-serde = "1"
+4 -4
View File
@@ -1,9 +1,9 @@
use ::agnostik::spawn_blocking;
use ::anyhow::{Context, Error, Result};
use ::async_trait::async_trait;
use ::chacha20poly1305::{aead::Aead, Key, KeyInit, XChaCha20Poly1305, XNonce};
use ::chacha20poly1305::{Key, KeyInit, XChaCha20Poly1305, XNonce, aead::Aead};
use ::crdt_enc::utils::{VersionBytes, VersionBytesRef};
use ::rand::{thread_rng, RngCore};
use ::rand::{TryRng, rng};
use ::serde::{Deserialize, Serialize};
use ::std::{borrow::Cow, fmt::Debug};
use ::uuid::Uuid;
@@ -29,7 +29,7 @@ impl crdt_enc::cryptor::Cryptor for EncHandler {
async fn gen_key(&self) -> Result<VersionBytes> {
spawn_blocking(|| {
let mut key = [0u8; KEY_LEN];
thread_rng()
rng()
.try_fill_bytes(&mut key)
.context("Unable to get random data for secret key")?;
Ok(VersionBytes::new(KEY_VERSION, key.into()))
@@ -49,7 +49,7 @@ impl crdt_enc::cryptor::Cryptor for EncHandler {
let key = Key::from_slice(&key);
let aead = XChaCha20Poly1305::new(key);
let mut nonce = [0u8; NONCE_LEN];
thread_rng()
rng()
.try_fill_bytes(&mut nonce)
.context("Unable to get random data for nonce")?;
let xnonce = XNonce::from_slice(&nonce);
+3 -3
View File
@@ -2,7 +2,7 @@
name = "crdt-enc"
version = "0.1.0"
authors = ["Thomas Heck <t@b128.net>"]
edition = "2021"
edition = "2024"
[dependencies]
crdts = "7"
@@ -11,11 +11,11 @@ serde_bytes = "0.11"
rmp-serde = "1"
async-trait = "0.1"
anyhow = "1"
thiserror = "1"
thiserror = "2"
futures = "0.3"
dyn-clone = "1"
bytes = "1"
phf = {version = "0.11", features = ["macros"]}
phf = {version = "0.13", features = ["macros"]}
[dependencies.uuid]
version = "1"
+1 -1
View File
@@ -1,6 +1,6 @@
use crate::{
utils::{VersionBytes, VersionBytesRef},
CoreSubHandle,
utils::{VersionBytes, VersionBytesRef},
};
use ::anyhow::Result;
use ::async_trait::async_trait;
+2 -2
View File
@@ -1,10 +1,10 @@
use crate::{
utils::{VersionBytes, VersionBytesRef},
CoreSubHandle,
utils::{VersionBytes, VersionBytesRef},
};
use ::anyhow::Result;
use ::async_trait::async_trait;
use ::crdts::{ctx::ReadCtx, CmRDT, CvRDT, MVReg, Orswot};
use ::crdts::{CmRDT, CvRDT, MVReg, Orswot, ctx::ReadCtx};
use ::serde::{Deserialize, Serialize};
use ::std::{
borrow::Borrow,
+2 -2
View File
@@ -11,13 +11,13 @@ use crate::{
};
use ::anyhow::{Context, Error, Result};
use ::async_trait::async_trait;
use ::crdts::{ctx::ReadCtx, CmRDT, CvRDT, MVReg, VClock};
use ::crdts::{CmRDT, CvRDT, MVReg, VClock, ctx::ReadCtx};
use ::dyn_clone::DynClone;
use ::futures::{
lock::Mutex as AsyncMutex,
stream::{self, StreamExt, TryStreamExt},
};
use ::serde::{de::DeserializeOwned, Deserialize, Serialize};
use ::serde::{Deserialize, Serialize, de::DeserializeOwned};
use ::std::{
collections::HashSet, convert::Infallible, default::Default, fmt::Debug, mem, sync::Arc,
};
+1 -1
View File
@@ -1,4 +1,4 @@
use crate::{utils::VersionBytes, CoreSubHandle};
use crate::{CoreSubHandle, utils::VersionBytes};
use ::anyhow::Result;
use ::async_trait::async_trait;
use ::crdts::MVReg;
@@ -3,9 +3,9 @@ mod version_bytes;
pub use version_bytes::*;
use ::anyhow::{Context, Result};
use ::crdts::{ctx::ReadCtx, CmRDT, CvRDT, MVReg};
use ::futures::{stream, Future, FutureExt, StreamExt, TryStreamExt};
use ::serde::{de::DeserializeOwned, Deserialize, Serialize};
use ::crdts::{CmRDT, CvRDT, MVReg, ctx::ReadCtx};
use ::futures::{Future, FutureExt, StreamExt, TryStreamExt, stream};
use ::serde::{Deserialize, Serialize, de::DeserializeOwned};
use ::std::{convert::Infallible, fmt::Debug, sync::Mutex as SyncMutex};
use ::uuid::Uuid;
+2 -6
View File
@@ -173,11 +173,7 @@ impl<'a> VersionBytesRef<'a> {
Ok(())
} else {
Err(VersionError {
expected: versions
.iter()
.copied()
.map(|v| Uuid::from_u128(v))
.collect(),
expected: versions.iter().copied().map(Uuid::from_u128).collect(),
got: self.version(),
})
}
@@ -257,7 +253,7 @@ impl<'a> VersionBytesBuf<'a> {
pub fn new(version: Uuid, content: &'a [u8]) -> VersionBytesBuf<'a> {
VersionBytesBuf {
pos: 0,
version: *version.as_bytes(),
version: version.into_bytes(),
content,
}
}
-27
View File
@@ -1,27 +0,0 @@
{
description = "crdt-enc";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShell = pkgs.stdenv.mkDerivation {
name = "crdt-enc";
buildInputs = [
pkgs.gpgme
pkgs.cargo
pkgs.rustc
pkgs.rustfmt
pkgs.rust-analyzer
];
};
}
);
}