derivePublicKey
Derives dust public key from a 32-byte seed using Midnight's algorithm.
Input: The seed should be derived from BIP-32 at path m/44'/2400'/account'/2/index:
Derive using HDWallet with role
MidnightKeyRole.DUSTExtract the 32-byte private key
Pass it to this function
Output: 33-byte public key (1-byte tag + 32 bytes data) encoded as 66-character hex string. This is the DustPublicKey used to receive dust tokens.
Security:
This function does NOT clear the seed - caller must wipe it
Public key is safe to share/store - it's public information
The seed MUST be kept secret - it's the DustSecretKey
Compatibility: The output matches Midnight SDK:
const dustSecretKey = DustSecretKey.fromSeed(seed);
const dustPublicKey = dustSecretKey.toPublicKey(); // Matches our outputError Handling: Returns null if:
Native library not loaded
Native function returns null (internal error)
Returned key fails validation (invalid hex format)
Throws IllegalArgumentException if seed is not exactly 32 bytes.
Return
66-character hex string of dust public key (with tag), or null on error
Parameters
32-byte seed derived from BIP-32 at m/44'/2400'/account'/2/index
Throws
if seed is not 32 bytes