git ssb

1+

Dominic / ssb-keys



Tree: 3140362268783cb7c3ff1d691717a484dc2d1943

Files: 3140362268783cb7c3ff1d691717a484dc2d1943 / test / fs.js

713 bytesRaw
1var tape = require('tape')
2var ssbkeys = require('../')
3var crypto = require('crypto')
4var path = '/tmp/ssb-keys_'+Date.now()
5var fs = require('fs')
6
7tape('create and load presigil-legacy async', function (t) {
8
9 var keys = ssbkeys.generate('ed25519')
10 keys.id = keys.id.substring(1)
11 fs.writeFileSync(path, JSON.stringify(keys))
12
13 var k2 = ssbkeys.loadSync(path)
14 t.equal(k2.id, '@' + keys.id)
15 t.end()
16
17})
18
19tape('create and load presigil-legacy', function (t) {
20
21 var keys = ssbkeys.generate('ed25519')
22 keys.id = keys.id.substring(1)
23 fs.writeFileSync(path, JSON.stringify(keys))
24
25 ssbkeys.load(path, function (err, k2) {
26 if(err) throw err
27 t.equal(k2.id, '@' + keys.id)
28 t.end()
29 })
30
31})
32
33

Built with git-ssb-web