1
1
from nostr_protocol import Keys , Metadata , EventBuilder , PublicKey , verify_nip05 , get_nip05_profile
2
2
3
3
4
- def nip05 ():
4
+ async def nip05 ():
5
5
# ANCHOR: set-metadata
6
6
# Create metadata object with name and NIP05
7
7
metadata = Metadata () \
@@ -16,24 +16,17 @@ def nip05():
16
16
17
17
public_key = PublicKey .parse ("npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet" )
18
18
proxy = None
19
- try :
20
- verify_nip05 (public_key , nip_05 , proxy )
19
+ if await verify_nip05 (public_key , nip_05 , proxy ):
21
20
print (f" '{ nip_05 } ' verified, for { public_key .to_bech32 ()} " )
22
- except Exception as e :
23
- print (f" Unable to verify NIP-05, for { public_key .to_bech32 ()} : { e } " )
21
+ else :
22
+ print (f" Unable to verify NIP-05, for { public_key .to_bech32 ()} " )
24
23
# ANCHOR_END: verify-nip05
25
24
26
- # TODO: replace above code with the following one (due to changes to NIP-05 verify func)
27
- # if verify_nip05(public_key, nip_05, proxy):
28
- # print(f" '{nip_05}' verified, for {public_key.to_bech32()}")
29
- # else:
30
- # print(f" Unable to verify NIP-05, for {public_key.to_bech32()}")
31
-
32
25
print ()
33
26
34
27
# ANCHOR: nip05-profile
35
28
print ("Profile NIP-05:" )
36
-
37
- profile = get_nip05_profile (nip_05 )
29
+
30
+ profile = await get_nip05_profile (nip_05 )
38
31
print (f" { nip_05 } Profile: { profile .to_bech32 ()} " )
39
32
# ANCHOR_END: nip05-profile
0 commit comments