Skip to content

deriveNEARStealthPrivateKey()

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / 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.

StealthAddress

The one-time stealth address

`0x${string}`

Recipient’s spending private key

`0x${string}`

Recipient’s viewing private key

StealthAddressRecovery

Recovery data including the derived private key

// Recipient derives private key to spend funds
const recovery = deriveNEARStealthPrivateKey(
detectedPayment.stealthAddress,
mySpendingPrivateKey,
myViewingPrivateKey
)
// Use privateKey to sign NEAR transactions
const keypair = nearKeyFromPrivateKey(recovery.privateKey)