First release

This commit is contained in:
Owen Quinlan 2021-07-02 19:29:34 +10:00
commit fa6c85266e
2339 changed files with 761050 additions and 0 deletions

85
node_modules/pkcs7/src/pad.js generated vendored Normal file
View file

@ -0,0 +1,85 @@
/*
* pkcs7.pad
* https://github.com/brightcove/pkcs7
*
* Copyright (c) 2014 Brightcove
* Licensed under the apache2 license.
*/
let PADDING;
/**
* Returns a new Uint8Array that is padded with PKCS#7 padding.
*
* @param plaintext {Uint8Array} the input bytes before encryption
* @return {Uint8Array} the padded bytes
* @see http://tools.ietf.org/html/rfc5652
*/
export default function pad(plaintext) {
const padding = PADDING[(plaintext.byteLength % 16) || 0];
const result = new Uint8Array(plaintext.byteLength + padding.length);
result.set(plaintext);
result.set(padding, plaintext.byteLength);
return result;
}
// pre-define the padding values
PADDING = [
[16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16],
[15, 15, 15, 15,
15, 15, 15, 15,
15, 15, 15, 15,
15, 15, 15],
[14, 14, 14, 14,
14, 14, 14, 14,
14, 14, 14, 14,
14, 14],
[13, 13, 13, 13,
13, 13, 13, 13,
13, 13, 13, 13,
13],
[12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12],
[11, 11, 11, 11,
11, 11, 11, 11,
11, 11, 11],
[10, 10, 10, 10,
10, 10, 10, 10,
10, 10],
[9, 9, 9, 9,
9, 9, 9, 9,
9],
[8, 8, 8, 8,
8, 8, 8, 8],
[7, 7, 7, 7,
7, 7, 7],
[6, 6, 6, 6,
6, 6],
[5, 5, 5, 5,
5],
[4, 4, 4, 4],
[3, 3, 3],
[2, 2],
[1]
];

5
node_modules/pkcs7/src/pkcs7.js generated vendored Normal file
View file

@ -0,0 +1,5 @@
import pad from './pad.js';
import unpad from './unpad.js';
import {version as VERSION} from '../package.json';
export { pad, unpad, VERSION };

10
node_modules/pkcs7/src/unpad.js generated vendored Normal file
View file

@ -0,0 +1,10 @@
/**
* Returns the subarray of a Uint8Array without PKCS#7 padding.
*
* @param padded {Uint8Array} unencrypted bytes that have been padded
* @return {Uint8Array} the unpadded bytes
* @see http://tools.ietf.org/html/rfc5652
*/
export default function unpad(padded) {
return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
}