Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nostr Key Decoding #29

Merged
merged 4 commits into from
Mar 2, 2024
Merged

Nostr Key Decoding #29

merged 4 commits into from
Mar 2, 2024

Conversation

cryptoquick
Copy link
Member

No description provided.

Copy link
Collaborator

@rustchain64 rustchain64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@@ -84,7 +84,7 @@ pub fn decode(
padding: u32,
format: u8,
) -> Result<Vec<u8>, CarbonadoError> {
let format = Format::try_from(format)?;
let format = Format::from(format);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting you dropped "try_from" to "from", isn't that a downgrade.
Just wondering the logic for this.

Copy link
Member Author

@cryptoquick cryptoquick Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's better. The library we're using can guarantee infallibility at the type level.

@@ -1,7 +1,7 @@
use std::sync::Once;

use bao::Hash;
use bech32::{decode, encode, FromBase32, ToBase32, Variant};
use bech32::{decode, encode, Bech32m, Hrp};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will need to review the bao::Hask to understand the minus of "FromBase32, etc.and what is Hrp"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for bech32 encoding. HRP stands for Human Readable Part. You can read more in the BIP:
https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki

@rustchain64 rustchain64 merged commit b00096f into main Mar 2, 2024
3 checks passed
@rustchain64 rustchain64 deleted the verify-key branch March 2, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants