AnkSharedSecret new() takes PublicKey
This commit is contained in:
parent
70bc03da9e
commit
0c38e24f44
@ -9,6 +9,7 @@ use sp_client::{
|
||||
silentpayments::{
|
||||
bitcoin_hashes::{sha256t_hash_newtype, Hash, HashEngine},
|
||||
sending::SilentPaymentAddress,
|
||||
secp256k1::PublicKey
|
||||
},
|
||||
};
|
||||
use tsify::Tsify;
|
||||
@ -39,8 +40,10 @@ pub struct AnkSharedSecret {
|
||||
}
|
||||
|
||||
impl AnkSharedSecret {
|
||||
pub fn new(shared_point: [u8; 64]) -> Self {
|
||||
let secret = AnkSharedSecretHash::from_shared_point(shared_point).to_byte_array();
|
||||
pub fn new(shared_point: PublicKey) -> Self {
|
||||
let mut shared_point_bin = [0u8;64];
|
||||
shared_point_bin.copy_from_slice(&shared_point.serialize_uncompressed()[1..]);
|
||||
let secret = AnkSharedSecretHash::from_shared_point(shared_point_bin).to_byte_array();
|
||||
Self { secret: secret.to_lower_hex_string() }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user