bech32 0.8

This commit is contained in:
Jack Grigg
2021-03-29 10:43:57 +13:00
parent 15081ac948
commit 50e4fee48c
4 changed files with 26 additions and 12 deletions
+8 -4
View File
@@ -1,4 +1,4 @@
use bech32::ToBase32;
use bech32::{ToBase32, Variant};
use elliptic_curve::sec1::EncodedPoint;
use p256::NistP256;
use sha2::{Digest, Sha256};
@@ -22,9 +22,13 @@ impl fmt::Debug for Recipient {
impl fmt::Display for Recipient {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(
bech32::encode(RECIPIENT_PREFIX, self.as_bytes().to_base32())
.expect("HRP is valid")
.as_str(),
bech32::encode(
RECIPIENT_PREFIX,
self.as_bytes().to_base32(),
Variant::Bech32,
)
.expect("HRP is valid")
.as_str(),
)
}
}
+9 -5
View File
@@ -1,6 +1,6 @@
//! Structs for handling YubiKeys.
use bech32::ToBase32;
use bech32::{ToBase32, Variant};
use std::fmt;
use std::thread::sleep;
use std::time::{Duration, SystemTime};
@@ -81,10 +81,14 @@ pub struct Stub {
impl fmt::Display for Stub {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(
bech32::encode(IDENTITY_PREFIX, self.to_bytes().to_base32())
.expect("HRP is valid")
.to_uppercase()
.as_str(),
bech32::encode(
IDENTITY_PREFIX,
self.to_bytes().to_base32(),
Variant::Bech32,
)
.expect("HRP is valid")
.to_uppercase()
.as_str(),
)
}
}