Skip to content

Commit

Permalink
Bug 1811633 - vendor PKI.js r=tjr,Gijs
Browse files Browse the repository at this point in the history
  • Loading branch information
mozkeeler committed Jan 26, 2023
1 parent b20db2f commit 27dea11
Show file tree
Hide file tree
Showing 146 changed files with 61,604 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ _OPT\.OBJ/
^remote/test/puppeteer/utils/mochaRunner/lib/
^remote/test/puppeteer/website

^third_party/js/PKI.js/node_modules/
^third_party/js/PKI.js/package-lock.json

# git checkout of libstagefright
^media/libstagefright/android$

Expand Down
30 changes: 30 additions & 0 deletions third_party/js/PKI.js/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2014, GlobalSign
Copyright (c) 2015-2019, Peculiar Ventures
All rights reserved.

Author 2014-2019, Yury Strozhevsky

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* Neither the name of the {organization} nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70 changes: 70 additions & 0 deletions third_party/js/PKI.js/make-esmodule-bundle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
diff --git a/rollup.config.js b/rollup.config.js
index 8c8a7c2..b6e61c0 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -3,6 +3,7 @@ import fs from "fs";
import typescript from "rollup-plugin-typescript2";
import dts from "rollup-plugin-dts";
import pkg from "./package.json";
+import { nodeResolve } from '@rollup/plugin-node-resolve';

const LICENSE = fs.readFileSync("LICENSE", { encoding: "utf-8" });
const banner = [
@@ -12,7 +13,6 @@ const banner = [
"",
].join("\n");
const input = "src/index.ts";
-const external = Object.keys(pkg.dependencies || {});

export default [
{
@@ -26,10 +26,10 @@ export default [
module: "ES2015",
removeComments: true,
}
- }
+ },
}),
+ nodeResolve(),
],
- external: [...external],
output: [
{
banner,
@@ -45,7 +45,6 @@ export default [
},
{
input,
- external: [...external],
plugins: [
dts({
tsconfig: path.resolve(__dirname, "./tsconfig.json")
@@ -58,4 +57,4 @@ export default [
}
]
},
-];
\ No newline at end of file
+];
diff --git a/tsconfig.json b/tsconfig.json
index ffd67ec..e72bdb6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,7 +1,8 @@
{
"compilerOptions": {
- "target": "ES2019",
- "module": "CommonJS",
+ "target": "ES6",
+ "module": "ES6",
+ "moduleResolution": "node",
"strict": true,
"importHelpers": true,
"noImplicitOverride": true,
@@ -11,4 +12,4 @@
"exclude": [
"build/*.ts"
]
-}
\ No newline at end of file
+}
5 changes: 5 additions & 0 deletions third_party/js/PKI.js/make_bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

patch -p1 < make-esmodule-bundle.patch
npm install
npm run build
85 changes: 85 additions & 0 deletions third_party/js/PKI.js/moz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Version of this schema
schema: 1

bugzilla:
# Bugzilla product and component for this directory and subdirectories
product: Firefox
component: Security

# Document the source of externally hosted code
origin:

# Short name of the package/library
name: PKIjs

description: TypeScript library for interacting with public key infrastructure types.

# Full URL for the package's homepage/etc
# Usually different from repository url
url: https://pkijs.org/

# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: 72d175c9edbc8e00c550dee610a8dac6204f4383 (2023-01-15T09:12:35Z).

# Revision to pull in
# Must be a long or short commit SHA (long preferred)
revision: 72d175c9edbc8e00c550dee610a8dac6204f4383

# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/
# Multiple licenses can be specified (as a YAML list)
# A "LICENSE" file must exist containing the full license text
license: BSD-3-Clause

# If the package's license is specified in a particular file,
# this is the name of the file.
# optional
license-file: LICENSE

# Configuration for the automated vendoring system.
# optional
vendoring:

# Repository URL to vendor from
# eg. https://github.com/kinetiknz/nestegg
# Any repository host can be specified here, however initially we'll only
# support automated vendoring from selected sources.
url: https://github.com/PeculiarVentures/PKI.js

# Type of hosting for the upstream repository
# Valid values are 'gitlab', 'github', googlesource
source-hosting: github

# Files/paths that will not be vendored from the upstream repository
# Implicitly contains ".git", and ".gitignore"
# optional
exclude:
- .eslintrc.json
- .github/
- .gitignore
- .mocharc.yaml
- .nycrc
- CNAME
- FEATURES.md
- MAPPING.md
- README.md
- examples/
- test/
- typedoc.json

keep:
- make_bundle.sh
- make-esmodule-bundle.patch

update-actions:
- action: run-script
script: 'make_bundle.sh'
cwd: '{yaml_dir}'

- action: move-file
from: 'build/index.es.js'
to: '../../../toolkit/components/certviewer/content/vendor/pkijs.js'

- action: delete-path
path: 'build'
86 changes: 86 additions & 0 deletions third_party/js/PKI.js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"author": {
"email": "[email protected]",
"name": "Yury Strozhevsky"
},
"description": "Public Key Infrastructure (PKI) is the basis of how identity and key management is performed on the web today. PKIjs is a pure JavaScript library implementing the formats that are used in PKI applications. It is built on WebCrypto and aspires to make it possible to build native web applications that utilize X.509 and the related formats on the web without plug-ins",
"contributors": [
{
"email": "[email protected]",
"name": "Ryan Hurst"
}
],
"repository": {
"type": "git",
"url": "git://github.com/PeculiarVentures/PKI.js.git"
},
"devDependencies": {
"@peculiar/webcrypto": "^1.4.0",
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/mocha": "^9.1.1",
"@types/node": "^18.6.3",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"assert": "^2.0.0",
"emailjs-mime-builder": "^2.0.5",
"emailjs-mime-parser": "^2.0.7",
"eslint": "^8.21.0",
"eslint-plugin-deprecation": "^1.3.2",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"rollup": "^2.77.2",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-typescript2": "^0.32.1",
"ts-node": "^10.9.1",
"typedoc": "^0.23.10",
"typescript": "^4.7.4"
},
"dependencies": {
"asn1js": "^3.0.5",
"bytestreamjs": "^2.0.0",
"pvtsutils": "^1.3.2",
"pvutils": "^1.1.3",
"tslib": "^2.4.0"
},
"engines": {
"node": ">=12.0.0"
},
"scripts": {
"build": "rollup -c",
"build:examples": "rollup -c examples/rollup.config.js",
"build:docs": "typedoc",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint --fix . --ext .ts",
"coverage": "nyc npm test",
"test": "mocha",
"prepublishOnly": "npm run build"
},
"keywords": [
"ES6",
"ES2015",
"WebCrypto",
"Web Cryptography API",
"X.509",
"certificate",
"crl",
"cms",
"encrypted",
"enveloped",
"OCSP",
"timestamp",
"PKCS"
],
"files": [
"build",
"README.md",
"LICENSE"
],
"module": "build/index.es.js",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"name": "pkijs",
"version": "3.0.11",
"license": "BSD-3-Clause"
}
60 changes: 60 additions & 0 deletions third_party/js/PKI.js/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import path from "path";
import fs from "fs";
import typescript from "rollup-plugin-typescript2";
import dts from "rollup-plugin-dts";
import pkg from "./package.json";
import { nodeResolve } from '@rollup/plugin-node-resolve';

const LICENSE = fs.readFileSync("LICENSE", { encoding: "utf-8" });
const banner = [
"/*!",
...LICENSE.split("\n").map(o => ` * ${o}`),
" */",
"",
].join("\n");
const input = "src/index.ts";

export default [
{
input,
plugins: [
typescript({
check: true,
clean: true,
tsconfigOverride: {
compilerOptions: {
module: "ES2015",
removeComments: true,
}
},
}),
nodeResolve(),
],
output: [
{
banner,
file: pkg.main,
format: "cjs",
},
{
banner,
file: pkg.module,
format: "es",
},
],
},
{
input,
plugins: [
dts({
tsconfig: path.resolve(__dirname, "./tsconfig.json")
})
],
output: [
{
banner,
file: pkg.types,
}
]
},
];
Loading

0 comments on commit 27dea11

Please sign in to comment.