Commit 846e0d32e32e26a7f44d1af8f6315b457b5070a1
test more of the api
Dominic Tarr committed on 5/29/2015, 2:26:06 PMParent: 54b49310175b4189f17dacff86a9b1a509b15952
Files changed
test/index.js | changed |
test/index.js | ||
---|---|---|
@@ -35,9 +35,40 @@ | ||
35 | 35 | var sig = ssbkeys.sign(keys, msg) |
36 | 36 | console.log('public', keys.public) |
37 | 37 | console.log('sig', sig) |
38 | 38 | t.ok(sig) |
39 | + t.equal(ssbkeys.getTag(sig), 'blake2s.ed25519') | |
39 | 40 | t.ok(ssbkeys.verify(keys, sig, msg)) |
40 | 41 | |
41 | 42 | t.end() |
42 | 43 | |
43 | 44 | }) |
45 | + | |
46 | +tape('sign and verify, call with keys directly', function (t) { | |
47 | + | |
48 | + var keys = ssbkeys.generate() | |
49 | + var msg = ssbkeys.hash("HELLO THERE?") | |
50 | + var sig = ssbkeys.sign(keys.private, msg) | |
51 | + console.log('public', keys.public) | |
52 | + console.log('sig', sig) | |
53 | + t.ok(sig) | |
54 | + t.equal(ssbkeys.getTag(sig), 'blake2s.ed25519') | |
55 | + t.ok(ssbkeys.verify(keys.public, sig, msg)) | |
56 | + | |
57 | + t.end() | |
58 | + | |
59 | +}) | |
60 | + | |
61 | +tape('sign and verify a javascript object', function (t) { | |
62 | + | |
63 | + var obj = require('../package.json') | |
64 | + | |
65 | + console.log(obj) | |
66 | + | |
67 | + var keys = ssbkeys.generate() | |
68 | + var sig = ssbkeys.signObj(keys.private, obj) | |
69 | + console.log(sig) | |
70 | + t.ok(sig) | |
71 | + t.ok(ssbkeys.verifyObj(keys, sig, obj)) | |
72 | + t.end() | |
73 | + | |
74 | +}) |
Built with git-ssb-web