Skip to content

Commit bc946e7

Browse files
committed
Bump dependencies
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
1 parent a8d7825 commit bc946e7

File tree

3 files changed

+69
-81
lines changed

3 files changed

+69
-81
lines changed

Cargo.lock

+49-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ authors = ["Wiktor Kwapisiewicz <[email protected]>"]
1010
repository = "https://github.com/wiktor-k/age-plugin-openpgp-card"
1111

1212
[dependencies]
13-
age-core = "0.10.0"
14-
age-plugin = "0.5.0"
13+
age-core = "0.11.0"
14+
age-plugin = "0.6.0"
1515
base64 = "0.22.1"
1616
bech32 = "0.11"
1717
card-backend-pcsc = "0.5.0"
1818
clap = { version = "4.5.20", features = ["derive"] }
1919
openpgp-card = "0.5.0"
2020
subtle = "2.6.1"
21-
thiserror = "1.0.64"
21+
thiserror = "1.0.67"
2222
x25519-dalek = "2.0.1"
2323
zeroize = "1.8.1"

src/main.rs

+17-38
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
use std::collections::HashMap;
44
use std::io;
55

6+
use age_core::format::{FileKey, Stanza};
7+
use age_core::secrecy::ExposeSecret;
68
use age_core::{
79
format::FILE_KEY_BYTES,
810
primitives::{aead_decrypt, hkdf},
911
};
10-
use age_core::{
11-
format::{FileKey, Stanza},
12-
secrecy::Zeroize as _,
13-
};
12+
use age_plugin::PluginHandler;
1413
use age_plugin::{
1514
identity::{self, IdentityPluginV1},
16-
recipient::{self, RecipientPluginV1},
1715
run_state_machine, Callbacks,
1816
};
1917
use bech32::{Bech32, Hrp};
@@ -29,6 +27,7 @@ use openpgp_card::{
2927
};
3028
use subtle::ConstantTimeEq;
3129
use x25519_dalek::PublicKey;
30+
use zeroize::Zeroize as _;
3231

3332
// Use lower-case HRP to avoid https://github.com/rust-bitcoin/rust-bech32/issues/40
3433
const IDENTITY_PREFIX: Hrp = Hrp::parse_unchecked("age-plugin-openpgp-card-");
@@ -40,35 +39,6 @@ const X25519_RECIPIENT_KEY_LABEL: &[u8] = b"age-encryption.org/v1/X25519";
4039

4140
pub const EPK_LEN_BYTES: usize = 32;
4241
pub const ENCRYPTED_FILE_KEY_BYTES: usize = FILE_KEY_BYTES + 16;
43-
struct RecipientPlugin;
44-
45-
impl RecipientPluginV1 for RecipientPlugin {
46-
fn add_recipient(
47-
&mut self,
48-
_index: usize,
49-
_plugin_name: &str,
50-
_bytes: &[u8],
51-
) -> Result<(), recipient::Error> {
52-
todo!()
53-
}
54-
55-
fn add_identity(
56-
&mut self,
57-
_index: usize,
58-
_plugin_name: &str,
59-
_bytes: &[u8],
60-
) -> Result<(), recipient::Error> {
61-
todo!()
62-
}
63-
64-
fn wrap_file_keys(
65-
&mut self,
66-
_file_keys: Vec<FileKey>,
67-
_callbacks: impl Callbacks<recipient::Error>,
68-
) -> io::Result<Result<Vec<Vec<Stanza>>, Vec<recipient::Error>>> {
69-
todo!()
70-
}
71-
}
7242

7343
struct CardStub {
7444
ident: String,
@@ -165,7 +135,11 @@ impl IdentityPlugin {
165135
return Err(DecryptError::NonEccCard.into());
166136
};
167137
tx.verify_user_pin(
168-
callbacks.request_secret(&format!("Unlock card {}", card_stub.ident))??,
138+
callbacks
139+
.request_secret(&format!("Unlock card {}", card_stub.ident))??
140+
.expose_secret()
141+
.to_string()
142+
.into(),
169143
)?;
170144

171145
if let Ok(Some(uif)) = tx.user_interaction_flag(Decryption) {
@@ -202,7 +176,7 @@ impl IdentityPlugin {
202176
// It's ours!
203177
let file_key: [u8; FILE_KEY_BYTES] = pt[..].try_into().unwrap();
204178
pt.zeroize();
205-
FileKey::from(file_key)
179+
FileKey::new(Box::new(file_key))
206180
})
207181
{
208182
return Ok(Some(result));
@@ -212,6 +186,12 @@ impl IdentityPlugin {
212186
}
213187
}
214188

189+
impl PluginHandler for IdentityPlugin {
190+
type RecipientV1 = std::convert::Infallible;
191+
192+
type IdentityV1 = Self;
193+
}
194+
215195
impl IdentityPluginV1 for IdentityPlugin {
216196
fn add_identity(
217197
&mut self,
@@ -275,8 +255,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
275255
if let Some(state_machine) = opts.age_plugin {
276256
return Ok(run_state_machine(
277257
&state_machine,
278-
Some(|| RecipientPlugin),
279-
Some(|| IdentityPlugin { cards: vec![] }),
258+
IdentityPlugin { cards: vec![] },
280259
)?);
281260
}
282261

0 commit comments

Comments
 (0)