Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Create Code

node v10.24.1
version: 1.0.0
endpointsharetweet
const crypto = require('crypto') const uuid = require('uuid') const SECRET = 'passw0rd' const email = '[email protected]' const listId = '2bdbaedb-8fa8-4a50-bf89-8541180b3620' const userId = '588c4ce2-bbb6-41cd-a292-33daf280774c' const buf = Buffer.concat([Buffer.from(listId.replace(/-/g, ''), 'hex'), Buffer.from(userId.replace(/-/g, ''), 'hex'), Buffer.from(email)]) console.log('buf', buf.toString('hex')) const hmac = crypto.createHmac('sha256', SECRET) hmac.update(buf) const digest = hmac.digest() console.log('digest: ' + digest.toString('hex')) const code = Buffer.concat([digest, buf]).toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_') console.log(code)
Loading…

no comments

    sign in to comment