File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
"use strict" ;
7
7
8
- var impl = require ( "urlsafe-base64 " ) ;
8
+ var impl = require ( "base64url " ) ;
9
9
10
10
/**
11
11
* @namespace base64url
@@ -25,15 +25,25 @@ var base64url = {
25
25
* @param {String } [encoding = binary] The input encoding format.
26
26
* @returns {String } the base64url encoding of {input}.
27
27
*/
28
- encode : impl . encode ,
28
+ encode : function encode ( buffer , encoding ) {
29
+ if ( buffer instanceof ArrayBuffer ) {
30
+ buffer = new Uint8Array ( buffer ) ;
31
+ }
32
+
33
+ if ( ! Buffer . isBuffer ( buffer ) ) {
34
+ buffer = new Buffer ( buffer , encoding ) ;
35
+ }
36
+
37
+ return impl . encode ( buffer ) ;
38
+ } ,
29
39
/**
30
40
* @function
31
41
* Decodes the input from base64url.
32
42
*
33
43
* @param {String } input The data to decode.
34
44
* @returns {Buffer|String } the base64url decoding of {input}.
35
45
*/
36
- decode : impl . decode
46
+ decode : impl . toBuffer
37
47
} ;
38
48
39
49
module . exports = base64url ;
Original file line number Diff line number Diff line change 26
26
],
27
27
"license" : " Apache-2.0" ,
28
28
"dependencies" : {
29
+ "base64url" : " ^2.0.0" ,
29
30
"es6-promise" : " ^4.0.5" ,
30
31
"jsbn" : " ^1.1.0" ,
31
32
"lodash.assign" : " ^4.0.8" ,
40
41
"lodash.uniq" : " ^4.2.1" ,
41
42
"long" : " ^3.1.0" ,
42
43
"node-forge" : " https://github.com/linuxwolf/forge/archive/browserify.tar.gz" ,
43
- "urlsafe-base64" : " https://github.com/linuxwolf/urlsafe-base64/archive/encoding.tar.gz" ,
44
44
"uuid" : " ^3.0.1"
45
45
},
46
46
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments