support --auth/--sec/--prompt-sec on req.

This commit is contained in:
fiatjaf
2023-12-09 16:32:04 -03:00
parent ed3156ae10
commit b7b61c0723
7 changed files with 78 additions and 65 deletions

View File

@@ -109,9 +109,13 @@ func validate32BytesHex(target string) error {
return nil
}
func connectToAllRelays(ctx context.Context, relayUrls []string) (*nostr.SimplePool, []*nostr.Relay) {
func connectToAllRelays(
ctx context.Context,
relayUrls []string,
opts ...nostr.PoolOption,
) (*nostr.SimplePool, []*nostr.Relay) {
relays := make([]*nostr.Relay, 0, len(relayUrls))
pool := nostr.NewSimplePool(ctx)
pool := nostr.NewSimplePool(ctx, opts...)
for _, url := range relayUrls {
log("connecting to %s... ", url)
if relay, err := pool.EnsureRelay(url); err == nil {
@@ -164,7 +168,3 @@ func gatherSecretKeyFromArguments(c *cli.Context) (string, error) {
return sec, nil
}
func isAuthRequired(msg string) bool {
return strings.HasPrefix(msg, "msg: auth-required:")
}