-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency on BaseWallet from IndyVdrLedger
Signed-off-by: Miroslav Kovar <miroslav.kovar@absa.africa>
- Loading branch information
Showing
8 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use std::sync::Arc; | ||
|
||
use async_trait::async_trait; | ||
use indy_vdr::pool::PreparedRequest; | ||
|
||
use crate::{errors::error::VcxCoreResult, wallet::base_wallet::BaseWallet}; | ||
|
||
use super::RequestSigner; | ||
|
||
pub struct BaseWalletRequestSigner { | ||
wallet: Arc<dyn BaseWallet>, | ||
} | ||
|
||
impl BaseWalletRequestSigner { | ||
pub fn new(wallet: Arc<dyn BaseWallet>) -> Self { | ||
Self { wallet } | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl RequestSigner for BaseWalletRequestSigner { | ||
async fn sign(&self, did: &str, request: &PreparedRequest) -> VcxCoreResult<Vec<u8>> { | ||
let to_sign = request.get_signature_input()?; | ||
let signer_verkey = self.wallet.key_for_local_did(did).await?; | ||
let signature = self.wallet.sign(&signer_verkey, to_sign.as_bytes()).await?; | ||
Ok(signature) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pub mod base_wallet; | ||
|
||
use async_trait::async_trait; | ||
use indy_vdr::pool::PreparedRequest; | ||
|
||
use crate::errors::error::VcxCoreResult; | ||
|
||
#[async_trait] | ||
pub trait RequestSigner: Send + Sync { | ||
async fn sign(&self, did: &str, request: &PreparedRequest) -> VcxCoreResult<Vec<u8>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters