Skip to content

Commit ffb47d6

Browse files
author
Bennett Hardwick
committed
Update for new deps, add test
1 parent 1fd3dd1 commit ffb47d6

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

cryptonamo-derive/Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cryptonamo-derive/src/decryptable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) fn derive_decryptable(input: DeriveInput) -> Result<TokenStream, syn:
2020
let attr_ident = format_ident!("{attr}");
2121

2222
quote! {
23-
#attr_ident: unsealed.from_protected(#attr)?.try_into()?
23+
#attr_ident: unsealed.from_protected(#attr)?.to_owned().try_into()?
2424
}
2525
})
2626
.chain(plaintext_attributes.iter().map(|attr| {

src/encrypted_table/table_entry.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ impl_simple_conversions! {
217217
String => String,
218218
Bytes => Vec<u8>,
219219
StringVec => Vec<String>,
220-
ByteVec => Vec<Vec<u8>>
220+
ByteVec => Vec<Vec<u8>>,
221+
Bool => bool
221222
}
222223

223224
impl From<TableAttribute> for AttributeValue {

tests/compile_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ run_tests! {
3535

3636
pass => {
3737
"./ui/pass.rs",
38-
"./ui/pk-field-on-struct.rs"
38+
"./ui/pk-field-on-struct.rs",
39+
"./ui/various-fields.rs"
3940
}
4041
}

tests/ui/various-fields.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
use cryptonamo::Encryptable;
2+
3+
#[derive(Debug, Encryptable)]
4+
struct Crazy {
5+
#[cryptonamo(query = "exact", compound = "email#name")]
6+
#[partition_key]
7+
email: String,
8+
9+
#[cryptonamo(query = "prefix", compound = "email#name")]
10+
#[sort_key]
11+
name: String,
12+
13+
#[cryptonamo(query = "exact")]
14+
ct_a: i64,
15+
#[cryptonamo(query = "exact")]
16+
ct_b: i32,
17+
#[cryptonamo(query = "exact")]
18+
ct_c: i16,
19+
#[cryptonamo(query = "exact")]
20+
ct_d: f64,
21+
#[cryptonamo(query = "exact")]
22+
ct_e: bool,
23+
#[cryptonamo(query = "exact")]
24+
ct_f: u64,
25+
#[cryptonamo(query = "exact")]
26+
ct_g: u32,
27+
#[cryptonamo(query = "exact")]
28+
ct_h: u16,
29+
30+
#[cryptonamo(plaintext)]
31+
pt_a: i64,
32+
#[cryptonamo(plaintext)]
33+
pt_b: i32,
34+
#[cryptonamo(plaintext)]
35+
pt_c: i16,
36+
#[cryptonamo(plaintext)]
37+
pt_d: f64,
38+
#[cryptonamo(plaintext)]
39+
pt_e: bool,
40+
#[cryptonamo(plaintext)]
41+
pt_f: u64,
42+
#[cryptonamo(plaintext)]
43+
pt_g: u32,
44+
#[cryptonamo(plaintext)]
45+
pt_h: u16,
46+
#[cryptonamo(plaintext)]
47+
pt_i: Vec<u8>,
48+
#[cryptonamo(plaintext)]
49+
pt_j: Vec<String>,
50+
#[cryptonamo(plaintext)]
51+
pt_k: Vec<Vec<u8>>,
52+
}
53+
54+
fn main() {}

0 commit comments

Comments
 (0)