v1.1.9: bugfix Node.js `atob` invocation
Browsers have a global `atob` function, but Node.js does not. This is very important for allowing `PEM.parseBlock` to work out of the box, as it calls `Enc.base64ToBuf` directly.
This commit is contained in:
parent
9511f1e130
commit
36e450659d
|
@ -129,7 +129,7 @@ PEM.parseBlock = PEM.parseBlock || function (str) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Enc.base64ToBuf = function (b64) {
|
Enc.base64ToBuf = function (b64) {
|
||||||
return Enc.binToBuf(atob(b64));
|
return Enc.binToBuf('function' === typeof atob ? atob(b64) : Buffer.from(b64, 'base64').toString('binary'));
|
||||||
};
|
};
|
||||||
Enc.binToBuf = function (bin) {
|
Enc.binToBuf = function (bin) {
|
||||||
var arr = bin.split('').map(function (ch) {
|
var arr = bin.split('').map(function (ch) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "asn1-parser",
|
"name": "asn1-parser",
|
||||||
"version": "1.1.8",
|
"version": "1.1.9",
|
||||||
"description": "An ASN.1 parser in less than 100 lines of Vanilla JavaScript, part of the Bluecrypt suite.",
|
"description": "An ASN.1 parser in less than 100 lines of Vanilla JavaScript, part of the Bluecrypt suite.",
|
||||||
"homepage": "https://git.coolaj86.com/coolaj86/asn1-parser.js",
|
"homepage": "https://git.coolaj86.com/coolaj86/asn1-parser.js",
|
||||||
"main": "asn1-parser.js",
|
"main": "asn1-parser.js",
|
||||||
|
|
Loading…
Reference in New Issue