added doga
This commit is contained in:
21
25_02_24/node_modules/@tinyhttp/cookie-signature/LICENSE
generated
vendored
Normal file
21
25_02_24/node_modules/@tinyhttp/cookie-signature/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 v 1 r t l
|
||||
|
||||
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.
|
||||
25
25_02_24/node_modules/@tinyhttp/cookie-signature/README.md
generated
vendored
Normal file
25
25_02_24/node_modules/@tinyhttp/cookie-signature/README.md
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# @tinyhttp/cookie-signature
|
||||
|
||||
[](https://npmjs.com/package/@tinyhttp/cookie-signature) [](https://npmjs.com/package/@tinyhttp/cookie-signature)
|
||||
|
||||
HTTP cookie signing and unsigning. A rewrite of [cookie-signature](https://github.com/tj/node-cookie-signature) module.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
pnpm i @tinyhttp/cookie-signature
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
import { sign, unsign } from '@tinyhttp/cookie-signature'
|
||||
```
|
||||
|
||||
### `sign(val, secret)`
|
||||
|
||||
Signd the given `val` with `secret`.
|
||||
|
||||
### `unsign(val, secret)`
|
||||
|
||||
Unsign and decode the given `val` with `secret`, returning `false` if the signature is invalid.
|
||||
10
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.d.ts
generated
vendored
Normal file
10
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Sign the given `val` with `secret`.
|
||||
*/
|
||||
export declare const sign: (val: string, secret: string) => string;
|
||||
/**
|
||||
* Unsign and decode the given `val` with `secret`,
|
||||
* returning `false` if the signature is invalid.
|
||||
*/
|
||||
export declare const unsign: (val: string, secret: string) => string | false;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.d.ts.map
generated
vendored
Normal file
1
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,IAAI,QAAS,MAAM,UAAU,MAAM,KAAG,MACuC,CAAA;AAE1F;;;GAGG;AACH,eAAO,MAAM,MAAM,QAAS,MAAM,UAAU,MAAM,KAAG,MAAM,GAAG,KAQ7D,CAAA"}
|
||||
15
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.js
generated
vendored
Normal file
15
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { createHmac, timingSafeEqual } from "node:crypto";
|
||||
const sign = (val, secret) => `${val}.${createHmac("sha256", secret).update(val).digest("base64").replace(/=+$/, "")}`;
|
||||
const unsign = (val, secret) => {
|
||||
const str = val.slice(0, val.lastIndexOf("."));
|
||||
const mac = sign(str, secret);
|
||||
const macBuffer = Buffer.from(mac);
|
||||
const valBuffer = Buffer.alloc(macBuffer.length);
|
||||
valBuffer.write(val);
|
||||
return timingSafeEqual(macBuffer, valBuffer) ? str : false;
|
||||
};
|
||||
export {
|
||||
sign,
|
||||
unsign
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.js.map
generated
vendored
Normal file
1
25_02_24/node_modules/@tinyhttp/cookie-signature/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { createHmac, timingSafeEqual } from 'node:crypto'\n\n/**\n * Sign the given `val` with `secret`.\n */\nexport const sign = (val: string, secret: string): string =>\n `${val}.${createHmac('sha256', secret).update(val).digest('base64').replace(/=+$/, '')}`\n\n/**\n * Unsign and decode the given `val` with `secret`,\n * returning `false` if the signature is invalid.\n */\nexport const unsign = (val: string, secret: string): string | false => {\n const str = val.slice(0, val.lastIndexOf('.'))\n const mac = sign(str, secret)\n const macBuffer = Buffer.from(mac)\n const valBuffer = Buffer.alloc(macBuffer.length)\n\n valBuffer.write(val)\n return timingSafeEqual(macBuffer, valBuffer) ? str : false\n}\n"],"names":[],"mappings":";AAKa,MAAA,OAAO,CAAC,KAAa,WAChC,GAAG,GAAG,IAAI,WAAW,UAAU,MAAM,EAAE,OAAO,GAAG,EAAE,OAAO,QAAQ,EAAE,QAAQ,OAAO,EAAE,CAAC;AAM3E,MAAA,SAAS,CAAC,KAAa,WAAmC;AACrE,QAAM,MAAM,IAAI,MAAM,GAAG,IAAI,YAAY,GAAG,CAAC;AACvC,QAAA,MAAM,KAAK,KAAK,MAAM;AACtB,QAAA,YAAY,OAAO,KAAK,GAAG;AACjC,QAAM,YAAY,OAAO,MAAM,UAAU,MAAM;AAE/C,YAAU,MAAM,GAAG;AACnB,SAAO,gBAAgB,WAAW,SAAS,IAAI,MAAM;AACvD;"}
|
||||
36
25_02_24/node_modules/@tinyhttp/cookie-signature/package.json
generated
vendored
Normal file
36
25_02_24/node_modules/@tinyhttp/cookie-signature/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@tinyhttp/cookie-signature",
|
||||
"version": "2.1.1",
|
||||
"description": "HTTP cookie signing and unsigning",
|
||||
"homepage": "https://tinyhttp.v1rtl.site",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tinyhttp/tinyhttp.git",
|
||||
"directory": "packages/cookie-signature"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
},
|
||||
"type": "module",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": "./dist/index.js",
|
||||
"keywords": [
|
||||
"tinyhttp",
|
||||
"node.js",
|
||||
"web framework",
|
||||
"web",
|
||||
"backend",
|
||||
"static",
|
||||
"cookie"
|
||||
],
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"author": "v1rtl",
|
||||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user