Repository navigation
Harden 1.8 encoding, request validation, and relay handling - #35
Merged
Merged
Conversation
boufni95
approved these changes
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the remaining SDK findings from the 1.8 consistency/security review, in addition to the original oversized-TLV encoder fix. Targets
staging, the branch behind SDK 1.8 PR #32.Encoding and Decoding
noffer,ndebit, andnmanage, including UTF-8 string byte lengths and crafted identifiers containing routing TLVs.Number.MAX_SAFE_INTEGERrather than truncating to 32 bits. Existing nonzero unsigned-32-bit prices keep their four-byte representation; larger values use wider big-endian integers.NaN.nip19.decodeNostrURIthrough the same printable-ASCII check asnip19.decode, preserving the URI helper's invalid-result shape.Receipt Lifecycle and Relay Publication
Shutdown and Cancellation
Stop()cancels this instance's active requests, receipt subscriptions, and timers before destroying the pool. Pending requests reject withAbortError; already-resolved invoices remain resolved and their receipt listeners stop.Stop()reject without reconnecting; enrollment cannot restart a beacon lookup, PoW retry, or publish after shutdown.AbortSignal, preserving caller-provided abort reasons. Cancellation stops SDK activity, not a payment that the host may already have accepted.Validated Wire Payloads
amount_satsto be a positive safe integer andexpires_in_secondsto be a non-negative safe integer. Zero expiry remains permitted; invoice expiry is determined by the host.toJSON()methods and changing getters cannot substitute different offer or debit terms after validation.Verification
npm test: 164 passed, 0 failed, including TypeScript build and public type checks.Related Release Work
amount/invoicepayer-field fix is separate, on itsoffer-payer-data-quantitybranch.dash2.