mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 02:11:01 +00:00
Convert Public to CryptoTypePublicPair (#6014)
* Tabify code * Implement CryptoTypePublicPair in app_crypto * Cleanup redundancy * Introduce to_public_crypto_pair to Public trait * Implement method for test
This commit is contained in:
@@ -559,6 +559,8 @@ pub trait Public:
|
||||
|
||||
/// Return a slice filled with raw data.
|
||||
fn as_slice(&self) -> &[u8] { self.as_ref() }
|
||||
/// Return `CryptoTypePublicPair` from public key.
|
||||
fn to_public_crypto_pair(&self) -> CryptoTypePublicPair;
|
||||
}
|
||||
|
||||
/// An opaque 32-byte cryptographic identifier.
|
||||
@@ -706,6 +708,11 @@ mod dummy {
|
||||
#[cfg(feature = "std")]
|
||||
fn to_raw_vec(&self) -> Vec<u8> { vec![] }
|
||||
fn as_slice(&self) -> &[u8] { b"" }
|
||||
fn to_public_crypto_pair(&self) -> CryptoTypePublicPair {
|
||||
CryptoTypePublicPair(
|
||||
CryptoTypeId(*b"dumm"), Public::to_raw_vec(self)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Pair for Dummy {
|
||||
@@ -1061,6 +1068,11 @@ mod tests {
|
||||
fn to_raw_vec(&self) -> Vec<u8> {
|
||||
vec![]
|
||||
}
|
||||
fn to_public_crypto_pair(&self) -> CryptoTypePublicPair {
|
||||
CryptoTypePublicPair(
|
||||
CryptoTypeId(*b"dumm"), self.to_raw_vec(),
|
||||
)
|
||||
}
|
||||
}
|
||||
impl Pair for TestPair {
|
||||
type Public = TestPublic;
|
||||
|
||||
Reference in New Issue
Block a user