Add node modules and compiled JavaScript from main (#54)

Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
github-actions[bot]
2022-06-29 15:41:55 -04:00
committed by GitHub
parent 4a983766a0
commit 52d71d28bd
6814 changed files with 2048539 additions and 2 deletions

40
node_modules/rfc4648/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,40 @@
# rfc4648
## 1.5.0 (2021-05-25)
- Allow modern versions of Node to use named exports along with native modules support.
## 1.4.0 (2020-07-10)
- Add Flow type definitions.
## 1.3.0 (2019-09-25)
- Port the library to TypeScript.
## 1.2.1 (2019-05-24)
- Update build & test infrastructure.
## 1.2.0 (2019-04-05)
- Add an option to skip padding the `codec.stringify` output
## 1.1.0
- Automatically fix typo characters in base32 loose mode
- Documentation cleanups
- Size optimizations
## 1.0.0
- Use `Uint8Array` for output
- Code cleanups & size optimizations
## 0.9.1
- Fix packaging bugs
## 0.9.0
- Initial release

88
node_modules/rfc4648/README.md generated vendored Normal file
View File

@ -0,0 +1,88 @@
# rfc4648.js
[![Build Status](https://travis-ci.com/swansontec/rfc4648.js.svg?branch=master)](https://travis-ci.com/swansontec/rfc4648.js)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
This library implements encoding and decoding for the data formats specified in [rfc4648](https://tools.ietf.org/html/rfc4648):
- base64
- base64url
- base32
- base32hex
- base16
Each encoding has a simple API inspired by Javascript's built-in `JSON` object:
```js
import { base32 } from "rfc4648";
base32.stringify([42, 121, 160]); // -> 'FJ42A==='
base32.parse("FJ42A==="); // -> Uint8Array([42, 121, 160])
```
The library has tree-shaking support, so tools like [rollup.js](https://rollupjs.org/) or [Webpack 2+](https://webpack.js.org/) can automatically trim away any encodings you don't use.
- Zero external dependencies
- 100% test coverage
- Built-in types for Typescript & Flow
- 0.8K minified + gzip (can be even smaller with tree shaking)
## API details
The library provides the following top-level modules:
- `base64`
- `base64url`
- `base32`
- `base32hex`
- `base16`
- `codec`
Each module exports a `parse` and `stringify` function.
### const string = baseXX.stringify(data, opts)
Each `stringify` function takes array-like object of bytes and returns a string.
If you pass the option `{ pad: false }` in the second parameter, the encoder will not output padding characters (`=`).
### const data = baseXX.parse(string, opts)
Each `parse` function takes a string and returns a `Uint8Array` of bytes. If you would like a different return type, such as plain `Array` or a Node.js `Buffer`, pass its constructor in the second argument:
```js
base64.parse("AOk=", { out: Array });
base64.parse("AOk=", { out: Buffer.allocUnsafe });
```
The constructor will be called with `new`, and should accept a single integer for the output length, in bytes.
If you pass the option `{ loose: true }` in the second parameter, the parser will not validate padding characters (`=`):
```js
base64.parse("AOk", { loose: true }); // No error
```
The base32 codec will also fix common typo characters in loose mode:
```js
base32.parse("He1l0==", { loose: true }); // Auto-corrects as 'HELLO==='
```
### Custom encodings
To define your own encodings, use the `codec` module:
```js
const codec = require("rfc4648").codec;
const myEncoding = {
chars: "01234567",
bits: 3
};
codec.stringify([220, 10], myEncoding); // '670050=='
codec.parse("670050", myEncoding, { loose: true }); // [ 220, 10 ]
```
The `encoding` structure should have two members, a `chars` member giving the alphabet and a `bits` member giving the bits per character. The `codec.parse` function will extend this with a third member, `codes`, the first time it's called. The `codes` member is a lookup table mapping from characters back to numbers.

187
node_modules/rfc4648/lib/index.js generated vendored Normal file
View File

@ -0,0 +1,187 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
function parse(string, encoding, opts) {
var _opts$out;
if (opts === void 0) {
opts = {};
}
// Build the character lookup table:
if (!encoding.codes) {
encoding.codes = {};
for (var i = 0; i < encoding.chars.length; ++i) {
encoding.codes[encoding.chars[i]] = i;
}
} // The string must have a whole number of bytes:
if (!opts.loose && string.length * encoding.bits & 7) {
throw new SyntaxError('Invalid padding');
} // Count the padding bytes:
var end = string.length;
while (string[end - 1] === '=') {
--end; // If we get a whole number of bytes, there is too much padding:
if (!opts.loose && !((string.length - end) * encoding.bits & 7)) {
throw new SyntaxError('Invalid padding');
}
} // Allocate the output:
var out = new ((_opts$out = opts.out) != null ? _opts$out : Uint8Array)(end * encoding.bits / 8 | 0); // Parse the data:
var bits = 0; // Number of bits currently in the buffer
var buffer = 0; // Bits waiting to be written out, MSB first
var written = 0; // Next byte to write
for (var _i = 0; _i < end; ++_i) {
// Read one character from the string:
var value = encoding.codes[string[_i]];
if (value === undefined) {
throw new SyntaxError('Invalid character ' + string[_i]);
} // Append the bits to the buffer:
buffer = buffer << encoding.bits | value;
bits += encoding.bits; // Write out some bits if the buffer has a byte's worth:
if (bits >= 8) {
bits -= 8;
out[written++] = 0xff & buffer >> bits;
}
} // Verify that we have received just enough bits:
if (bits >= encoding.bits || 0xff & buffer << 8 - bits) {
throw new SyntaxError('Unexpected end of data');
}
return out;
}
function stringify(data, encoding, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$pad = _opts.pad,
pad = _opts$pad === void 0 ? true : _opts$pad;
var mask = (1 << encoding.bits) - 1;
var out = '';
var bits = 0; // Number of bits currently in the buffer
var buffer = 0; // Bits waiting to be written out, MSB first
for (var i = 0; i < data.length; ++i) {
// Slurp data into the buffer:
buffer = buffer << 8 | 0xff & data[i];
bits += 8; // Write out as much as we can:
while (bits > encoding.bits) {
bits -= encoding.bits;
out += encoding.chars[mask & buffer >> bits];
}
} // Partial character:
if (bits) {
out += encoding.chars[mask & buffer << encoding.bits - bits];
} // Add padding characters until we hit a byte boundary:
if (pad) {
while (out.length * encoding.bits & 7) {
out += '=';
}
}
return out;
}
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
var base16Encoding = {
chars: '0123456789ABCDEF',
bits: 4
};
var base32Encoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
bits: 5
};
var base32HexEncoding = {
chars: '0123456789ABCDEFGHIJKLMNOPQRSTUV',
bits: 5
};
var base64Encoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
bits: 6
};
var base64UrlEncoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
bits: 6
};
var base16 = {
parse: function parse$1(string, opts) {
return parse(string.toUpperCase(), base16Encoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base16Encoding, opts);
}
};
var base32 = {
parse: function parse$1(string, opts) {
if (opts === void 0) {
opts = {};
}
return parse(opts.loose ? string.toUpperCase().replace(/0/g, 'O').replace(/1/g, 'L').replace(/8/g, 'B') : string, base32Encoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base32Encoding, opts);
}
};
var base32hex = {
parse: function parse$1(string, opts) {
return parse(string, base32HexEncoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base32HexEncoding, opts);
}
};
var base64 = {
parse: function parse$1(string, opts) {
return parse(string, base64Encoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base64Encoding, opts);
}
};
var base64url = {
parse: function parse$1(string, opts) {
return parse(string, base64UrlEncoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base64UrlEncoding, opts);
}
};
var codec = {
parse: parse,
stringify: stringify
};
exports.base16 = base16;
exports.base32 = base32;
exports.base32hex = base32hex;
exports.base64 = base64;
exports.base64url = base64url;
exports.codec = codec;

3
node_modules/rfc4648/lib/index.js.flow generated vendored Normal file
View File

@ -0,0 +1,3 @@
// @flow
export * from '../src/index.flow.js'

11
node_modules/rfc4648/lib/index.mjs generated vendored Normal file
View File

@ -0,0 +1,11 @@
// Generated by rollup-plugin-mjs-entry
import cjs from './index.js';
export const base16 = cjs.base16;
export const base32 = cjs.base32;
export const base32hex = cjs.base32hex;
export const base64 = cjs.base64;
export const base64url = cjs.base64url;
export const codec = cjs.codec;
export default cjs;

178
node_modules/rfc4648/lib/rfc4648.js generated vendored Normal file
View File

@ -0,0 +1,178 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
function parse(string, encoding, opts) {
var _opts$out;
if (opts === void 0) {
opts = {};
}
// Build the character lookup table:
if (!encoding.codes) {
encoding.codes = {};
for (var i = 0; i < encoding.chars.length; ++i) {
encoding.codes[encoding.chars[i]] = i;
}
} // The string must have a whole number of bytes:
if (!opts.loose && string.length * encoding.bits & 7) {
throw new SyntaxError('Invalid padding');
} // Count the padding bytes:
var end = string.length;
while (string[end - 1] === '=') {
--end; // If we get a whole number of bytes, there is too much padding:
if (!opts.loose && !((string.length - end) * encoding.bits & 7)) {
throw new SyntaxError('Invalid padding');
}
} // Allocate the output:
var out = new ((_opts$out = opts.out) != null ? _opts$out : Uint8Array)(end * encoding.bits / 8 | 0); // Parse the data:
var bits = 0; // Number of bits currently in the buffer
var buffer = 0; // Bits waiting to be written out, MSB first
var written = 0; // Next byte to write
for (var _i = 0; _i < end; ++_i) {
// Read one character from the string:
var value = encoding.codes[string[_i]];
if (value === undefined) {
throw new SyntaxError('Invalid character ' + string[_i]);
} // Append the bits to the buffer:
buffer = buffer << encoding.bits | value;
bits += encoding.bits; // Write out some bits if the buffer has a byte's worth:
if (bits >= 8) {
bits -= 8;
out[written++] = 0xff & buffer >> bits;
}
} // Verify that we have received just enough bits:
if (bits >= encoding.bits || 0xff & buffer << 8 - bits) {
throw new SyntaxError('Unexpected end of data');
}
return out;
}
function stringify(data, encoding, opts) {
if (opts === void 0) {
opts = {};
}
var _opts = opts,
_opts$pad = _opts.pad,
pad = _opts$pad === void 0 ? true : _opts$pad;
var mask = (1 << encoding.bits) - 1;
var out = '';
var bits = 0; // Number of bits currently in the buffer
var buffer = 0; // Bits waiting to be written out, MSB first
for (var i = 0; i < data.length; ++i) {
// Slurp data into the buffer:
buffer = buffer << 8 | 0xff & data[i];
bits += 8; // Write out as much as we can:
while (bits > encoding.bits) {
bits -= encoding.bits;
out += encoding.chars[mask & buffer >> bits];
}
} // Partial character:
if (bits) {
out += encoding.chars[mask & buffer << encoding.bits - bits];
} // Add padding characters until we hit a byte boundary:
if (pad) {
while (out.length * encoding.bits & 7) {
out += '=';
}
}
return out;
}
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
var base16Encoding = {
chars: '0123456789ABCDEF',
bits: 4
};
var base32Encoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
bits: 5
};
var base32HexEncoding = {
chars: '0123456789ABCDEFGHIJKLMNOPQRSTUV',
bits: 5
};
var base64Encoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
bits: 6
};
var base64UrlEncoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
bits: 6
};
var base16 = {
parse: function parse$1(string, opts) {
return parse(string.toUpperCase(), base16Encoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base16Encoding, opts);
}
};
var base32 = {
parse: function parse$1(string, opts) {
if (opts === void 0) {
opts = {};
}
return parse(opts.loose ? string.toUpperCase().replace(/0/g, 'O').replace(/1/g, 'L').replace(/8/g, 'B') : string, base32Encoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base32Encoding, opts);
}
};
var base32hex = {
parse: function parse$1(string, opts) {
return parse(string, base32HexEncoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base32HexEncoding, opts);
}
};
var base64 = {
parse: function parse$1(string, opts) {
return parse(string, base64Encoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base64Encoding, opts);
}
};
var base64url = {
parse: function parse$1(string, opts) {
return parse(string, base64UrlEncoding, opts);
},
stringify: function stringify$1(data, opts) {
return stringify(data, base64UrlEncoding, opts);
}
};
var codec = {
parse: parse,
stringify: stringify
};
export { base16, base32, base32hex, base64, base64url, codec };

3
node_modules/rfc4648/lib/rfc4648.js.flow generated vendored Normal file
View File

@ -0,0 +1,3 @@
// @flow
export * from '../src/index.flow.js'

18
node_modules/rfc4648/lib/src/codec.d.ts generated vendored Normal file
View File

@ -0,0 +1,18 @@
export interface Encoding {
bits: number;
chars: string;
codes?: {
[char: string]: number;
};
}
export interface ParseOptions {
loose?: boolean;
out?: new (size: number) => {
[index: number]: number;
};
}
export interface StringifyOptions {
pad?: boolean;
}
export declare function parse(string: string, encoding: Encoding, opts?: ParseOptions): Uint8Array;
export declare function stringify(data: ArrayLike<number>, encoding: Encoding, opts?: StringifyOptions): string;

25
node_modules/rfc4648/lib/src/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,25 @@
import { parse, ParseOptions, stringify, StringifyOptions } from './codec';
export declare const base16: {
parse(string: string, opts?: ParseOptions | undefined): Uint8Array;
stringify(data: ArrayLike<number>, opts?: StringifyOptions | undefined): string;
};
export declare const base32: {
parse(string: string, opts?: ParseOptions): Uint8Array;
stringify(data: ArrayLike<number>, opts?: StringifyOptions | undefined): string;
};
export declare const base32hex: {
parse(string: string, opts?: ParseOptions | undefined): Uint8Array;
stringify(data: ArrayLike<number>, opts?: StringifyOptions | undefined): string;
};
export declare const base64: {
parse(string: string, opts?: ParseOptions | undefined): Uint8Array;
stringify(data: ArrayLike<number>, opts?: StringifyOptions | undefined): string;
};
export declare const base64url: {
parse(string: string, opts?: ParseOptions | undefined): Uint8Array;
stringify(data: ArrayLike<number>, opts?: StringifyOptions | undefined): string;
};
export declare const codec: {
parse: typeof parse;
stringify: typeof stringify;
};

1
node_modules/rfc4648/lib/test/tests.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export {};

85
node_modules/rfc4648/package.json generated vendored Normal file
View File

@ -0,0 +1,85 @@
{
"name": "rfc4648",
"version": "1.5.0",
"description": "Encoding and decoding for base64, base32, base16, and friends",
"keywords": [
"Uint8Array",
"base16",
"base32",
"base32hex",
"base64",
"base64url",
"hex"
],
"repository": {
"type": "git",
"url": "git@github.com:swansontec/rfc4648.js.git"
},
"license": "MIT",
"author": "William Swanson",
"exports": {
".": {
"import": "./lib/index.mjs",
"require": "./lib/index.js"
},
"./package.json": "./package.json"
},
"main": "./lib/index.js",
"module": "./lib/rfc4648.js",
"types": "./lib/src/index.d.ts",
"files": [
"CHANGELOG.md",
"lib/*",
"README.md",
"src/*"
],
"scripts": {
"build.lib": "rollup -c",
"build.types": "tsc",
"clean": "rimraf lib",
"fix": "npm run lint -- --fix",
"lint": "eslint --ext .js,.ts .",
"precommit": "npm-run-all lint -p test build.*",
"prepare": "npm-run-all clean -p build.*",
"test": "nyc mocha test/**/*.ts"
},
"husky": {
"hooks": {
"pre-commit": "npm run precommit"
}
},
"devDependencies": {
"@babel/core": "^7.14.0",
"@babel/preset-env": "^7.14.1",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@types/chai": "^4.2.18",
"@types/mocha": "^8.2.2",
"@typescript-eslint/eslint-plugin": "^4.8.2",
"@typescript-eslint/parser": "^4.8.2",
"babel-eslint": "^10.1.0",
"chai": "^4.3.4",
"eslint": "^7.14.0",
"eslint-config-standard-kit": "0.15.1",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-simple-import-sort": "^6.0.1",
"husky": "^4.3.0",
"lint-staged": "^10.5.3",
"mocha": "^8.4.0",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"prettier": "^2.2.0",
"rimraf": "^3.0.2",
"rollup": "^2.47.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-flow-entry": "^0.3.5",
"rollup-plugin-mjs-entry": "^0.1.1",
"rollup-plugin-uglify": "^6.0.4",
"sucrase": "^3.18.1",
"typescript": "^4.1.2"
}
}

118
node_modules/rfc4648/src/codec.ts generated vendored Normal file
View File

@ -0,0 +1,118 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
export interface Encoding {
bits: number
chars: string
codes?: { [char: string]: number }
}
export interface ParseOptions {
loose?: boolean
out?: new (size: number) => { [index: number]: number }
}
export interface StringifyOptions {
pad?: boolean
}
export function parse(
string: string,
encoding: Encoding,
opts: ParseOptions = {}
): Uint8Array {
// Build the character lookup table:
if (!encoding.codes) {
encoding.codes = {}
for (let i = 0; i < encoding.chars.length; ++i) {
encoding.codes[encoding.chars[i]] = i
}
}
// The string must have a whole number of bytes:
if (!opts.loose && (string.length * encoding.bits) & 7) {
throw new SyntaxError('Invalid padding')
}
// Count the padding bytes:
let end = string.length
while (string[end - 1] === '=') {
--end
// If we get a whole number of bytes, there is too much padding:
if (!opts.loose && !(((string.length - end) * encoding.bits) & 7)) {
throw new SyntaxError('Invalid padding')
}
}
// Allocate the output:
const out = new (opts.out ?? Uint8Array)(
((end * encoding.bits) / 8) | 0
) as Uint8Array
// Parse the data:
let bits = 0 // Number of bits currently in the buffer
let buffer = 0 // Bits waiting to be written out, MSB first
let written = 0 // Next byte to write
for (let i = 0; i < end; ++i) {
// Read one character from the string:
const value = encoding.codes[string[i]]
if (value === undefined) {
throw new SyntaxError('Invalid character ' + string[i])
}
// Append the bits to the buffer:
buffer = (buffer << encoding.bits) | value
bits += encoding.bits
// Write out some bits if the buffer has a byte's worth:
if (bits >= 8) {
bits -= 8
out[written++] = 0xff & (buffer >> bits)
}
}
// Verify that we have received just enough bits:
if (bits >= encoding.bits || 0xff & (buffer << (8 - bits))) {
throw new SyntaxError('Unexpected end of data')
}
return out
}
export function stringify(
data: ArrayLike<number>,
encoding: Encoding,
opts: StringifyOptions = {}
): string {
const { pad = true } = opts
const mask = (1 << encoding.bits) - 1
let out = ''
let bits = 0 // Number of bits currently in the buffer
let buffer = 0 // Bits waiting to be written out, MSB first
for (let i = 0; i < data.length; ++i) {
// Slurp data into the buffer:
buffer = (buffer << 8) | (0xff & data[i])
bits += 8
// Write out as much as we can:
while (bits > encoding.bits) {
bits -= encoding.bits
out += encoding.chars[mask & (buffer >> bits)]
}
}
// Partial character:
if (bits) {
out += encoding.chars[mask & (buffer << (encoding.bits - bits))]
}
// Add padding characters until we hit a byte boundary:
if (pad) {
while ((out.length * encoding.bits) & 7) {
out += '='
}
}
return out
}

49
node_modules/rfc4648/src/index.flow.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
// @flow
type Encoding = {
bits: number,
chars: string,
codes?: { [char: string]: number }
}
type ParseOptions = {
loose?: boolean,
out?: any
}
type StringifyOptions = {
pad?: boolean
}
type ArrayLike<T> = {
+length: number,
+[n: number]: T
}
function parse(string: string, opts?: ParseOptions): Uint8Array {
return new Uint8Array(0)
}
function stringify(data: ArrayLike<number>, opts?: StringifyOptions): string {
return ''
}
export const base16 = { parse, stringify }
export const base32 = { parse, stringify }
export const base32hex = { parse, stringify }
export const base64 = { parse, stringify }
export const base64url = { parse, stringify }
export const codec = {
parse(string: string, encoding: Encoding, opts?: ParseOptions): Uint8Array {
return new Uint8Array(0)
},
stringify(
data: ArrayLike<number>,
encoding: Encoding,
opts?: StringifyOptions
): string {
return ''
}
}

96
node_modules/rfc4648/src/index.ts generated vendored Normal file
View File

@ -0,0 +1,96 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
import {
Encoding,
parse,
ParseOptions,
stringify,
StringifyOptions
} from './codec'
const base16Encoding: Encoding = {
chars: '0123456789ABCDEF',
bits: 4
}
const base32Encoding: Encoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
bits: 5
}
const base32HexEncoding: Encoding = {
chars: '0123456789ABCDEFGHIJKLMNOPQRSTUV',
bits: 5
}
const base64Encoding: Encoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
bits: 6
}
const base64UrlEncoding: Encoding = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
bits: 6
}
export const base16 = {
parse(string: string, opts?: ParseOptions): Uint8Array {
return parse(string.toUpperCase(), base16Encoding, opts)
},
stringify(data: ArrayLike<number>, opts?: StringifyOptions): string {
return stringify(data, base16Encoding, opts)
}
}
export const base32 = {
parse(string: string, opts: ParseOptions = {}): Uint8Array {
return parse(
opts.loose
? string
.toUpperCase()
.replace(/0/g, 'O')
.replace(/1/g, 'L')
.replace(/8/g, 'B')
: string,
base32Encoding,
opts
)
},
stringify(data: ArrayLike<number>, opts?: StringifyOptions): string {
return stringify(data, base32Encoding, opts)
}
}
export const base32hex = {
parse(string: string, opts?: ParseOptions): Uint8Array {
return parse(string, base32HexEncoding, opts)
},
stringify(data: ArrayLike<number>, opts?: StringifyOptions): string {
return stringify(data, base32HexEncoding, opts)
}
}
export const base64 = {
parse(string: string, opts?: ParseOptions): Uint8Array {
return parse(string, base64Encoding, opts)
},
stringify(data: ArrayLike<number>, opts?: StringifyOptions): string {
return stringify(data, base64Encoding, opts)
}
}
export const base64url = {
parse(string: string, opts?: ParseOptions): Uint8Array {
return parse(string, base64UrlEncoding, opts)
},
stringify(data: ArrayLike<number>, opts?: StringifyOptions): string {
return stringify(data, base64UrlEncoding, opts)
}
}
export const codec = { parse, stringify }