Using nostrconnect URI does work after the first time
sommerfelddev opened this issue · 2 comments
sommerfelddev commented
After using the fix of #490 with the same example in
it seems work at first. But if I cache the generated URI and app key in a json file and on a second run, read the URI from the file, parse it and use it as a Nip46Signer
, it times out in the same line as the original issue.
Amber does not show anything in the logs.
yukibtc commented
I think you have to cache the bunker URI and use that for next connections. You can get it after signer initialization:
First connection with nostrconnect://
let uri = NostrConnectURI::parse("nostrconnect://...")?;
let signer = Nip46Signer::new(uri, app_keys, Duration::from_secs(60), None).await?;
// Check if uri is "bunker"
let uri: NostrConnectURI = if uri.is_bunker() {
uri
} else {
signer.bunker_uri().await
};
// Cache bunker URI ...
// ...
Next connections:
// Get bunker URI from cache
// ...
let uri = NostrConnectURI::parse("bunker://...")?;
let signer = Nip46Signer::new(uri, app_keys, Duration::from_secs(60), None).await?;
// ...
sommerfelddev commented
Yeah, dummy me. This part of the spec is not so intuitive tbh. Thanks!