Compare commits
1 Commits
master
...
nprofile-q
| Author | SHA1 | Date | |
|---|---|---|---|
|
8f6ea4d8dd
|
@@ -440,21 +440,15 @@ fileprivate struct QRCameraView<Content: View>: View {
|
||||
str.removeFirst("nostr:".count)
|
||||
}
|
||||
|
||||
if let decoded = hex_decode(str),
|
||||
str.count == 64
|
||||
{
|
||||
self.pubkey = Pubkey(Data(decoded))
|
||||
return
|
||||
let bech32 = Bech32Object.parse(str)
|
||||
switch bech32 {
|
||||
case .nprofile(let nprofile):
|
||||
self.pubkey = nprofile.author
|
||||
case .npub(let pubkey):
|
||||
self.pubkey = pubkey
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
if str.starts(with: "npub"),
|
||||
let b32 = try? bech32_decode(str)
|
||||
{
|
||||
self.pubkey = Pubkey(b32.data)
|
||||
return
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user