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
The computed stealth address private key.
Parameters
ephemeralPublicKey
- Type:
HexStringThe ephemeral public key returned from calling thegenerateStealthAddressfunction or emitted from theAnnounceevent.
const stealthPrivateKey = computeStealthKey({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPrivateKey: "0x...",
viewingPrivateKey: "0x...",
});schemeId
- Type:
VALID_SCHEME_IDThe scheme id used to generate the stealth address.
const stealthPrivateKey = computeStealthKey({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPrivateKey: "0x...",
viewingPrivateKey: "0x...",
});spendingPrivateKey
- Type:
HexStringThe spending private key used to generate the stealth meta-address.
const stealthPrivateKey = computeStealthKey({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPrivateKey: "0x...",
viewingPrivateKey: "0x...",
});viewingPrivateKey
- Type:
HexStringThe viewing private key used to generate the stealth meta-address.
const stealthPrivateKey = computeStealthKey({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPrivateKey: "0x...",
viewingPrivateKey: "0x...",
});