checkStealthAddress
Checks if an Announce event is intended for the user by comparing the derived stealth address with the user's stealth address.
Import
import { checkStealthAddress } from "@scopelift/stealth-address-sdk";Usage
import { checkStealthAddress } from "@scopelift/stealth-address-sdk";
const isForUser = checkStealthAddress({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPublicKey: "0x...",
userStealthAddress: "0x...",
viewingPrivateKey: "0x...",
viewTag: "0x..."
});
// trueReturn Value
- Type:
booleanReturnstrueif the derived stealth address matches the user's stealth address, indicating the announcement is intended for the user; returnsfalseotherwise.
Parameters
ephemeralPublicKey
-
Type:
HexStringThe ephemeral public key from the announcement.
const isForUser = checkStealthAddress({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPublicKey: "0x...",
userStealthAddress: "0x...",
viewingPrivateKey: "0x...",
viewTag: "0x...",
});schemeId
-
Type:
VALID_SCHEME_IDThe scheme ID used during the stealth address generation.
const isForUser = checkStealthAddress({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPublicKey: "0x...",
userStealthAddress: "0x...",
viewingPrivateKey: "0x...",
viewTag: "0x...",
});spendingPublicKey
-
Type:
HexStringThe user's spending public key.
const isForUser = checkStealthAddress({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPublicKey: "0x...",
userStealthAddress: "0x...",
viewingPrivateKey: "0x...",
viewTag: "0x...",
});userStealthAddress
-
Type:
EthAddressThe user's stealth address, against which the derived address is compared.
const isForUser = checkStealthAddress({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPublicKey: "0x...",
userStealthAddress: "0x...",
viewingPrivateKey: "0x...",
viewTag: "0x...",
});viewingPrivateKey
-
Type:
HexStringThe user's viewing private key used to derive the shared secret.
const isForUser = checkStealthAddress({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPublicKey: "0x...",
userStealthAddress: "0x...",
viewingPrivateKey: "0x...",
viewTag: "0x...",
});viewTag
-
Type:
HexStringThe view tag from the announcement, used to quickly filter announcements not intended for the user.
const isForUser = checkStealthAddress({
ephemeralPublicKey: "0x...",
schemeId: 1,
spendingPublicKey: "0x...",
userStealthAddress: "0x...",
viewingPrivateKey: "0x...",
viewTag: "0x...",
});