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

Commit 113030a

Browse files
richardschneiderdaviddias
authored andcommitted
feat: support key/rm and key/rename (#641)
* feat: add key/rm * feat: add key/rename * fix: nasty CRLFs * test: run key tests from interface-ipfs-core
1 parent 72a42d6 commit 113030a

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

src/key/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module.exports = (arg) => {
77

88
return {
99
gen: require('./gen')(send),
10-
list: require('./list')(send)
10+
list: require('./list')(send),
11+
rename: require('./rename')(send),
12+
rm: require('./rm')(send)
1113
}
1214
}

src/key/rename.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict'
2+
3+
const promisify = require('promisify-es6')
4+
5+
module.exports = (send) => {
6+
return promisify((oldName, newName, callback) => {
7+
send({
8+
path: 'key/rename',
9+
args: [oldName, newName]
10+
}, callback)
11+
})
12+
}

src/key/rm.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict'
2+
3+
const promisify = require('promisify-es6')
4+
5+
module.exports = (send) => {
6+
return promisify((args, callback) => {
7+
send({
8+
path: 'key/rm',
9+
args: args
10+
}, callback)
11+
})
12+
}

test/interface/key.spec.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* eslint-env mocha */
2+
3+
'use strict'
4+
5+
const test = require('interface-ipfs-core')
6+
const Factory = require('../ipfs-factory/client')
7+
8+
let factory
9+
10+
const common = {
11+
setup: function (callback) {
12+
factory = new Factory()
13+
callback(null, factory)
14+
},
15+
teardown: function (callback) {
16+
factory.dismantle(callback)
17+
}
18+
}
19+
20+
test.key(common)

0 commit comments

Comments
 (0)