deriveNEARStealthPrivateKey()
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / deriveNEARStealthPrivateKey
Function: deriveNEARStealthPrivateKey()
Section titled “Function: deriveNEARStealthPrivateKey()”deriveNEARStealthPrivateKey(
stealthAddress,spendingPrivateKey,viewingPrivateKey):StealthAddressRecovery
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:18173
Derive the private key for a NEAR stealth address
The recipient uses this to derive the private key that controls the funds sent to a stealth address.
Parameters
Section titled “Parameters”stealthAddress
Section titled “stealthAddress”The one-time stealth address
spendingPrivateKey
Section titled “spendingPrivateKey”`0x${string}`
Recipient’s spending private key
viewingPrivateKey
Section titled “viewingPrivateKey”`0x${string}`
Recipient’s viewing private key
Returns
Section titled “Returns”Recovery data including the derived private key
Example
Section titled “Example”// Recipient derives private key to spend fundsconst recovery = deriveNEARStealthPrivateKey( detectedPayment.stealthAddress, mySpendingPrivateKey, myViewingPrivateKey)
// Use privateKey to sign NEAR transactionsconst keypair = nearKeyFromPrivateKey(recovery.privateKey)