From 836bd9ab3c1298fd96fdb4150f346ab40f006ef2 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 11 Jan 2020 13:19:31 +0530 Subject: [PATCH] chore: method signatures for sha256 method --- assets/js/oauth.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/js/oauth.js b/assets/js/oauth.js index f9a58bdb..d9cabff2 100644 --- a/assets/js/oauth.js +++ b/assets/js/oauth.js @@ -84,8 +84,13 @@ const generateRandomString = () => { window.crypto.getRandomValues(array); return Array.from(array, dec => `0${dec.toString(16)}`.substr(-2)).join(""); }; -// Calculate the SHA256 hash of the input text. -// Returns a promise that resolves to an ArrayBuffer + +/** + * Calculate the SHA256 hash of the input text + * + * @returns {Promise} + */ + const sha256 = plain => { const encoder = new TextEncoder(); const data = encoder.encode(plain);