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
Generated
+8 -2
View File
@@ -31,7 +31,7 @@ version = "0.0.0"
source = "git+https://github.com/str4d/rage.git?rev=d8fd951e059d9f7116b2b9dd0d176798a11b49f3#d8fd951e059d9f7116b2b9dd0d176798a11b49f3" source = "git+https://github.com/str4d/rage.git?rev=d8fd951e059d9f7116b2b9dd0d176798a11b49f3#d8fd951e059d9f7116b2b9dd0d176798a11b49f3"
dependencies = [ dependencies = [
"age-core", "age-core",
"bech32", "bech32 0.7.3",
"chrono", "chrono",
"secrecy", "secrecy",
] ]
@@ -42,7 +42,7 @@ version = "0.0.0"
dependencies = [ dependencies = [
"age-core", "age-core",
"age-plugin", "age-plugin",
"bech32", "bech32 0.8.0",
"console", "console",
"elliptic-curve", "elliptic-curve",
"gumdrop", "gumdrop",
@@ -88,6 +88,12 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1"
[[package]]
name = "bech32"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c7f7096bc256f5e5cb960f60dfc4f4ef979ca65abe7fb9d5a4f77150d3783d4"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.2.1"
+1 -1
View File
@@ -13,7 +13,7 @@ edition = "2018"
[dependencies] [dependencies]
age-core = "0.5" age-core = "0.5"
age-plugin = "0.0" age-plugin = "0.0"
bech32 = "0.7.2" bech32 = "0.8"
console = "0.14" console = "0.14"
elliptic-curve = "0.8" elliptic-curve = "0.8"
gumdrop = "0.8" gumdrop = "0.8"
+6 -2
View File
@@ -1,4 +1,4 @@
use bech32::ToBase32; use bech32::{ToBase32, Variant};
use elliptic_curve::sec1::EncodedPoint; use elliptic_curve::sec1::EncodedPoint;
use p256::NistP256; use p256::NistP256;
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
@@ -22,7 +22,11 @@ impl fmt::Debug for Recipient {
impl fmt::Display for Recipient { impl fmt::Display for Recipient {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str( f.write_str(
bech32::encode(RECIPIENT_PREFIX, self.as_bytes().to_base32()) bech32::encode(
RECIPIENT_PREFIX,
self.as_bytes().to_base32(),
Variant::Bech32,
)
.expect("HRP is valid") .expect("HRP is valid")
.as_str(), .as_str(),
) )
+6 -2
View File
@@ -1,6 +1,6 @@
//! Structs for handling YubiKeys. //! Structs for handling YubiKeys.
use bech32::ToBase32; use bech32::{ToBase32, Variant};
use std::fmt; use std::fmt;
use std::thread::sleep; use std::thread::sleep;
use std::time::{Duration, SystemTime}; use std::time::{Duration, SystemTime};
@@ -81,7 +81,11 @@ pub struct Stub {
impl fmt::Display for Stub { impl fmt::Display for Stub {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str( f.write_str(
bech32::encode(IDENTITY_PREFIX, self.to_bytes().to_base32()) bech32::encode(
IDENTITY_PREFIX,
self.to_bytes().to_base32(),
Variant::Bech32,
)
.expect("HRP is valid") .expect("HRP is valid")
.to_uppercase() .to_uppercase()
.as_str(), .as_str(),