nip46: auth_url support.

This commit is contained in:
fiatjaf
2024-02-29 20:37:16 -03:00
parent 6d5aef70c5
commit f75501e7ef
2 changed files with 25 additions and 6 deletions

View File

@@ -29,6 +29,7 @@ func CreateAccount(
domain string,
pool *nostr.SimplePool,
extraOpts *CreateAccountOptions,
onAuth func(string),
) (*BunkerClient, error) {
if pool == nil {
pool = nostr.NewSimplePool(ctx)
@@ -46,6 +47,7 @@ func CreateAccount(
providerPubkey,
relays,
pool,
onAuth,
)
clientPubKey, _ := nostr.GetPublicKey(clientSecretKey)
@@ -69,6 +71,7 @@ func CreateAccount(
// update this bunker instance so it targets the new key now instead of the provider
bunker.target = newlyCreatedPublicKey
bunker.sharedSecret, _ = nip04.ComputeSharedSecret(newlyCreatedPublicKey, clientSecretKey)
bunker.getPublicKeyResponse = newlyCreatedPublicKey
// finally try to connect again using the new key as the target
_, err = bunker.RPC(ctx, "connect", []string{newlyCreatedPublicKey, ""})