From fd34cc7c5e679a0283aba3484367c5845cbd29a1 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 19 Feb 2026 15:08:21 -0600 Subject: [PATCH] git clone: support NIP-05 names in nostr:// URIs Resolve NIP-05 identifiers (e.g. chad@chadwick.site) in the owner position of nostr:// URIs, so 'nak git clone nostr://user@domain/relay/id' works without manually resolving to an npub first. --- git.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/git.go b/git.go index 1dc7990..a080acd 100644 --- a/git.go +++ b/git.go @@ -1465,23 +1465,20 @@ func parseRepositoryAddress( return ptr.PublicKey, ptr.Identifier, ptr.Relays, nil } - // format 2: nostr://// (ngit-style) + // format 2: nostr://// (ngit-style) if strings.HasPrefix(address, "nostr://") { parts := strings.Split(address, "/") if len(parts) != 5 { return nostr.PubKey{}, "", nil, fmt.Errorf( - "invalid nostr URL format, expected nostr:////, got: %s", address, + "invalid nostr URL format, expected nostr:////, got: %s", address, ) } - prefix, data, err := nip19.Decode(parts[2]) + owner, err = parsePubKey(parts[2]) if err != nil { - return nostr.PubKey{}, "", nil, fmt.Errorf("invalid owner public key: %w", err) + return nostr.PubKey{}, "", nil, fmt.Errorf("invalid owner in URL: %w", err) } - if prefix != "npub" { - return nostr.PubKey{}, "", nil, fmt.Errorf("expected npub in URL") - } - owner = data.(nostr.PubKey) + relayHost := parts[3] identifier = parts[4]