A helper package for the HYCHAIN web, client & apis. Used to simplify management of various required cryptographic operations specific to user accounts.
HYCHAIN's account architecture retains the private key on the player's client device, and only transmits an AES encrypted version of their keys to HYCHAIN servers for the sake of being able to sign into other devices & recover their key client-side.
Brief implementation summaries of patterns for client implementation.
- Client generates random wallet, random salt.
- Client uses provided account password and salt to aes encrypt wallet.
- Client sends account creation credentials to HYCHAIN servers: email/phone/socialAuthToken, wallet ciphertext, plaintext salt.
- Client logs in using method tied to account: email, phone or socialAuthToken. Initiates 2fa challenge for email/phone, skip to 3 for social auth
- If email or phone used, verification code sent to email or phone, entered on client
- Account credentials returned to client, including wallet ciphertext and salt.
- Client prompts player for their password to locally decrypt ciphertext first time they attempt to submit a CallRequest transaction or perform any wallet operation. Wallet credentials cached/encrypted locally - arbitrary local cache encryption key can be used.
You can run unit tests with npm install && npm test
.