Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/StealthAddress

primitives/StealthAddress

Classes

InvalidAnnouncementError

Defined in: src/primitives/StealthAddress/errors.js:60 Invalid announcement format

Extends

Constructors

Constructor
new InvalidAnnouncementError(message, options): InvalidAnnouncementError
Defined in: src/primitives/StealthAddress/errors.js:61
Parameters
message
any
options
Returns
InvalidAnnouncementError
Overrides
StealthAddressError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
StealthAddressError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
StealthAddressError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:66
Inherited from
StealthAddressError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON

InvalidEphemeralPublicKeyError

Defined in: src/primitives/StealthAddress/errors.js:47 Invalid ephemeral public key

Extends

Constructors

Constructor
new InvalidEphemeralPublicKeyError(message, options): InvalidEphemeralPublicKeyError
Defined in: src/primitives/StealthAddress/errors.js:48
Parameters
message
any
options
Returns
InvalidEphemeralPublicKeyError
Overrides
StealthAddressError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
StealthAddressError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
StealthAddressError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:53
Inherited from
StealthAddressError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON

InvalidPublicKeyError

Defined in: src/primitives/StealthAddress/errors.js:34 Invalid public key format or length

Extends

Constructors

Constructor
new InvalidPublicKeyError(message, options): InvalidPublicKeyError
Defined in: src/primitives/StealthAddress/errors.js:35
Parameters
message
any
options
Returns
InvalidPublicKeyError
Overrides
StealthAddressError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
StealthAddressError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
StealthAddressError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:40
Inherited from
StealthAddressError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON

InvalidStealthMetaAddressError

Defined in: src/primitives/StealthAddress/errors.js:21 Invalid stealth meta-address format or length

Extends

Constructors

Constructor
new InvalidStealthMetaAddressError(message, options): InvalidStealthMetaAddressError
Defined in: src/primitives/StealthAddress/errors.js:22
Parameters
message
any
options
Returns
InvalidStealthMetaAddressError
Overrides
StealthAddressError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
StealthAddressError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
StealthAddressError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:27
Inherited from
StealthAddressError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON

StealthAddressError

Defined in: src/primitives/StealthAddress/errors.js:7 Base error for StealthAddress operations

Extends

Extended by

Constructors

Constructor
new StealthAddressError(message, options): StealthAddressError
Defined in: src/primitives/StealthAddress/errors.js:8
Parameters
message
any
options
Returns
StealthAddressError
Overrides
PrimitiveError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
PrimitiveError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
PrimitiveError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
PrimitiveError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
PrimitiveError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:14
Inherited from
PrimitiveError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
PrimitiveError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
PrimitiveError.toJSON

StealthAddressGenerationError

Defined in: src/primitives/StealthAddress/errors.js:73 Stealth address generation failed

Extends

Constructors

Constructor
new StealthAddressGenerationError(message, options): StealthAddressGenerationError
Defined in: src/primitives/StealthAddress/errors.js:74
Parameters
message
any
options
Returns
StealthAddressGenerationError
Overrides
StealthAddressError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
StealthAddressError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
StealthAddressError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:79
Inherited from
StealthAddressError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON

Interfaces

CheckStealthAddressResult

Defined in: src/primitives/StealthAddress/StealthAddressType.ts:92 Result of stealth address checking

Properties

isForRecipient
isForRecipient: boolean
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:93
stealthPrivateKey?
optional stealthPrivateKey: Uint8Array<ArrayBufferLike>
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:94

GenerateStealthAddressResult

Defined in: src/primitives/StealthAddress/StealthAddressType.ts:83 Result of stealth address generation

Properties

ephemeralPublicKey
ephemeralPublicKey: EphemeralPublicKey
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:85
stealthAddress
stealthAddress: AddressType
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:84
viewTag
viewTag: number
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:86

StealthAnnouncement

Defined in: src/primitives/StealthAddress/StealthAddressType.ts:74 Stealth address announcement On-chain data published by sender containing ephemeral public key and view tag. Enables recipient to scan for stealth addresses.

Properties

ephemeralPublicKey
ephemeralPublicKey: EphemeralPublicKey
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:75
stealthAddress
stealthAddress: AddressType
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:77
viewTag
viewTag: number
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:76

Type Aliases

EphemeralPublicKey

EphemeralPublicKey = Uint8Array & object
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:55 Ephemeral public key (33 bytes compressed) One-time public key generated by sender and announced on-chain. Used by recipient to derive shared secret for stealth address detection.

Type Declaration

__tag
readonly __tag: "EphemeralPublicKey"

SpendingPublicKey

SpendingPublicKey = Uint8Array & object
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:35 Spending public key (33 bytes compressed) Compressed secp256k1 public key used for deriving stealth addresses. Recipient uses corresponding private key to spend from stealth addresses.

Type Declaration

__tag
readonly __tag: "SpendingPublicKey"

StealthMetaAddress

StealthMetaAddress = Uint8Array & object
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:25 Stealth meta-address (66 bytes) Concatenation of spending public key (33 bytes compressed) and viewing public key (33 bytes compressed). Published by recipient to enable non-interactive stealth address generation. Format: spendingPubKey (33) || viewingPubKey (33)

Type Declaration

__tag
readonly __tag: "StealthMetaAddress"

See

https://eips.ethereum.org/EIPS/eip-5564#stealth-meta-address-format

ViewingPublicKey

ViewingPublicKey = Uint8Array & object
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:45 Viewing public key (33 bytes compressed) Compressed secp256k1 public key used for scanning blockchain. Recipient uses corresponding private key to detect stealth addresses.

Type Declaration

__tag
readonly __tag: "ViewingPublicKey"

ViewTag

ViewTag = number
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:66 View tag (1 byte) First byte of hashed shared secret. Enables fast rejection of non-matching stealth addresses (~255/256 probability). Reduces scanning overhead by ~6x.

Variables

COMPRESSED_PUBLIC_KEY_SIZE

const COMPRESSED_PUBLIC_KEY_SIZE: 33 = 33
Defined in: src/primitives/StealthAddress/constants.js:19 Compressed public key length (33 bytes) Format: 0x02/0x03 prefix + x-coordinate (32 bytes)

PRIVATE_KEY_SIZE

const PRIVATE_KEY_SIZE: 32 = 32
Defined in: src/primitives/StealthAddress/constants.js:30 Private key length (32 bytes)

SCHEME_ID

const SCHEME_ID: 1 = 1
Defined in: src/primitives/StealthAddress/constants.js:41 ERC-5564 scheme ID for SECP256k1 with view tags

STEALTH_META_ADDRESS_SIZE

const STEALTH_META_ADDRESS_SIZE: 66 = 66
Defined in: src/primitives/StealthAddress/constants.js:13 Stealth meta-address length (66 bytes) Format: spendingPubKey (33) || viewingPubKey (33)

UNCOMPRESSED_PUBLIC_KEY_SIZE

const UNCOMPRESSED_PUBLIC_KEY_SIZE: 64 = 64
Defined in: src/primitives/StealthAddress/constants.js:25 Uncompressed public key length (64 bytes) Format: x-coordinate (32) || y-coordinate (32)

VIEW_TAG_SIZE

const VIEW_TAG_SIZE: 1 = 1
Defined in: src/primitives/StealthAddress/constants.js:36 View tag size (1 byte) First byte of hashed shared secret

Functions

checkStealthAddress()

checkStealthAddress(viewingPrivateKey, ephemeralPublicKey, viewTag, spendingPublicKey, stealthAddress): CheckStealthAddressResult
Defined in: src/primitives/StealthAddress/checkStealthAddress.js:48 Check if stealth address belongs to recipient Implements ERC-5564 stealth address checking:
  1. Compute shared secret: ECDH(viewingPrivKey, ephemeralPubKey)
  2. Hash shared secret
  3. Check view tag matches (fast rejection)
  4. If matches, compute stealth private key
  5. Derive address and verify match

Parameters

viewingPrivateKey
Uint8Array<ArrayBufferLike> 32-byte viewing private key
ephemeralPublicKey
EphemeralPublicKey 33-byte compressed ephemeral public key
viewTag
number View tag from announcement
spendingPublicKey
SpendingPublicKey 33-byte compressed spending public key
stealthAddress
AddressType Announced stealth address

Returns

CheckStealthAddressResult Match result with optional stealth private key

See

Since

0.0.0

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';

// Recipient scans announcements
const result = StealthAddress.checkStealthAddress(
  viewingPrivateKey,
  announcement.ephemeralPublicKey,
  announcement.viewTag,
  spendingPublicKey,
  announcement.stealthAddress
);

if (result.isForRecipient) {
  console.log('Found stealth payment!');
  // Use result.stealthPrivateKey to spend
}

compressPublicKey()

compressPublicKey(uncompressed): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/StealthAddress/compressPublicKey.js:27 Compress uncompressed secp256k1 public key Converts 64-byte uncompressed format (x, y) to 33-byte compressed format. Uses 0x02 prefix if y is even, 0x03 if y is odd.

Parameters

uncompressed
Uint8Array<ArrayBufferLike> 64-byte uncompressed public key

Returns

Uint8Array<ArrayBufferLike> 33-byte compressed public key

See

https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation

Since

0.0.0

Throws

If input length is invalid

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';
const uncompressed = new Uint8Array(64); // x || y
const compressed = StealthAddress.compressPublicKey(uncompressed);
console.log(compressed.length); // 33

computeStealthPrivateKey()

computeStealthPrivateKey(spendingPrivateKey, hashedSharedSecret): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/StealthAddress/computeStealthPrivateKey.js:32 Compute stealth private key from spending private key and shared secret hash Implements ERC-5564 private key derivation: stealthPrivateKey = (spendingPrivateKey + hashedSharedSecret) mod n Where n is the secp256k1 curve order.

Parameters

spendingPrivateKey
Uint8Array<ArrayBufferLike> 32-byte spending private key
hashedSharedSecret
Uint8Array<ArrayBufferLike> 32-byte hashed shared secret

Returns

Uint8Array<ArrayBufferLike> 32-byte stealth private key

See

Since

0.0.0

Throws

If computation fails

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';

// After finding matching stealth address
const stealthPrivKey = StealthAddress.computeStealthPrivateKey(
  spendingPrivateKey,
  hashedSharedSecret
);
// Use stealthPrivKey to spend from stealth address

computeViewTag()

computeViewTag(hashedSharedSecret): number
Defined in: src/primitives/StealthAddress/computeViewTag.js:26 Compute view tag from hashed shared secret Extracts first byte of hashed shared secret as view tag. Enables fast rejection of non-matching stealth addresses.

Parameters

hashedSharedSecret
Uint8Array<ArrayBufferLike> 32-byte keccak256 hash of shared secret

Returns

number View tag (first byte as number)

See

Since

0.0.0

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';
import * as Keccak256 from './crypto/Keccak256/index.js';

const sharedSecret = new Uint8Array(32);
const hash = Keccak256.hash(sharedSecret);
const viewTag = StealthAddress.computeViewTag(hash);
console.log(typeof viewTag); // 'number'
console.log(viewTag >= 0 && viewTag <= 255); // true

decompressPublicKey()

decompressPublicKey(compressed): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/StealthAddress/decompressPublicKey.js:26 Decompress compressed secp256k1 public key Converts 33-byte compressed format to 64-byte uncompressed format. Decompresses by reconstructing y-coordinate from x and prefix.

Parameters

compressed
Uint8Array<ArrayBufferLike> 33-byte compressed public key

Returns

Uint8Array<ArrayBufferLike> 64-byte uncompressed public key

See

https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation

Since

0.0.0

Throws

If input length is invalid or decompression fails

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';
const compressed = new Uint8Array(33);
compressed[0] = 0x02; // even y
const uncompressed = StealthAddress.decompressPublicKey(compressed);
console.log(uncompressed.length); // 64

generateMetaAddress()

generateMetaAddress(spendingPubKey, viewingPubKey): StealthMetaAddress
Defined in: src/primitives/StealthAddress/generateMetaAddress.js:36 Generate stealth meta-address from spending and viewing public keys Concatenates 33-byte compressed spending and viewing public keys into 66-byte stealth meta-address for ERC-5564.

Parameters

spendingPubKey
SpendingPublicKey 33-byte compressed spending public key
viewingPubKey
ViewingPublicKey 33-byte compressed viewing public key

Returns

StealthMetaAddress 66-byte stealth meta-address

See

Since

0.0.0

Throws

If either public key has invalid length

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';
import * as Secp256k1 from './crypto/Secp256k1/index.js';

const spendingPubKey = StealthAddress.compressPublicKey(
  Secp256k1.derivePublicKey(spendingPrivateKey)
);
const viewingPubKey = StealthAddress.compressPublicKey(
  Secp256k1.derivePublicKey(viewingPrivateKey)
);
const metaAddress = StealthAddress.generateMetaAddress(spendingPubKey, viewingPubKey);
console.log(metaAddress.length); // 66

generateStealthAddress()

generateStealthAddress(metaAddress, ephemeralPrivateKey): GenerateStealthAddressResult
Defined in: src/primitives/StealthAddress/generateStealthAddress.js:48 Generate stealth address from meta-address Implements ERC-5564 stealth address generation:
  1. Parse meta-address → spending + viewing public keys
  2. Compute shared secret: ECDH(ephemeralPrivKey, viewingPubKey)
  3. Hash shared secret: keccak256(sharedSecret)
  4. Derive view tag: first byte of hash
  5. Compute stealth pubkey: spendingPubKey + hash * G
  6. Derive stealth address from pubkey

Parameters

metaAddress
StealthMetaAddress 66-byte stealth meta-address
ephemeralPrivateKey
Uint8Array<ArrayBufferLike> 32-byte ephemeral private key

Returns

GenerateStealthAddressResult Stealth address, ephemeral pubkey, view tag

See

Since

0.0.0

Throws

If generation fails

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';
import * as Secp256k1 from './crypto/Secp256k1/index.js';

// Recipient publishes meta-address
const metaAddress = StealthAddress.generateMetaAddress(spendingPubKey, viewingPubKey);

// Sender generates stealth address
const ephemeralPrivKey = new Uint8Array(32);
crypto.getRandomValues(ephemeralPrivKey);
const result = StealthAddress.generateStealthAddress(metaAddress, ephemeralPrivKey);

console.log(result.stealthAddress); // 20-byte address
console.log(result.ephemeralPublicKey); // 33-byte compressed pubkey
console.log(result.viewTag); // 0-255

parseAnnouncement()

parseAnnouncement(announcement): object
Defined in: src/primitives/StealthAddress/parseAnnouncement.js:26 Parse stealth address announcement Extracts ephemeral public key (33 bytes) and view tag (1 byte) from announcement data.

Parameters

announcement
Uint8Array<ArrayBufferLike> Announcement bytes (ephemeralPubKey + viewTag)

Returns

object Parsed announcement
ephemeralPublicKey
ephemeralPublicKey: EphemeralPublicKey
viewTag
viewTag: number

See

Since

0.0.0

Throws

If announcement length is invalid

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';
const announcement = new Uint8Array(34); // 33 + 1
const { ephemeralPublicKey, viewTag } = StealthAddress.parseAnnouncement(announcement);
console.log(ephemeralPublicKey.length); // 33
console.log(typeof viewTag); // 'number'

parseMetaAddress()

parseMetaAddress(metaAddress): object
Defined in: src/primitives/StealthAddress/parseMetaAddress.js:28 Parse stealth meta-address into spending and viewing public keys Splits 66-byte meta-address into 33-byte compressed public keys.

Parameters

metaAddress
StealthMetaAddress 66-byte stealth meta-address

Returns

object Parsed public keys
spendingPubKey
spendingPubKey: SpendingPublicKey
viewingPubKey
viewingPubKey: ViewingPublicKey

See

Since

0.0.0

Throws

If meta-address length is invalid

Example

import * as StealthAddress from './primitives/StealthAddress/index.js';
const metaAddress = new Uint8Array(66);
const { spendingPubKey, viewingPubKey } = StealthAddress.parseMetaAddress(metaAddress);
console.log(spendingPubKey.length); // 33
console.log(viewingPubKey.length); // 33