v0.4.8-pre.013
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-wallet/src/wallet.rs
|
||||
// version: 8
|
||||
// version: 9
|
||||
|
||||
//! Local wallet storage and signing primitives.
|
||||
|
||||
@@ -104,6 +104,11 @@ impl crate::TemporaryWallet {
|
||||
return &self.keypair;
|
||||
}
|
||||
|
||||
/// Returns the signer interface with the `Sync` auto-trait preserved for `Send` async futures.
|
||||
pub fn as_sync_signer(&self) -> &(dyn solana_signer::Signer + std::marker::Sync) {
|
||||
return &self.keypair;
|
||||
}
|
||||
|
||||
/// Signs arbitrary message bytes and returns the base58 signature.
|
||||
pub fn sign_message(&self, message: &[u8]) -> kb_core::Result<std::string::String> {
|
||||
let signature = match self.keypair.try_sign_message(message) {
|
||||
@@ -437,6 +442,7 @@ mod tests {
|
||||
.unwrap_or_else(|error| panic!("unexpected signing error: {error}"));
|
||||
assert!(!signature.is_empty());
|
||||
assert_eq!(wallet.public_key(), wallet.as_signer().pubkey().to_string());
|
||||
assert_eq!(wallet.public_key(), wallet.as_sync_signer().pubkey().to_string());
|
||||
assert!(wallet.summary().storage_path.is_none());
|
||||
assert!(!format!("{wallet:?}").contains("secret"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user