full site update
This commit is contained in:
21
node_modules/uncrypto/LICENSE
generated
vendored
Normal file
21
node_modules/uncrypto/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
||||
|
||||
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.
|
64
node_modules/uncrypto/README.md
generated
vendored
Normal file
64
node_modules/uncrypto/README.md
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# uncrypto
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![Github Actions][github-actions-src]][github-actions-href]
|
||||
[![Codecov][codecov-src]][codecov-href]
|
||||
|
||||
This library provides a single api to use [web-crypto](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) and [Subtle Crypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) in both Node.js using [Crypto Module](https://nodejs.org/api/crypto.html#crypto) and Web targets using [Web Crypto API](https://nodejs.org/api/crypto.html#crypto) using [Conditional Exports](https://nodejs.org/api/packages.html#conditional-exports).
|
||||
|
||||
**Requirements:**
|
||||
|
||||
- **Node.js**: Version **15 and above** (this library provides no polyfills for older versions!)
|
||||
- **Browser**: [Secure Context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) (HTTPS/Localhost) in [Supported Browsers](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto#browser_compatibility)
|
||||
- **Other Runtimes:** Exposed `globalThis.crypto` and `globalThis.crypto.subtle`. (you can polyfill if neeeded)
|
||||
|
||||
## Usage
|
||||
|
||||
Install package:
|
||||
|
||||
```sh
|
||||
# npm
|
||||
npm install uncrypto
|
||||
|
||||
# yarn
|
||||
yarn add uncrypto
|
||||
|
||||
# pnpm
|
||||
pnpm install uncrypto
|
||||
```
|
||||
|
||||
Import:
|
||||
|
||||
```js
|
||||
// ESM
|
||||
import { subtle, randomUUID, getRandomValues } from "uncrypto";
|
||||
|
||||
// CommonJS
|
||||
const { subtle, randomUUID, getRandomValues } = require("uncrypto");
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
- Clone this repository
|
||||
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
|
||||
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
||||
- Install dependencies using `pnpm install`
|
||||
- Run interactive tests using `pnpm dev`
|
||||
|
||||
## License
|
||||
|
||||
Made with 💛
|
||||
|
||||
Published under [MIT License](./LICENSE).
|
||||
|
||||
<!-- Badges -->
|
||||
|
||||
[npm-version-src]: https://img.shields.io/npm/v/uncrypto?style=flat-square
|
||||
[npm-version-href]: https://npmjs.com/package/uncrypto
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/uncrypto?style=flat-square
|
||||
[npm-downloads-href]: https://npmjs.com/package/uncrypto
|
||||
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/uncrypto/ci/main?style=flat-square
|
||||
[github-actions-href]: https://github.com/unjs/uncrypto/actions?query=workflow%3Aci
|
||||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/uncrypto/main?style=flat-square
|
||||
[codecov-href]: https://codecov.io/gh/unjs/uncrypto
|
27
node_modules/uncrypto/dist/crypto.node.cjs
generated
vendored
Normal file
27
node_modules/uncrypto/dist/crypto.node.cjs
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
const nodeCrypto = require('node:crypto');
|
||||
|
||||
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
||||
|
||||
const nodeCrypto__default = /*#__PURE__*/_interopDefaultCompat(nodeCrypto);
|
||||
|
||||
const subtle = nodeCrypto__default.webcrypto?.subtle || {};
|
||||
const randomUUID = () => {
|
||||
return nodeCrypto__default.randomUUID();
|
||||
};
|
||||
const getRandomValues = (array) => {
|
||||
return nodeCrypto__default.webcrypto.getRandomValues(array);
|
||||
};
|
||||
const _crypto = {
|
||||
randomUUID,
|
||||
getRandomValues,
|
||||
subtle
|
||||
};
|
||||
|
||||
exports.default = _crypto;
|
||||
exports.getRandomValues = getRandomValues;
|
||||
exports.randomUUID = randomUUID;
|
||||
exports.subtle = subtle;
|
6
node_modules/uncrypto/dist/crypto.node.d.ts
generated
vendored
Normal file
6
node_modules/uncrypto/dist/crypto.node.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
declare const subtle: Crypto["subtle"];
|
||||
declare const randomUUID: Crypto["randomUUID"];
|
||||
declare const getRandomValues: Crypto["getRandomValues"];
|
||||
declare const _crypto: Crypto;
|
||||
|
||||
export { _crypto as default, getRandomValues, randomUUID, subtle };
|
16
node_modules/uncrypto/dist/crypto.node.mjs
generated
vendored
Normal file
16
node_modules/uncrypto/dist/crypto.node.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import nodeCrypto from 'node:crypto';
|
||||
|
||||
const subtle = nodeCrypto.webcrypto?.subtle || {};
|
||||
const randomUUID = () => {
|
||||
return nodeCrypto.randomUUID();
|
||||
};
|
||||
const getRandomValues = (array) => {
|
||||
return nodeCrypto.webcrypto.getRandomValues(array);
|
||||
};
|
||||
const _crypto = {
|
||||
randomUUID,
|
||||
getRandomValues,
|
||||
subtle
|
||||
};
|
||||
|
||||
export { _crypto as default, getRandomValues, randomUUID, subtle };
|
22
node_modules/uncrypto/dist/crypto.web.cjs
generated
vendored
Normal file
22
node_modules/uncrypto/dist/crypto.web.cjs
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
const webCrypto = globalThis.crypto;
|
||||
const subtle = webCrypto.subtle;
|
||||
const randomUUID = () => {
|
||||
return webCrypto.randomUUID();
|
||||
};
|
||||
const getRandomValues = (array) => {
|
||||
return webCrypto.getRandomValues(array);
|
||||
};
|
||||
const _crypto = {
|
||||
randomUUID,
|
||||
getRandomValues,
|
||||
subtle
|
||||
};
|
||||
|
||||
exports.default = _crypto;
|
||||
exports.getRandomValues = getRandomValues;
|
||||
exports.randomUUID = randomUUID;
|
||||
exports.subtle = subtle;
|
6
node_modules/uncrypto/dist/crypto.web.d.ts
generated
vendored
Normal file
6
node_modules/uncrypto/dist/crypto.web.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
declare const subtle: Crypto["subtle"];
|
||||
declare const randomUUID: Crypto["randomUUID"];
|
||||
declare const getRandomValues: Crypto["getRandomValues"];
|
||||
declare const _crypto: Crypto;
|
||||
|
||||
export { _crypto as default, getRandomValues, randomUUID, subtle };
|
15
node_modules/uncrypto/dist/crypto.web.mjs
generated
vendored
Normal file
15
node_modules/uncrypto/dist/crypto.web.mjs
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
const webCrypto = globalThis.crypto;
|
||||
const subtle = webCrypto.subtle;
|
||||
const randomUUID = () => {
|
||||
return webCrypto.randomUUID();
|
||||
};
|
||||
const getRandomValues = (array) => {
|
||||
return webCrypto.getRandomValues(array);
|
||||
};
|
||||
const _crypto = {
|
||||
randomUUID,
|
||||
getRandomValues,
|
||||
subtle
|
||||
};
|
||||
|
||||
export { _crypto as default, getRandomValues, randomUUID, subtle };
|
60
node_modules/uncrypto/package.json
generated
vendored
Normal file
60
node_modules/uncrypto/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "uncrypto",
|
||||
"version": "0.1.3",
|
||||
"description": "Single API for Web Crypto API and Crypto Subtle working in Node.js, Browsers and other runtimes",
|
||||
"repository": "unjs/uncrypto",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"browser": "./dist/crypto.web.mjs",
|
||||
"bun": "./dist/crypto.web.mjs",
|
||||
"deno": "./dist/crypto.web.mjs",
|
||||
"edge-light": "./dist/crypto.web.mjs",
|
||||
"edge-routine": "./dist/crypto.web.mjs",
|
||||
"lagon": "./dist/crypto.web.mjs",
|
||||
"netlify": "./dist/crypto.web.mjs",
|
||||
"react-native": "./dist/crypto.web.mjs",
|
||||
"wintercg": "./dist/crypto.web.mjs",
|
||||
"worker": "./dist/crypto.web.mjs",
|
||||
"workerd": "./dist/crypto.web.mjs",
|
||||
"node": {
|
||||
"require": "./dist/crypto.node.cjs",
|
||||
"import": "./dist/crypto.node.mjs",
|
||||
"types": "./dist/crypto.node.d.ts"
|
||||
},
|
||||
"require": "./dist/crypto.web.cjs",
|
||||
"import": "./dist/crypto.web.mjs",
|
||||
"types": "./dist/crypto.web.d.ts"
|
||||
}
|
||||
},
|
||||
"main": "./dist/crypto.node.cjs",
|
||||
"module": "./dist/crypto.web.mjs",
|
||||
"browser": "./dist/crypto.web.mjs",
|
||||
"types": "./dist/crypto.web.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "vitest dev",
|
||||
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
|
||||
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w",
|
||||
"prepack": "pnpm run build",
|
||||
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
||||
"test": "pnpm lint && vitest run --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.2.5",
|
||||
"@vitest/coverage-v8": "^0.32.0",
|
||||
"changelogen": "^0.5.3",
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-unjs": "^0.2.1",
|
||||
"prettier": "^2.8.8",
|
||||
"typescript": "^5.1.3",
|
||||
"unbuild": "^1.2.1",
|
||||
"vitest": "^0.32.0"
|
||||
},
|
||||
"packageManager": "pnpm@8.6.1"
|
||||
}
|
Reference in New Issue
Block a user