SDK
Utilities
computeStealthKey

computeStealthKey

Computes the stealth address private key by combining the spending private key with a hashed shared secret, which is derived from an ephemeral public key and a viewing private key.

Import

import { computeStealthKey } from "@scopelift/stealth-address-sdk";

Usage

import { computeStealthKey } from "@scopelift/stealth-address-sdk";
 
const stealthPrivateKey = computeStealthKey({
  ephemeralPublicKey,
  schemeId: 1,
  spendingPrivateKey,
  viewingPrivateKey
});
 
// "0x..."

Return Value

HexString

The computed stealth address private key.

Parameters

ephemeralPublicKey

const stealthPrivateKey = computeStealthKey({
  ephemeralPublicKey: "0x...",
  schemeId: 1,
  spendingPrivateKey: "0x...",
  viewingPrivateKey: "0x...",
});

schemeId

  • Type: VALID_SCHEME_ID The scheme id used to generate the stealth address.
const stealthPrivateKey = computeStealthKey({
  ephemeralPublicKey: "0x...",
  schemeId: 1,
  spendingPrivateKey: "0x...",
  viewingPrivateKey: "0x...",
});

spendingPrivateKey

  • Type: HexString The spending private key used to generate the stealth meta-address.
const stealthPrivateKey = computeStealthKey({
  ephemeralPublicKey: "0x...",
  schemeId: 1,
  spendingPrivateKey: "0x...",
  viewingPrivateKey: "0x...",
});

viewingPrivateKey

  • Type: HexString The viewing private key used to generate the stealth meta-address.
const stealthPrivateKey = computeStealthKey({
  ephemeralPublicKey: "0x...",
  schemeId: 1,
  spendingPrivateKey: "0x...",
  viewingPrivateKey: "0x...",
});