Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

@synonymdev/slashtags-keychain

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synonymdev/slashtags-keychain

A utility module for generating keyPairs for Slashtags

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
6
-94.5%
Maintainers
7
Weekly downloads
 
Created
Source

slashtags-keychain

A utility module for generating keyPairs for Slashtags

Installation

npm install @synonymdev/slashtags-keychain

Usage

const KeyChain = require('@synonymdev/slashtags-keychain')

// Create a default keyPair from a `primaryKey`
const defaultKeyPair = KeyChain.createKeyPair(primaryKey)

// Create a default keyPair from a `primaryKey` and a `name`
const namedKeyPair = KeyChain.createKeyPair(primaryKey, name)

PrimaryKey

The primaryKey is a seed used to generate multiple Slashtags KeyPairs.

In practice a Bitcoin wallet should generate the primaryKey from Bitcoin seed or a mnemonic phrase as fololws:

import bip39 from 'bip39'
import { BIP32Factory as bip32 } from 'bip32'
import * as ecc from 'tiny-secp256k1'
import SDK, { constants } from '@synonymdev/slashtags-sdk'

const mnemonic = constants.MNEMONIC_TO_PRIMARY_KEY_TEST_VECTORS[0].mnemonic
console.log('Mnemonic:', mnemonic)

const seed = await bip39.mnemonicToSeed(mnemonic)
console.log('\nSeed:', seed.toString('hex'))

const root = bip32(ecc).fromSeed(seed) // Network: bitcoin mainnet

const primaryKey = root.derivePath(constants.PRIMARY_KEY_DERIVATION_PATH).privateKey

FAQs

Package last updated on 05 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts