-
Notifications
You must be signed in to change notification settings - Fork 199
Integrate a BIP44-compliant & multi-device HD keychain system #330
Comments
We already worked out the HD paths here: #131 |
See this for the keychain model: https://forum.blockstack.org/t/blockstack-keychain-model-lets-discuss/726 |
Device keychain --> identity branch --> name account --> owner, signing, encryption keychains
|
@larrysalibra Does this look good to you? |
For bitcoin, we'll simply use the following:
Later, we'll make the wallet multi-address and add the ability to have new paths:
|
Some quick code I whipped up for this: import {randomBytes} from 'crypto'
import {HDNode} from 'bitcoinjs-lib'
const masterKeychain = HDNode.fromSeedBuffer(randomBytes(32))
const masterKeychainID = masterKeychain.neutered()
const bitcoinKeychain = masterKeychain.deriveHardened(44).deriveHardened(0)
const firstBitcoinAddress = bitcoinKeychain.deriveHardened(0).derive(0)
const identityKeychain = masterKeychain.deriveHardened(888).deriveHardened(0)
const firstIdentityAddress = identityKeychain.derive(0) |
Awesome! |
@larrysalibra where is the requirements document? |
@shea256 it's just a list of bullet points at the top of this issue. no formal doc at the moment. feel free to add. |
Yes exactly. This was my thinking with the diagram above. There would be the branch m/888'/0'/0' and then there's the name owner key at the "0" leaf and then every app is a hardened leaf off of that. This would include the browser portal itself. The browser portal would be considered just another app.
Building off of this, we could have the browser portal's "domain" or "origin" be simply "localhost". The main purpose of our app-specific keys is to separate keys by origin. Local storage is organized by origin so this is a nice corollary. |
Along the lines of keys being used for a high volume of signatures, we'll need to be able to rotate the app-specific keys as well. This could be done simply by rotating the salt. |
Not sure this is such a good idea in that any app running on localhost would share the same keys as the portal. Is that something we want?
Where does the salt come from? |
Sorry, to clarify, it would be "localhost:8888" instead of just localhost. Only one app can run on "localhost:8888" at a time and all such apps running on "localhost:8888" will share local storage anyway.
Jude and I figured out earlier we'd need a salt when we were exploring the int32(hash(appname)) stuff. |
I think for right now, it's important to spec out the paths that will ultimately require "update" transactions. App keys won't, so maybe we can fully decide on the app key paths at another time, and just go with something that works for them for now? |
Agree @kantai |
We need to encrypt the app key information to prevent others from knowing which apps you are using. To do this, we need the encrypt key to live outside of the app key hierarchy. We plan to use a symmetric key to encrypt the app names, store the cipher text in the token file. Sharing that you are using an app with someone will involve sharing the symmetric key. |
I've merged the new keychain format into |
Don't use hashcode #538 We'll also need to create a new issue to update token file to create the key delegation bundle before we can close this out. |
Requirements:
The text was updated successfully, but these errors were encountered: