-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathkey.spec.ts
42 lines (30 loc) · 958 Bytes
/
key.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* eslint-env mocha */
import { expect } from 'aegir/chai'
import { factory } from './utils/factory.js'
import type { KuboRPCClient } from '../src/index.js'
const f = factory()
describe('.key', function () {
this.timeout(50 * 1000)
let ipfs: KuboRPCClient
before(async function () {
ipfs = (await f.spawn()).api
})
after(async function () { return f.clean() })
describe('.gen', function () {
it('create a new rsa key', async function () {
const res = await ipfs.key.gen('foobarsa', { type: 'rsa', size: 2048 })
expect(res).to.exist()
})
it('create a new ed25519 key', async function () {
const res = await ipfs.key.gen('bazed', { type: 'ed25519' })
expect(res).to.exist()
})
})
describe('.list', function () {
it('both keys show up + self', async function () {
const res = await ipfs.key.list()
expect(res).to.exist()
expect(res.length).to.equal(3)
})
})
})