Files: 128131cbfd2df26649597c787fbf851b2c81a79d / util.js
551 bytesRaw
1 | |
2 | exports.id2Buffer = function (id) { |
3 | return Buffer.from(id.substring(1, id.indexOf('.')), 'base64') |
4 | } |
5 | |
6 | exports.isBox2 = function (ctxt) { |
7 | //we can just do a fairly lax check here, don't check the content |
8 | //is canonical base64, because that check has already been done. |
9 | return 'string' == typeof ctxt && /\.box2$/.test(ctxt) |
10 | } |
11 | |
12 | exports.isCurvePair = function (keys) { |
13 | return keys.public && keys.private |
14 | } |
15 | |
16 | exports.ctxt2Buffer = function (ctxt) { |
17 | return exports.isBox2(ctxt) && Buffer.from(ctxt.substring(0, ctxt.indexOf('.')), 'base64') |
18 | } |
19 | |
20 |
Built with git-ssb-web