You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

base64url

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

LICENSE

2

dist/base64url.d.ts

@@ -1,2 +0,2 @@

/// <reference path="../typings/index.d.ts" />
/// <reference types="node" />
export interface Base64Url {

@@ -3,0 +3,0 @@ (input: string | Buffer, encoding?: string): string;

"use strict";
var pad_string_1 = require("./pad-string");
function encode(input, encoding) {
if (encoding === void 0) { encoding = "utf8"; }
Object.defineProperty(exports, "__esModule", { value: true });
const pad_string_1 = require("./pad-string");
function encode(input, encoding = "utf8") {
if (Buffer.isBuffer(input)) {
return fromBase64(input.toString("base64"));
}
return fromBase64(new Buffer(input, encoding).toString("base64"));
return fromBase64(Buffer.from(input, encoding).toString("base64"));
}
;
function decode(base64url, encoding) {
if (encoding === void 0) { encoding = "utf8"; }
return new Buffer(toBase64(base64url), "base64").toString(encoding);
function decode(base64url, encoding = "utf8") {
return Buffer.from(toBase64(base64url), "base64").toString(encoding);
}

@@ -28,5 +27,5 @@ function toBase64(base64url) {

function toBuffer(base64url) {
return new Buffer(toBase64(base64url), "base64");
return Buffer.from(toBase64(base64url), "base64");
}
var base64url = encode;
let base64url = encode;
base64url.encode = encode;

@@ -37,3 +36,2 @@ base64url.decode = decode;

base64url.toBuffer = toBuffer;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = base64url;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function padString(input) {
var segmentLength = 4;
var stringLength = input.length;
var diff = stringLength % segmentLength;
let segmentLength = 4;
let stringLength = input.length;
let diff = stringLength % segmentLength;
if (!diff) {
return input;
}
var position = stringLength;
var padLength = segmentLength - diff;
var paddedStringLength = stringLength + padLength;
var buffer = new Buffer(paddedStringLength);
let position = stringLength;
let padLength = segmentLength - diff;
let paddedStringLength = stringLength + padLength;
let buffer = Buffer.alloc(paddedStringLength);
buffer.write(input);

@@ -19,3 +20,2 @@ while (padLength--) {

}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = padString;
{
"name": "base64url",
"version": "2.0.0",
"version": "3.0.0",
"description": "For encoding to/from base64urls",
"main": "index.js",
"typings": "dist/base64url.d.ts",
"files": [
"dist/",
"typings/",
"index.js"

@@ -16,3 +14,3 @@ ],

"test": "npm run clean && npm run build && tap test/*.test.js",
"prepublish": "npm run test"
"prepublishOnly": "npm run test"
},

@@ -31,4 +29,5 @@ "repository": {

"devDependencies": {
"@types/node": "^10.0.0",
"tap": "6.1.1"
}
}

@@ -93,2 +93,6 @@ # base64url [![Build Status](https://secure.travis-ci.org/brianloveswords/base64url.png)](http://travis-ci.org/brianloveswords/base64url)

# Alternatives
- [base64-url](https://github.com/joaquimserafim/base64-url)
# License

@@ -95,0 +99,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc