Commit a04dfcd772979f83cc19151bfd4b98c9079ea190
syntax
Dominic Tarr committed on 12/29/2018, 5:27:45 AMParent: 128131cbfd2df26649597c787fbf851b2c81a79d
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -16,10 +16,15 @@ | |||
16 | 16 … | //and, you can verify this property from the design! you can't | |
17 | 17 … | //rewrite this code so they don't know the founding message | |
18 | 18 … | //and still be able to decrypt these messages. | |
19 | 19 … | ||
20 … | +function hmac (a, b) { | ||
21 … | + return cl.crypto_auth(u.toBuffer(a), u.toBuffer(b)) | ||
22 … | +} | ||
23 … | + | ||
20 | 24 … | function getGroupMsgKey(previous, group) { | |
21 | - return hmac(Buffer.concat([previous, group.id]), group.unbox) | ||
25 … | + //or would it be better to use generic hash (with key?) | ||
26 … | + return hmac(Buffer.concat([previous, group.id]), u.toBuffer(group.unbox)) | ||
22 | 27 … | } | |
23 | 28 … | ||
24 | 29 … | exports.name = 'private-groups' | |
25 | 30 … | ||
@@ -141,9 +146,9 @@ | |||
141 | 146 … | return { | |
142 | 147 … | get: remoteKeys.get, | |
143 | 148 … | addGroupKey: function (group, cb) { | |
144 | 149 … | af.get(function () { | |
145 | - keyState.groupKeys[hmac(group.id, group.unbox)] = group) | ||
150 … | + keyState.groupKeys[hmac(group.id, group.unbox)] = group | ||
146 | 151 … | af.set(keys, cb) | |
147 | 152 … | }) | |
148 | 153 … | }, | |
149 | 154 … | addCurvePair: function (curve_keys, cb) { |
Built with git-ssb-web