Files: dcd31b5a16d278ac3c2eb74b64b217d7d376c0b8 / test / fs.js
713 bytesRaw
1 | var tape = require('tape') |
2 | var ssbkeys = require('../') |
3 | var crypto = require('crypto') |
4 | var path = '/tmp/ssb-keys_'+Date.now() |
5 | var fs = require('fs') |
6 | |
7 | tape('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 | |
19 | tape('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