Type42 class
BRC-42 (BSV "type-42") key derivation.
Pure crypto — no isolate, no UI, no key storage. This is the shared primitive
behind NodeCast's broker-as-verifier pay-per-view gate (see
overnode_v2's docs/nodecast/ARCHITECTURE.md §6): the payer derives a per-invoice payment
destination C from the creator's public key without the creator's private
key, and the creator later recomputes the matching spend key.
Construction — must match bitcoin-sv/bsv-blockchain/go-sdk and the
Tier-0 harness (overnode_v2's docs/nodecast/tier0) byte-for-byte:
sharedSecret = (priv · pub) point, serialized COMPRESSED (33 bytes)
t = HMAC-SHA256(key = sharedSecretCompressed, msg = utf8(invoiceNumber))
childPub C = recipientPub + t·G
childPriv c = (recipientPriv + t) mod N
Verified against the official BRC-42 test vectors — see
test/crypto/type42_test.dart. This is net-new crypto we own and it sits on
the money path (R6): keep it test-vector-pinned.
All elliptic-curve math is routed through dartsv's own secp256k1 instance
(t·G is computed via a private key, never a foreign generator) to avoid
silent cross-instance curve mismatches.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
deriveChildPrivate(
SVPrivateKey recipientPriv, SVPublicKey senderPub, String invoiceNumber) → SVPrivateKey -
Child private key
c = (recipientPriv + t) mod N— the spend key matching deriveChildPublic. -
deriveChildPublic(
SVPublicKey recipientPub, SVPrivateKey senderPriv, String invoiceNumber) → SVPublicKey -
Child public key
C = recipientPub + t·G. -
ECDH shared secret between
privandpub, serialized as a COMPRESSED secp256k1 point (33 bytes). -
tweak(
String invoiceNumber) → BigInt -
Per-invoice tweak scalar
t = HMAC-SHA256(key = sharedSecretCompressed, msg = utf8(invoiceNumber)), interpreted as a big-endian integer.