Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
feat: support key/rm and key/rename (#641)
Browse files Browse the repository at this point in the history
* feat: add key/rm

* feat: add key/rename

* fix: nasty CRLFs

* test: run key tests from interface-ipfs-core
  • Loading branch information
richardschneider authored and daviddias committed Dec 18, 2017
1 parent 72a42d6 commit 113030a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/key/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ module.exports = (arg) => {

return {
gen: require('./gen')(send),
list: require('./list')(send)
list: require('./list')(send),
rename: require('./rename')(send),
rm: require('./rm')(send)
}
}
12 changes: 12 additions & 0 deletions src/key/rename.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

const promisify = require('promisify-es6')

module.exports = (send) => {
return promisify((oldName, newName, callback) => {
send({
path: 'key/rename',
args: [oldName, newName]
}, callback)
})
}
12 changes: 12 additions & 0 deletions src/key/rm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

const promisify = require('promisify-es6')

module.exports = (send) => {
return promisify((args, callback) => {
send({
path: 'key/rm',
args: args
}, callback)
})
}
20 changes: 20 additions & 0 deletions test/interface/key.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-env mocha */

'use strict'

const test = require('interface-ipfs-core')
const Factory = require('../ipfs-factory/client')

let factory

const common = {
setup: function (callback) {
factory = new Factory()
callback(null, factory)
},
teardown: function (callback) {
factory.dismantle(callback)
}
}

test.key(common)

0 comments on commit 113030a

Please sign in to comment.