Upload via GUI (7543 Dateien)
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2026 Peculiar Ventures, LLC
|
||||
|
||||
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.
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
<h1 align="center">
|
||||
@peculiar/webcrypto
|
||||
</h1>
|
||||
|
||||
<div align="center">
|
||||
|
||||

|
||||

|
||||
[](https://www.npmjs.com/package/@peculiar/webcrypto)
|
||||

|
||||
[](https://www.npmjs.com/package/@peculiar/webcrypto)
|
||||
|
||||
</div>
|
||||
|
||||
We wanted to be able to write Javascript that used crypto on both the client and the server but we did not want to rely on Javascript implementations of crypto. The only native cryptography available in browser is [Web Crypto](http://caniuse.com/#search=cryptography), this resulted in us creating a `@peculiar/webcrypto`.
|
||||
|
||||
## Table Of Contents
|
||||
|
||||
* [WARNING](#warning)
|
||||
* [Installing](#installing)
|
||||
* [Using](#using)
|
||||
* [Examples](#examples)
|
||||
* [Bug Reporting](#bug-reporting)
|
||||
* [Related](#related)
|
||||
|
||||
## WARNING
|
||||
|
||||
**At this time this solution should be considered suitable for research and experimentation, further code and security review is needed before utilization in a production application.**
|
||||
|
||||
**Module is based on the Node.js crypto API. It requires Node v14.18.0 or higher.**
|
||||
|
||||
## Installing
|
||||
|
||||
```
|
||||
npm install @peculiar/webcrypto
|
||||
```
|
||||
|
||||
## Supported algorithms
|
||||
|
||||
| Algorithm name | generateKey | digest | export/import | sign/verify | encrypt/decrypt | wrapKey/unwrapKey | derive |
|
||||
|-------------------|-------------|---------|---------------|-------------|-----------------|-------------------|---------|
|
||||
| SHA-1 | | X | | | | | |
|
||||
| SHA-256 | | X | | | | | |
|
||||
| SHA-384 | | X | | | | | |
|
||||
| SHA-512 | | X | | | | | |
|
||||
| HMAC | X | | X | X | | | |
|
||||
| RSASSA-PKCS1-v1_5 | X | | X | X | | | |
|
||||
| RSAES-PKCS1-v1_5<sup>2</sup>| X | | X | | X | X | |
|
||||
| RSA-PSS | X | | X | X | | | |
|
||||
| RSA-OAEP | X | | X | | X | X | |
|
||||
| AES-CMAC | X | | X | X | | | |
|
||||
| AES-CBC | X | | X | | X | X | |
|
||||
| AES-CTR | X | | X | | X | X | |
|
||||
| AES-ECB | X | | X | | X | X | |
|
||||
| AES-GCM | X | | X | | X | X | |
|
||||
| AES-KW | X | | X | | | X | |
|
||||
| ECDSA<sup>1</sup> | X | | X | X | | | |
|
||||
| ECDH<sup>1</sup> | X | | X | | | | X |
|
||||
| EdDSA<sup>2,3</sup> | X | | X | X | | | |
|
||||
| ECDH-ES<sup>2,4</sup> | X | | X | | | | X |
|
||||
| HKDF | | | X | | | | X |
|
||||
| PBKDF2 | | | X | | | | X |
|
||||
| DES-CBC<sup>2</sup>| X | | X | | X | X | |
|
||||
| DES-EDE3-CBC<sup>2</sup>| X | | X | | X | X | |
|
||||
| shake128<sup>2</sup>| | X | | | | | |
|
||||
| shake256<sup>2</sup>| | X | | | | | |
|
||||
|
||||
<sup>1</sup> Mechanism supports extended list of named curves `P-256`, `P-384`, `P-521`, `K-256`,
|
||||
`brainpoolP160r1`, `brainpoolP160t1`, `brainpoolP192r1`, `brainpoolP192t1`, `brainpoolP224r1`, `brainpoolP224t1`, `brainpoolP256r1`, `brainpoolP256t1`, `brainpoolP320r1`, `brainpoolP320t1`, `brainpoolP384r1`, `brainpoolP384t1`, `brainpoolP512r1`, and `brainpoolP512t1`
|
||||
|
||||
<sup>2</sup> Mechanism is not defined by the WebCrypto specifications. Use of mechanism in a safe way is hard, it was added for the purpose of enabling interoperability with an existing system. We recommend against its use unless needed for interoperability.
|
||||
|
||||
<sup>3</sup> Mechanism supports extended list of named curves `Ed25519`, and `Ed448`
|
||||
|
||||
<sup>4</sup> Mechanism supports extended list of named curves `X25519`, and `X448`
|
||||
|
||||
## Using
|
||||
|
||||
```javascript
|
||||
const { Crypto } = require("@peculiar/webcrypto");
|
||||
|
||||
const crypto = new Crypto();
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
See [WebCrypto Docs](https://github.com/PeculiarVentures/webcrypto-docs/blob/master/README.md) for examples
|
||||
|
||||
## Bug Reporting
|
||||
|
||||
Please report bugs either as pull requests or as issues in the issue tracker. `@peculiar/webcrypto` has a full disclosure vulnerability policy. Please do NOT attempt to report any security vulnerability in this code privately to anybody.
|
||||
|
||||
## Related
|
||||
|
||||
* [node-webcrypto-ossl](https://github.com/PeculiarVentures/node-webcrypto-ossl)
|
||||
* [node-webcrypto-p11](https://github.com/PeculiarVentures/node-webcrypto-p11)
|
||||
* [webcrypto-liner](https://github.com/PeculiarVentures/webcrypto-liner)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export declare class Crypto implements globalThis.Crypto {
|
||||
public subtle: SubtleCrypto;
|
||||
public getRandomValues<T extends ArrayBufferView | null>(array: T): T;
|
||||
randomUUID(): `${string}-${string}-${string}-${string}-${string}`;
|
||||
}
|
||||
|
||||
export declare class CryptoKey implements globalThis.CryptoKey {
|
||||
public algorithm: KeyAlgorithm;
|
||||
public extractable: boolean;
|
||||
public type: KeyType;
|
||||
public usages: KeyUsage[];
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"name": "@peculiar/webcrypto",
|
||||
"version": "1.7.1",
|
||||
"description": "A WebCrypto Polyfill for NodeJS",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PeculiarVentures/webcrypto"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./build/webcrypto.es.js",
|
||||
"require": "./build/webcrypto.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"build/**/*.{ts,js}",
|
||||
"index.d.ts",
|
||||
"README.md",
|
||||
"LICENSE.md"
|
||||
],
|
||||
"main": "build/webcrypto.js",
|
||||
"module": "build/webcrypto.es.js",
|
||||
"react-native": "build/webcrypto.es.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"coverage": "vitest --coverage",
|
||||
"build": "rollup -c",
|
||||
"clear": "rimraf build/*",
|
||||
"rebuild": "npm run clear && npm run build",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "eslint",
|
||||
"lint:fix": "eslint --fix"
|
||||
},
|
||||
"keywords": [
|
||||
"webcrypto",
|
||||
"crypto",
|
||||
"sha",
|
||||
"rsa",
|
||||
"ec",
|
||||
"aes",
|
||||
"des",
|
||||
"hmac",
|
||||
"pbkdf2",
|
||||
"eddsa",
|
||||
"x25519",
|
||||
"ed25519",
|
||||
"x448",
|
||||
"ed448",
|
||||
"shake128",
|
||||
"shake256"
|
||||
],
|
||||
"author": "PeculiarVentures",
|
||||
"contributors": [
|
||||
"Miroshin Stepan<microshine@mail.ru>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/PeculiarVentures/webcrypto/issues"
|
||||
},
|
||||
"homepage": "https://github.com/PeculiarVentures/webcrypto#readme",
|
||||
"devDependencies": {
|
||||
"@peculiar/eslint-config-base": "^0.2.9",
|
||||
"@peculiar/webcrypto-test": "^2.0.0",
|
||||
"@rollup/plugin-typescript": "^12.3.0",
|
||||
"@types/node": "^25.6.0",
|
||||
"@vitest/coverage-v8": "^4.1.5",
|
||||
"rimraf": "^6.1.3",
|
||||
"rollup": "^4.60.2",
|
||||
"typescript": "^6.0.3",
|
||||
"vitest": "^4.1.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.7.0",
|
||||
"@peculiar/json-schema": "^1.1.12",
|
||||
"@peculiar/utils": "^2.0.2",
|
||||
"tslib": "^2.8.1",
|
||||
"webcrypto-core": "^1.9.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.18.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user