Skip to content

nipIC: Identity Connection package + nipAZ Identity refactor - #4

Merged
naliyi merged 4 commits into
mainfrom
nip57-altzap-receipt-resolved-fields
Sep 3, 2026
Merged

nipIC: Identity Connection package + nipAZ Identity refactor#4
naliyi merged 4 commits into
mainfrom
nip57-altzap-receipt-resolved-fields

Conversation

@naliyi

@naliyi naliyi commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Closes #3

Summary

  • New nipIC package implementing NIP-IC (Identity Connection): attestation (Kind 35522), identity connection (Kind 35521), npv1 cross-IA challenge binding, nconnection bech32 encoding.
  • nipAZ now depends on nipIC and gains an Identity type (Pubkey/Connection/ResolvedConnection) replacing raw string Recipient/Sender/*Provider params — breaking.
  • All nipAZ.New* constructors sign internally now and return (*nip01.Event, error)breaking.
  • Security fix: NewAltZapReceipt no longer silently re-derives p/P tags from the embedded request's description JSON.
  • nipIC.NewChallenge entropy fixed to 16 bytes to match its real caller.
  • Also includes fa48c46 (LIDP→Web Identity terminology cleanup), already on this branch from a previous push but never merged.

Test plan

  • go build ./..., go vet ./..., go test ./... clean (verified both after the nipIC-only commit in isolation, and after the full stack)
  • New nipIC test files cover attestation, identity connection, nconnection encoding, challenge token

Implements attestation (Kind 35522) and identity connection (Kind 35521)
construction/parsing/validation, the npv1 cross-IA challenge token, and
the nconnection bech32 profile-link encoding — extracted so nipAZ (and
any other consumer) can depend on it instead of every caller hand-rolling
its own copy.

Refs #3
Breaking:
- AltZapRequestParams/AltZapReceiptParams no longer take raw
  Recipient/Sender/*Provider strings — Recipient and Sender are now
  Identity, built via Pubkey(hex), Connection(platform, externalID), or
  ResolvedConnection(key, platform). WebIdentity and ConnectionKey are
  re-exported from nipIC under nipAZ's own names.
- All New* constructors (NewAltZapRequest, NewAltZapOnBehalfRequest,
  NewAltZapReceipt) now sign internally via a required PrivateKey param
  and return (*nip01.Event, error) — callers no longer call .Sign()
  themselves.
- NewAltZapOnBehalfRequest now takes sender as a required positional
  Identity argument instead of an optional params field, so an invalid
  5523 (missing P tag) can't be constructed.

Security fix:
- NewAltZapReceipt no longer silently re-derives its p/P tags by parsing
  the embedded request's description JSON — it only ever uses the
  Identity values the caller explicitly passed. The old behavior let a
  tampered embedded request redirect a receipt's attribution.

Refs #3
README: add nipIC to Implemented NIPs, add a combined nipAZ+nipIC
example (zapping a Web Identity recipient via nipAZ.Connection), fix
the existing nipAZ example which still showed the old
construct-then-.Sign() pattern. Link both NIP entries at the zapf-nips
GitHub repo instead of docs.zapf.app.

CHANGELOG: open the 0.2.7 entry for this work.

Refs #3
@naliyi
naliyi marked this pull request as ready for review September 3, 2026 05:27
@naliyi
naliyi merged commit 253a799 into main Sep 3, 2026
1 check passed
naliyi added a commit that referenced this pull request Sep 3, 2026
The 0.2.7 entry was missing the Changed/Breaking section entirely (the
Identity type + internal-signing API changes weren't called out at
all) and none of its bullets had a PR backreference — matching 0.2.6's
established pattern of a (#N) tag on every bullet, filled in once the
PR number is known, so the eventual release notes stay traceable.
naliyi added a commit that referenced this pull request Sep 3, 2026
changelog: add (#4) PR backreferences, document breaking nipAZ changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nipIC package (NIP-IC) and fix AltZapReceipt tag security gap

1 participant