fixes for sync

This commit is contained in:
azivner
2017-10-29 14:55:48 -04:00
parent d613200925
commit af13b28cab
7 changed files with 148 additions and 100 deletions

View File

@@ -34,11 +34,18 @@ function fromBase64(encodedText) {
return Buffer.from(encodedText, 'base64');
}
function hmac(secret, value) {
const hmac = crypto.createHmac('sha256', Buffer.from(secret.toString(), 'ASCII'));
hmac.update(value.toString());
return hmac.digest('base64');
}
module.exports = {
randomSecureToken,
randomString,
nowTimestamp,
newNoteId,
toBase64,
fromBase64
fromBase64,
hmac
};