aboutsummaryrefslogtreecommitdiff
path: root/node_modules/base64-url/index.js
diff options
context:
space:
mode:
authorHumairAK <humair88@hotmail.com>2016-07-21 06:24:24 +0000
committerHumairAK <humair88@hotmail.com>2016-07-21 06:24:24 +0000
commit2549ee68e435b77e7e07d3ea95363268cbfe9164 (patch)
tree8f48f6447a4377f1bc15ae7d73dbab3337044720 /node_modules/base64-url/index.js
parentd694c1a73f77def42c17b58027f046bf9e1af809 (diff)
Added other dependencies for authentication, made minor adjustments to index.js, added templating for exams, will remove dependencie modules later, keep for now
Diffstat (limited to 'node_modules/base64-url/index.js')
-rw-r--r--node_modules/base64-url/index.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/node_modules/base64-url/index.js b/node_modules/base64-url/index.js
new file mode 100644
index 0000000..34968ae
--- /dev/null
+++ b/node_modules/base64-url/index.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var base64url = module.exports;
+
+base64url.unescape = function unescape (str) {
+ return (str + Array(5 - str.length % 4)
+ .join('='))
+ .replace(/\-/g, '+')
+ .replace(/_/g, '/');
+};
+
+base64url.escape = function escape (str) {
+ return str.replace(/\+/g, '-')
+ .replace(/\//g, '_')
+ .replace(/=/g, '');
+};
+
+base64url.encode = function encode (str) {
+ return this.escape(new Buffer(str).toString('base64'));
+};
+
+base64url.decode = function decode (str) {
+ return new Buffer(this.unescape(str), 'base64').toString();
+};