git ssb

1+

Dominic / ssb-keys



Commit 846e0d32e32e26a7f44d1af8f6315b457b5070a1

test more of the api

Dominic Tarr committed on 5/29/2015, 2:26:06 PM
Parent: 54b49310175b4189f17dacff86a9b1a509b15952

Files changed

test/index.jschanged
test/index.jsView
@@ -35,9 +35,40 @@
3535 var sig = ssbkeys.sign(keys, msg)
3636 console.log('public', keys.public)
3737 console.log('sig', sig)
3838 t.ok(sig)
39+ t.equal(ssbkeys.getTag(sig), 'blake2s.ed25519')
3940 t.ok(ssbkeys.verify(keys, sig, msg))
4041
4142 t.end()
4243
4344 })
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