question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better handling of paths in HD keyrings

See original GitHub issue

Right now, the main keyring we use is Ed25519SimpleAddressKeyringEntry which hardcodes the beginning of a path and just increments the last value to produce multiple addresses. A KeyringEntry has just one command to create a new key, which accepts no arguments.

export interface KeyringEntry {
...
  // createIdentity will create one new identity
  readonly createIdentity: () => Promise<LocalIdentity>;
...
}

This is exposed in the UserProfile as:

  // creates an identity in the n-th keyring entry of the primary keyring
  public async createIdentity(n: number): Promise<LocalIdentity> {
    const entry = this.entryInPrimaryKeyring(n);
    return entry.createIdentity();
  }

This doesn’t allow us to specify the path to use for hd keys, or to import a private key from another key store. It also is not the cleanest way to specify the algorithm. I mean, n=0 could be ed25519 and n=1 secp256k1, but that is not so clear.

We should make it easy to either import existing private keys, or to do something like “Create a new secp256k1 key with path 44’/1’/2’/0/x where x is one higher that the last value you generated with that prefix”.

Let’s figure out the nicest API for the user, then work on implementing it. As all the pieces are there, it shouldn’t be too much hard crypto work, just API polish.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:28 (28 by maintainers)

github_iconTop GitHub Comments

2reactions
ethanfreycommented, Aug 28, 2018

Hmmm… maybe two functions…

createBip44Identity(coinType: Slip0010RawIndex, account: Slip0010RawIndex, change: Slip0010RawIndex, addressIndex: Slip0010RawIndex)

createBip32Identity(path: Slip0010RawIndex[])

1reaction
ethanfreycommented, Aug 30, 2018

this keeps all the strangeness outside of the library and all the correctness and hard work inside.

Best criteria I have heard for library boundaries

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrangling file paths in Catalina and Big Sur
On a boot Volume Group, the Finder path [System] > System ... and the best you can hope for is that it'll just...
Read more >
King Solomon Seals, Path Clearing Pewter Key Ring
This seal opens paths, removes hindering obstacles and helps people realize latent potential.
Read more >
Everything You Need to Know About Keychain in macOS Sierra
This Tech 101 article explains the password saving functions of Keychain in macOS Sierra as well as how to access and edit Keychain...
Read more >
Key Vault - Microsoft Azure
Use Azure Key Vault to encrypt keys and small secrets like passwords that use keys stored in hardware security modules (HSMs). For more...
Read more >
oblador/react-native-keychain: Keychain Access for ... - GitHub
Rule 1: Automatic Security Level. As a rule the library will try to apply the best possible encryption for storing secrets. Once the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found