Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

feat: add support for ed25519 and secp256k1 keys#3208

Closed
jacobheun wants to merge 4 commits intomasterfrom
feat/ed25519-keys
Closed

feat: add support for ed25519 and secp256k1 keys#3208
jacobheun wants to merge 4 commits intomasterfrom
feat/ed25519-keys

Conversation

@jacobheun
Copy link
Copy Markdown
Contributor

@jacobheun jacobheun commented Aug 4, 2020

This adds support for:

  1. Using ed25519 and secp256k1 keys for the ipfs PeerId
  2. Using ed25519 and secp256k1 keys with ipns

fixes #2553

@jacobheun
Copy link
Copy Markdown
Contributor Author

@achingbrain there is currently no way to just specify a key type on initialization, however you can pass a pre generated privateKey as shown in the tests. We could add a keyType option to IPFS.create() to accomplish this. What do you think about:

await IPFS.create({ init: { keyType: 'ed25519' }})

go-ipfs uses algorithm though, so we could use that for consistency ipfs init --algorithm ed25519

@jacobheun
Copy link
Copy Markdown
Contributor Author

I went with algorithm for now to match Go.

Copy link
Copy Markdown
Member

@achingbrain achingbrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Should it throw if you pass bits and algorithm is not 'rsa'?

@jacobheun
Copy link
Copy Markdown
Contributor Author

Should it throw if you pass bits and algorithm is not 'rsa'?

It could, ideally I think this would be a warning if anything. fwiw, the node crypto library ignores bits for ed keys.

@jacobheun jacobheun marked this pull request as ready for review August 5, 2020 17:22
@jacobheun
Copy link
Copy Markdown
Contributor Author

Closing this in favor of bundling with #3212

@jacobheun jacobheun closed this Aug 6, 2020
@jacobheun jacobheun deleted the feat/ed25519-keys branch August 6, 2020 20:28
achingbrain pushed a commit that referenced this pull request Aug 10, 2020
- add support for ed25519 and secp256k1 keys for the ipfs PeerId
- add support for using ed25519 and secp256k1 keys with ipns
- add support for keychain without a pass, this fixes several keychain commands
- fix `name publish`, ttl should be optional but wasn't being allowed

Includes changes in #3208

Key gen and key listing now works:
```sh
$ jsipfs key gen --type=ed25519 my-ed-key
generated QmUPJZ3ghsnkRVgYjrMrSC8MbbZTzcezn6mH7vY9vTbrMY my-ed-key

$ jsipfs key list
QmUPJZ3ghsnkRVgYjrMrSC8MbbZTzcezn6mH7vY9vTbrMY my-ed-key
QmYPxJJb8Mpa6JjQj7hCTF4ajn2SE1HFLRoAnCbymTGzyC self
```

IPNS Publishing now works properly, including using other key types:
```sh
jsipfs name publish -k my-ed-key /ipfs/QmP7WDyEdkFu2nfj35SUEB7fk3iKCHpcrCVbGk1HXZU22a
Published to 12D3KooWGmSq6u3yZeXqeqSmQpJWKQGGdCxrZQAUZBzsbSM2kCE6: /ipfs/QmP7WDyEdkFu2nfj35SUEB7fk3iKCHpcrCVbGk1HXZU22a
```

I also fixed a couple of the example tests, they weren't waiting for IPFS to start before executing the tests, which could cause them to intermittently fail.

BREAKING CHANGE: remove support for key.export over the http api
oliveriosousa pushed a commit to ipfs-examples/js-ipfs-examples that referenced this pull request Jul 26, 2021
- add support for ed25519 and secp256k1 keys for the ipfs PeerId
- add support for using ed25519 and secp256k1 keys with ipns
- add support for keychain without a pass, this fixes several keychain commands
- fix `name publish`, ttl should be optional but wasn't being allowed

Includes changes in ipfs/js-ipfs#3208

Key gen and key listing now works:
```sh
$ jsipfs key gen --type=ed25519 my-ed-key
generated QmUPJZ3ghsnkRVgYjrMrSC8MbbZTzcezn6mH7vY9vTbrMY my-ed-key

$ jsipfs key list
QmUPJZ3ghsnkRVgYjrMrSC8MbbZTzcezn6mH7vY9vTbrMY my-ed-key
QmYPxJJb8Mpa6JjQj7hCTF4ajn2SE1HFLRoAnCbymTGzyC self
```

IPNS Publishing now works properly, including using other key types:
```sh
jsipfs name publish -k my-ed-key /ipfs/QmP7WDyEdkFu2nfj35SUEB7fk3iKCHpcrCVbGk1HXZU22a
Published to 12D3KooWGmSq6u3yZeXqeqSmQpJWKQGGdCxrZQAUZBzsbSM2kCE6: /ipfs/QmP7WDyEdkFu2nfj35SUEB7fk3iKCHpcrCVbGk1HXZU22a
```

I also fixed a couple of the example tests, they weren't waiting for IPFS to start before executing the tests, which could cause them to intermittently fail.

BREAKING CHANGE: remove support for key.export over the http api
SgtPooki pushed a commit to ipfs/js-kubo-rpc-client that referenced this pull request Aug 18, 2022
- add support for ed25519 and secp256k1 keys for the ipfs PeerId
- add support for using ed25519 and secp256k1 keys with ipns
- add support for keychain without a pass, this fixes several keychain commands
- fix `name publish`, ttl should be optional but wasn't being allowed

Includes changes in ipfs/js-ipfs#3208

Key gen and key listing now works:
```sh
$ jsipfs key gen --type=ed25519 my-ed-key
generated QmUPJZ3ghsnkRVgYjrMrSC8MbbZTzcezn6mH7vY9vTbrMY my-ed-key

$ jsipfs key list
QmUPJZ3ghsnkRVgYjrMrSC8MbbZTzcezn6mH7vY9vTbrMY my-ed-key
QmYPxJJb8Mpa6JjQj7hCTF4ajn2SE1HFLRoAnCbymTGzyC self
```

IPNS Publishing now works properly, including using other key types:
```sh
jsipfs name publish -k my-ed-key /ipfs/QmP7WDyEdkFu2nfj35SUEB7fk3iKCHpcrCVbGk1HXZU22a
Published to 12D3KooWGmSq6u3yZeXqeqSmQpJWKQGGdCxrZQAUZBzsbSM2kCE6: /ipfs/QmP7WDyEdkFu2nfj35SUEB7fk3iKCHpcrCVbGk1HXZU22a
```

I also fixed a couple of the example tests, they weren't waiting for IPFS to start before executing the tests, which could cause them to intermittently fail.

BREAKING CHANGE: remove support for key.export over the http api
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node.key.gen('name', { type: 'ed25519', size: 256 }) does not work

2 participants