-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(website): add empty "docs" folder to prevent build crash * chore(website): add option to hide code sources * chore(website): add few source examples * chore(website): add empty example sources * ci: update deploy website flow * lint: remove website folder
- Loading branch information
Showing
66 changed files
with
9,598 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Node.js CI | ||
name: Build and test library | ||
|
||
on: [push, pull_request] | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build and publish website | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
pages: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: 'yarn' | ||
|
||
- name: Install library dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build library | ||
run: yarn build | ||
|
||
- name: Install website dependencies | ||
run: yarn install --frozen-lockfile --cwd website | ||
|
||
- name: Build website | ||
run: yarn build --cwd website | ||
|
||
- name: Deploy to gh-pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: website/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ build | |
coverage | ||
.vs | ||
.vscode | ||
docs | ||
|
||
bundle.js | ||
test/browser/*.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"experimentalDecorators": true | ||
}, | ||
"exclude": [ | ||
"website", | ||
"build/*.ts" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
|
||
/docs/api/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
Empty file.
64 changes: 64 additions & 0 deletions
64
website/docs/examples/certificates-and-revocation/create-and-validate-certificate.example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as pkijs from 'pkijs'; | ||
import * as asn1js from 'asn1js'; | ||
|
||
const crypto = pkijs.getCrypto(true); | ||
|
||
// Create certificate | ||
const certificate = new pkijs.Certificate(); | ||
certificate.version = 2; | ||
certificate.serialNumber = new asn1js.Integer({ value: 1 }); | ||
certificate.issuer.typesAndValues.push(new pkijs.AttributeTypeAndValue({ | ||
type: "2.5.4.3", // Common name | ||
value: new asn1js.BmpString({ value: "Test" }) | ||
})); | ||
certificate.subject.typesAndValues.push(new pkijs.AttributeTypeAndValue({ | ||
type: "2.5.4.3", // Common name | ||
value: new asn1js.BmpString({ value: "Test" }) | ||
})); | ||
|
||
certificate.notBefore.value = new Date(); | ||
const notAfter = new Date(); | ||
notAfter.setUTCFullYear(notAfter.getUTCFullYear() + 1); | ||
certificate.notAfter.value = notAfter; | ||
|
||
certificate.extensions = []; // Extensions are not a part of certificate by default, it's an optional array | ||
|
||
// "BasicConstraints" extension | ||
const basicConstr = new pkijs.BasicConstraints({ | ||
cA: true, | ||
pathLenConstraint: 3 | ||
}); | ||
certificate.extensions.push(new pkijs.Extension({ | ||
extnID: "2.5.29.19", | ||
critical: false, | ||
extnValue: basicConstr.toSchema().toBER(false), | ||
parsedValue: basicConstr // Parsed value for well-known extensions | ||
})); | ||
|
||
// "KeyUsage" extension | ||
const bitArray = new ArrayBuffer(1); | ||
const bitView = new Uint8Array(bitArray); | ||
bitView[0] |= 0x02; // Key usage "cRLSign" flag | ||
bitView[0] |= 0x04; // Key usage "keyCertSign" flag | ||
const keyUsage = new asn1js.BitString({ valueHex: bitArray }); | ||
certificate.extensions.push(new pkijs.Extension({ | ||
extnID: "2.5.29.15", | ||
critical: false, | ||
extnValue: keyUsage.toBER(false), | ||
parsedValue: keyUsage // Parsed value for well-known extensions | ||
})); | ||
|
||
const algorithm = pkijs.getAlgorithmParameters("RSASSA-PKCS1-v1_5", "generateKey"); | ||
if ("hash" in algorithm.algorithm) { | ||
algorithm.algorithm.hash.name = "SHA-256"; | ||
} | ||
|
||
const keys = await crypto.generateKey(algorithm.algorithm, true, algorithm.usages); | ||
|
||
// Exporting public key into "subjectPublicKeyInfo" value of certificate | ||
await certificate.subjectPublicKeyInfo.importKey(keys.publicKey); | ||
|
||
// Signing final certificate | ||
await certificate.sign(keys.privateKey, "SHA-256"); | ||
|
||
const raw = certificate.toSchema().toBER(); |
10 changes: 10 additions & 0 deletions
10
...e/docs/examples/certificates-and-revocation/create-and-validate-certificate.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import CodeBlock from '@theme/CodeBlock'; | ||
import source from '!!raw-loader!./create-and-validate-certificate.example'; | ||
|
||
# Create and validate certificate | ||
|
||
In this example, you will see how to create a self-signed X.509 certificate, parse an X.509 certificate, and show how to do certificate chain validation engine. | ||
|
||
<CodeBlock language="ts"> | ||
{source} | ||
</CodeBlock> |
1 change: 1 addition & 0 deletions
1
website/docs/examples/certificates-and-revocation/creating-and-parsing-CRLs.example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Coming soon |
10 changes: 10 additions & 0 deletions
10
website/docs/examples/certificates-and-revocation/creating-and-parsing-CRLs.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import CodeBlock from '@theme/CodeBlock'; | ||
import source from '!!raw-loader!./creating-and-parsing-CRLs.example'; | ||
|
||
# Creating and parsing CRLs | ||
|
||
In this example, you will see how to create a CRL, parse, and validate it. | ||
|
||
<CodeBlock language="ts"> | ||
{source} | ||
</CodeBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# Certificates and Revocation | ||
|
||
<DocCardList /> |
Oops, something went wrong.