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

Commit

Permalink
fix: support keychain without pass (#3212)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jacobheun authored Aug 10, 2020
1 parent c0dfa05 commit 60bee6a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion browser-browserify/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<body>
<h1>JS IPFS - Add data to IPFS from the browser</h1>
<textarea id="source" placeholder="Enter some text here"></textarea>
<button id="store">Add text to ipfs</button>
<button id="store" style="display: none">Add text to ipfs</button>
<div id="output" style="display: none">
<div>found in ipfs:</div>
<div class="content" id="cid">[ipfs cid]</div>
Expand Down
10 changes: 8 additions & 2 deletions browser-browserify/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
const IPFS = require('ipfs')

document.addEventListener('DOMContentLoaded', async () => {
const node = await IPFS.create({ repo: String(Math.random() + Date.now()) })
const node = await IPFS.create({
repo: String(Math.random() + Date.now()),
init: { alogorithm: 'ed25519' }

})
const button = document.getElementById('store')

console.log('IPFS node is ready')

Expand All @@ -25,5 +30,6 @@ document.addEventListener('DOMContentLoaded', async () => {
}
}

document.getElementById('store').onclick = store
button.onclick = store
button.setAttribute('style', 'display: inline')
})
3 changes: 1 addition & 2 deletions browser-browserify/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ module.exports = {
.waitForElementVisible('#source')
.setValue('#source', 'hello')
.waitForElementVisible('#store')
.pause(1000)
.click('#store')
.waitForElementVisible('#output')
.waitForElementVisible('#output', 5e3, 100)

browser.expect.element('#cid').text.to.contain('QmWfVY9y3xjsixTgbd9AorQxH7VtMpzfx2HaWtsoUYecaX')
browser.expect.element('#content').text.to.contain('hello')
Expand Down
2 changes: 1 addition & 1 deletion circuit-relaying/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h1>IPFS Simple Messaging</h1>
<div class="row">
<div class="box row">
<label>Peer id:</label>
<ul id="peer-id"></ul>
<ul id="peer-id" style="display:none"></ul>
</div>
<div class="box addrs-box">
<label>Addresses:</label>
Expand Down
1 change: 1 addition & 0 deletions circuit-relaying/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ document.addEventListener('DOMContentLoaded', async () => {

let room = createRoom(roomName)

$peerId.setAttribute('style', '')
$peerId.innerHTML = `<li>${info.id}</li>`

$send.addEventListener('click', () => {
Expand Down
1 change: 0 additions & 1 deletion circuit-relaying/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const $msgs = document.querySelector('#msgs')
const $addrs = document.querySelector('#addrs')
const $peers = document.querySelector('#peers')
const $pAddrs = document.querySelector('#peers-addrs')
const delay = require('delay')

const NAMESPACE = 'ipfs-quick-msg'

Expand Down
4 changes: 2 additions & 2 deletions circuit-relaying/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ module.exports[pkg.name] = function (browser) {

browser
.url(process.env.IPFS_EXAMPLE_TEST_URL)
.waitForElementVisible('#peer')
.waitForElementVisible('#peer-id') // Wait for ipfs to start
.clearValue('#peer')
.setValue('#peer', process.env.IPFS_RELAY_ADDRESS)
.pause(1000)
.pause(100)
.click('#connect')

browser.expect.element('#peers-addrs').text.to.contain(process.env.IPFS_RELAY_ID)
Expand Down

0 comments on commit 60bee6a

Please sign in to comment.