mirror of
https://github.com/luxfi/bridge.git
synced 2026-09-24 00:26:46 +00:00
Introduces internal/xrpl, the bridge's XRP Ledger primitives package: - AddressFromPubKey / AccountIDFromPubKey: derive the canonical r-address from a 33-byte compressed-secp256k1 public key. Hash chain is RIPEMD160(SHA256(pubkey)), base58check-encoded with the XRPL alphabet + 0x00 version byte. Round-trips through the rubblelabs codec. - PreSign(PaymentUnsigned) → (32-byte digest, *SignCtx): builds a native XRP Payment, embeds the signing pubkey on the wire, returns the SHA-512Half of (0x53545800 || serialized_body) — exactly the message the MPC quorum must sign. - Finalize(DER, *SignCtx) → (signedBlob, txHash): attaches the DER signature to TxnSignature, returns the full wire-format binary blob (suitable for submit's tx_blob param as hex) and the canonical XRPL tx hash (SHA-512Half of 0x54584E00 || blob). - EncodeDERSignature(r, s): ASN.1 DER encode (r, s) with low-s normalization (rejects high-s as XRPL's tfFullyCanonicalSig requires) and the 0x00 leading-byte rule for INTEGERs with the MSB set. - CanonicalizeS / SHA512Half exposed for tests + future TrustSet path. Uses github.com/rubblelabs/ripple for the deep binary codec — every field-id, type-byte, and length-prefix detail is the library's responsibility. The bridge owns only the signing flow on top, so MPC ECDSA can stand in for the library's local-key Sign helper. Tests cover: canonical pubkey → r-address round-trip, rejection of bad pubkey lengths/prefixes, DER encoding of standard and high-bit cases, low-s flip for s > N/2, validation that high-s gets canonicalized in EncodeDERSignature, PreSign digest matching independent SHA512Half recomputation, full PreSign → Finalize round-trip via the parser.
56 lines
2.1 KiB
AMPL
56 lines
2.1 KiB
AMPL
module github.com/luxfi/bridge
|
|
|
|
go 1.26.3
|
|
|
|
require (
|
|
github.com/gofiber/fiber/v3 v3.2.0
|
|
github.com/hanzoai/zip v0.2.0
|
|
github.com/luxfi/log v1.4.3
|
|
github.com/luxfi/zapdb v1.8.0
|
|
github.com/rubblelabs/ripple v0.0.0-20240324121851-6816ca31ba51
|
|
golang.org/x/crypto v0.50.0
|
|
gopkg.in/yaml.v3 v3.0.1
|
|
)
|
|
|
|
require (
|
|
filippo.io/hpke v0.4.0 // indirect
|
|
github.com/andybalholm/brotli v1.2.1 // indirect
|
|
github.com/bits-and-blooms/bitset v1.2.1 // indirect
|
|
github.com/btcsuite/btcd/btcec/v2 v2.1.3 // indirect
|
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
|
github.com/dgraph-io/ristretto/v2 v2.2.0 // indirect
|
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
|
github.com/go-ini/ini v1.67.0 // indirect
|
|
github.com/go-logr/logr v1.4.3 // indirect
|
|
github.com/go-logr/stdr v1.2.2 // indirect
|
|
github.com/gofiber/schema v1.7.1 // indirect
|
|
github.com/gofiber/utils/v2 v2.0.4 // indirect
|
|
github.com/google/flatbuffers v25.2.10+incompatible // indirect
|
|
github.com/google/uuid v1.6.0 // indirect
|
|
github.com/klauspost/compress v1.18.5 // indirect
|
|
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
|
|
github.com/klauspost/crc32 v1.3.0 // indirect
|
|
github.com/luxfi/age v1.4.0 // indirect
|
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
|
github.com/mattn/go-isatty v0.0.21 // indirect
|
|
github.com/minio/crc64nvme v1.1.1 // indirect
|
|
github.com/minio/md5-simd v1.1.2 // indirect
|
|
github.com/minio/minio-go/v7 v7.0.100 // indirect
|
|
github.com/philhofer/fwd v1.2.0 // indirect
|
|
github.com/rs/xid v1.6.0 // indirect
|
|
github.com/tinylib/msgp v1.6.4 // indirect
|
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
|
github.com/valyala/fasthttp v1.70.0 // indirect
|
|
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
|
go.opentelemetry.io/otel v1.37.0 // indirect
|
|
go.opentelemetry.io/otel/metric v1.37.0 // indirect
|
|
go.opentelemetry.io/otel/trace v1.37.0 // indirect
|
|
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
|
golang.org/x/net v0.53.0 // indirect
|
|
golang.org/x/sys v0.43.0 // indirect
|
|
golang.org/x/text v0.36.0 // indirect
|
|
google.golang.org/protobuf v1.36.7 // indirect
|
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
|
)
|