commit 61bd95e5cbe0c35ae296e0121e08d804a1cbef3a
parent 5b24d9b933541834e4082b2ef7fa3c7da60ac3b9
Author: Jared Tobin <jared@jtobin.io>
Date: Mon, 20 Apr 2026 15:19:56 +0800
lib: hide newtype constructors from public API
Update BOLT4 re-export module to export Hmac32, HopPayloads, and
PaymentSecret without (..), so raw constructors are hidden from
external users. Internal modules and tests import from Types
directly and retain full access.
Diffstat:
1 file changed, 66 insertions(+), 1 deletion(-)
diff --git a/lib/Lightning/Protocol/BOLT4.hs b/lib/Lightning/Protocol/BOLT4.hs
@@ -15,7 +15,72 @@ module Lightning.Protocol.BOLT4 (
module Lightning.Protocol.BOLT4.Blinding
, module Lightning.Protocol.BOLT4.Codec
, module Lightning.Protocol.BOLT4.Prim
- , module Lightning.Protocol.BOLT4.Types
+
+ -- * Fixed-size newtypes
+ , Hmac32
+ , hmac32
+ , unHmac32
+ , HopPayloads
+ , hopPayloads
+ , unHopPayloads
+ , PaymentSecret
+ , paymentSecret
+ , unPaymentSecret
+
+ -- * Packet types
+ , OnionPacket(..)
+ , HopPayload(..)
+ , ShortChannelId(..)
+ , shortChannelId
+ , scidBlockHeight
+ , scidTxIndex
+ , scidOutputIndex
+ , scidWord64
+ , PaymentData(..)
+ , TlvRecord(..)
+
+ -- * Error types
+ , FailureMessage(..)
+ , FailureCode(..)
+ -- ** Flag bits
+ , pattern BADONION
+ , pattern PERM
+ , pattern NODE
+ , pattern UPDATE
+ -- ** Common failure codes
+ , pattern InvalidRealm
+ , pattern TemporaryNodeFailure
+ , pattern PermanentNodeFailure
+ , pattern RequiredNodeFeatureMissing
+ , pattern InvalidOnionVersion
+ , pattern InvalidOnionHmac
+ , pattern InvalidOnionKey
+ , pattern TemporaryChannelFailure
+ , pattern PermanentChannelFailure
+ , pattern AmountBelowMinimum
+ , pattern FeeInsufficient
+ , pattern IncorrectCltvExpiry
+ , pattern ExpiryTooSoon
+ , pattern IncorrectOrUnknownPaymentDetails
+ , pattern FinalIncorrectCltvExpiry
+ , pattern FinalIncorrectHtlcAmount
+ , pattern ChannelDisabled
+ , pattern ExpiryTooFar
+ , pattern InvalidOnionPayload
+ , pattern MppTimeout
+
+ -- * Processing results
+ , ProcessResult(..)
+ , ForwardInfo(..)
+ , ReceiveInfo(..)
+
+ -- * Constants
+ , onionPacketSize
+ , hopPayloadsSize
+ , hmacSize
+ , pubkeySize
+ , versionByte
+ , maxPayloadSize
) where
import Lightning.Protocol.BOLT4.Blinding