mirror of
git://jb55.com/damus
synced 2024-09-19 11:43:44 +00:00
add bech32_pubkey_decode
I need this for a test
This commit is contained in:
parent
3845d32074
commit
6481f96488
@ -72,6 +72,14 @@ func bech32_pubkey(_ pubkey: String) -> String? {
|
||||
return bech32_encode(hrp: "npub", bytes)
|
||||
}
|
||||
|
||||
func bech32_pubkey_decode(_ pubkey: String) -> String? {
|
||||
guard let decoded = try? bech32_decode(pubkey), decoded.hrp == "npub" else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return hex_encode(decoded.data)
|
||||
}
|
||||
|
||||
func bech32_nopre_pubkey(_ pubkey: String) -> String? {
|
||||
guard let bytes = hex_decode(pubkey) else {
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user