Skip to content

Commit 576c691

Browse files
gotlougitEugeny
authored andcommitted
Create new async method in trait
1 parent 499e9d5 commit 576c691

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

russh-keys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ version = "0.37.1"
2929

3030
[dependencies]
3131
aes = "0.8"
32+
async-trait = "0.1.72"
3233
bcrypt-pbkdf = "0.9"
3334
bit-vec = "0.6"
3435
cbc = "0.1"

russh-keys/src/agent/server.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::collections::HashMap;
22
use std::sync::{Arc, RwLock};
33
use std::time::{Duration, SystemTime};
44

5+
use async_trait::async_trait;
56
use byteorder::{BigEndian, ByteOrder};
67
use futures::future::Future;
78
use futures::stream::{Stream, StreamExt};
@@ -30,13 +31,18 @@ pub enum ServerError<E> {
3031
Error(Error),
3132
}
3233

34+
#[async_trait]
3335
pub trait Agent: Clone + Send + 'static {
3436
fn confirm(
3537
self,
3638
_pk: Arc<key::KeyPair>,
3739
) -> Box<dyn Future<Output = (Self, bool)> + Unpin + Send> {
3840
Box::new(futures::future::ready((self, true)))
3941
}
42+
43+
async fn confirm_request(&self) -> bool {
44+
true
45+
}
4046
}
4147

4248
pub async fn serve<S, L, A>(mut listener: L, agent: A) -> Result<(), Error>

0 commit comments

Comments
 (0)