Skip to content

Commit

Permalink
deps: replace base64url with inline definition
Browse files Browse the repository at this point in the history
  • Loading branch information
omsmith committed May 14, 2018
1 parent 8270f01 commit 0990555
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
},
"homepage": "https://github.com/Brightspace/node-ecdsa-sig-formatter#readme",
"dependencies": {
"base64url": "^2.0.0",
"safe-buffer": "^5.0.1"
},
"devDependencies": {
Expand Down
8 changes: 7 additions & 1 deletion src/ecdsa-sig-formatter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

var base64Url = require('base64url').fromBase64;
var Buffer = require('safe-buffer').Buffer;

var getParamBytesForAlg = require('./param-bytes-for-alg');
Expand All @@ -13,6 +12,13 @@ var MAX_OCTET = 0x80,
ENCODED_TAG_SEQ = (TAG_SEQ | PRIMITIVE_BIT) | (CLASS_UNIVERSAL << 6),
ENCODED_TAG_INT = TAG_INT | (CLASS_UNIVERSAL << 6);

function base64Url(base64) {
return base64
.replace(/=/g, '')
.replace(/\+/g, '-')
.replace(/\//g, '_');
}

function signatureAsBuffer(signature) {
if (Buffer.isBuffer(signature)) {
return signature;
Expand Down

0 comments on commit 0990555

Please sign in to comment.