Updated the files.

This commit is contained in:
Batuhan Berk Başoğlu 2024-02-08 19:38:41 -05:00
parent 1553e6b971
commit 753967d4f5
23418 changed files with 3784666 additions and 0 deletions

21
my-app/node_modules/@tufjs/canonical-json/LICENSE generated vendored Executable file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 GitHub and the TUF Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

53
my-app/node_modules/@tufjs/canonical-json/README.md generated vendored Executable file
View file

@ -0,0 +1,53 @@
# @tufjs/canonical-json
JSON canonicalization compliant with the [OLPC Canonical JSON specification][1].
## Why
If you're looking for [RFC 8785][2] compliant JSON canonicalization there are
[any][3] [number][4] [of][5] [libraries][6] [to][7] [choose][8] [from][9].
You should only select this library if you know that you specifically need
support for the [OLPC][1]-style of canonicalization.
One reason you might chose OLPC compliance is for interoperability with
[The Update Framework][10] which specifically calls out OLPC as the
canonicalization standard for computing signatures over TUF metadata.
The canonicalized strings generated by this library are compatible with those
generated by the Python-based [securesystemslib][11] library and the Go-based
[go-securesystemslib][12] library.
## Installation
```console
npm install @tufjs/canonical-json
```
## Usage
```javascript
const json = require('@tufjs/canonical-json')
const obj = {
bool: true,
num: 42,
ary: [1, 2, 3],
str: "foo\\bar"
}
console.log(json.canonicalize(obj))
// output: {"ary":[1,2,3],"bool":true,"num":42,"str":"foo\\bar"}
```
[1]: https://wiki.laptop.org/go/Canonical_JSON
[2]: https://www.rfc-editor.org/rfc/rfc8785
[3]: https://www.npmjs.com/package/@stratumn/canonicaljson
[4]: https://www.npmjs.com/package/@truestamp/canonify
[5]: https://www.npmjs.com/package/canonical-json
[6]: https://www.npmjs.com/package/canonicalize
[7]: https://www.npmjs.com/package/canonicalize-json
[8]: https://www.npmjs.com/package/json-canonicalize
[9]: https://www.npmjs.com/package/another-json
[10]: https://theupdateframework.github.io/specification/latest/#metaformat
[11]: https://github.com/secure-systems-lab/securesystemslib
[12]: https://github.com/secure-systems-lab/go-securesystemslib

2
my-app/node_modules/@tufjs/canonical-json/lib/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const canonicalize: (object: any) => string;

64
my-app/node_modules/@tufjs/canonical-json/lib/index.js generated vendored Executable file
View file

@ -0,0 +1,64 @@
const COMMA = ',';
const COLON = ':';
const LEFT_SQUARE_BRACKET = '[';
const RIGHT_SQUARE_BRACKET = ']';
const LEFT_CURLY_BRACKET = '{';
const RIGHT_CURLY_BRACKET = '}';
// Recursively encodes the supplied object according to the canonical JSON form
// as specified at http://wiki.laptop.org/go/Canonical_JSON. It's a restricted
// dialect of JSON in which keys are lexically sorted, floats are not allowed,
// and only double quotes and backslashes are escaped.
function canonicalize(object) {
const buffer = [];
if (typeof object === 'string') {
buffer.push(canonicalizeString(object));
} else if (typeof object === 'boolean') {
buffer.push(JSON.stringify(object));
} else if (Number.isInteger(object)) {
buffer.push(JSON.stringify(object));
} else if (object === null) {
buffer.push(JSON.stringify(object));
} else if (Array.isArray(object)) {
buffer.push(LEFT_SQUARE_BRACKET);
let first = true;
object.forEach((element) => {
if (!first) {
buffer.push(COMMA);
}
first = false;
buffer.push(canonicalize(element));
});
buffer.push(RIGHT_SQUARE_BRACKET);
} else if (typeof object === 'object') {
buffer.push(LEFT_CURLY_BRACKET);
let first = true;
Object.keys(object)
.sort()
.forEach((property) => {
if (!first) {
buffer.push(COMMA);
}
first = false;
buffer.push(canonicalizeString(property));
buffer.push(COLON);
buffer.push(canonicalize(object[property]));
});
buffer.push(RIGHT_CURLY_BRACKET);
} else {
throw new TypeError('cannot encode ' + object.toString());
}
return buffer.join('');
}
// String canonicalization consists of escaping backslash (\) and double
// quote (") characters and wrapping the resulting string in double quotes.
function canonicalizeString(string) {
const escapedString = string.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
return '"' + escapedString + '"';
}
module.exports = {
canonicalize,
};

35
my-app/node_modules/@tufjs/canonical-json/package.json generated vendored Executable file
View file

@ -0,0 +1,35 @@
{
"name": "@tufjs/canonical-json",
"version": "2.0.0",
"description": "OLPC JSON canonicalization",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"license": "MIT",
"keywords": [
"json",
"canonical",
"canonicalize",
"canonicalization",
"crypto",
"signature",
"olpc"
],
"author": "bdehamer@github.com",
"repository": {
"type": "git",
"url": "git+https://github.com/theupdateframework/tuf-js.git"
},
"homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/canonical-json#readme",
"bugs": {
"url": "https://github.com/theupdateframework/tuf-js/issues"
},
"files": [
"lib/"
],
"scripts": {
"test": "jest"
},
"engines": {
"node": "^16.14.0 || >=18.0.0"
}
}