-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: replace base64url with inline definition
- Loading branch information
Showing
3 changed files
with
11 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
/*global module*/ | ||
var base64url = require('base64url'); | ||
var DataStream = require('./data-stream'); | ||
var jwa = require('jwa'); | ||
var Stream = require('stream'); | ||
var toBuffer = require('./to-buffer'); | ||
var util = require('util'); | ||
|
||
function base64url(buf) { | ||
return buf | ||
.toString('base64') | ||
.replace(/=/g, '') | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
omsmith
Author
Contributor
|
||
.replace(/\+/g, '-') | ||
.replace(/\//g, '_'); | ||
} | ||
|
||
function jwsSecuredInput(header, payload, encoding) { | ||
encoding = encoding || 'utf8'; | ||
var encodedHeader = base64url(toBuffer(header)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It seems that this line wasn't in the original definition from the
base64url
package#toBase64
function. This causes a bug in my app where the produced base64 string is invalid. What's the reason for adding this replace operation?