Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@neon-exchange/nash-protocol-legacy

Package Overview
Dependencies
Maintainers
9
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neon-exchange/nash-protocol-legacy

TypeScript implementation of Nash crypto routines

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-80%
Maintainers
9
Weekly downloads
 
Created
Source

nash-protocol

Implementation of Nash cryptographic routines.

Documentation available here

Getting started

yarn install
yarn build
yarn test

Usage Summary

Onboarding

The Nash Protocol contains functions necessary to create, setup, and authenticate into an account.

Account creation

This step registers a new user with Nash's Central Accounts System.

  1. A user signs up for an account and provides a password.
  2. hashPassword() should be called to hash the password, and getHKDFKeysFromPassword() should be called on the hashed password to get an authentication key and encryption key.
  3. The authentication key is sent to Nash's Central Accounts System in lieu of the original password, and is what is used hereafter for authentication. The encryption key is never sent to Nash, and must be computed on the fly from the user's password by the client.
Account setup

This step creates blockchain wallets for a user.

  1. getEntropy() is called to generate a secret key.
  2. secretKeyToMnemonic() is called on the secret key to provide a user's mnemonic. The user should persist this and never share this value.
  3. mnemonicToMasterSeed() is called on the mnemonic to create the master seed, which is the seed value for BIP-44 HD wallet generation.
  4. generateWallet is called using the master seed for all supported coin types.
  5. Wallet public keys are sent to Nash. Private keys are never sent to Nash, and should be computed on the fly by the client.
  6. The secret key is encrypted with encryptSecretKey(), which produces an encrypted secret key AEAD object. This is sent to Nash.

Authentication

  1. User provides their password.
  2. getHKDFKeysFromPassword() is used to get the authentication key and encryption key.
  3. The authentication key is sent to Nash, which responds with the encrypted secret key AEAD object and some wallet metadata (public keys and chain heights).
  4. The client calls initialize() with the encrypted secret key AEAD object, encryption key, wallet metadata, and some Nash Matching Engine market and asset data to receive a config.
  5. This config contains all necessary values to interact with the Nash Matching Engine, including the ability to sign payloads needed for operations such as order placement, viewing private account information, asset transfers, and staking.

Glossary

Secret values are never sent to Nash. Values that are visible to Nash are. A combination of secret values and values accessible by Nash are needed for all sensitive operations. Both types of values are sensitive and should be carefully guarded.

  • Authentication key: Derived from password. Used to authentcate into Nash's systems. Visible to Nash.
  • BIP-39: Protocol for generating master seed from private key.
  • BIP-44: Protocol for generating wallet addresses from master seed.
  • Chain: an ID for each blockchain we want to generate a private key for. Constant. Nash uses the coin types as defined by BIP044.
  • Encrypted secret key: The secret key encrypted via the encryption key via AEAD. Cannot be decrypted without the encryption key. Visible to Nash.
  • Encryption key: Derived from password. Used to encrypt the private key for server side storage. Secret.
  • Master seed: Value used to generate wallets. Derived from mnemonic. Secret.
  • Mnemonic: A n-word phrase generated from the secret key using a wordlist. Can be used along with passphrase to (re)generate the master seed. Secret.
  • Password: User's login credential. Used to generate encryption key and auth key via HKDF. Secret.
  • Secret key: A random value. Abstracted into the mnemonic for better user experience. We use this as the "master key" -- the ultimate password from which everything is derived, that should be protected at all costs. Secret. (An encrypted version is visible to Nash.)

Notes

External wallet keys

We will NOT support the user supplying their own wallet keys. While users will control their own wallets, we will generate the wallets for them. This is partially because we want wallets to be deterministically derivable from the master seed.

References

FAQs

Package last updated on 23 Sep 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc