knowitwhenyouseeit 2.42.1 → 2.42.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/index.d.ts +14 -16
- package/index.d.ts.map +1 -0
- package/index.js +13 -23
- package/index.js.map +1 -0
- package/package.json +9 -9
- package/npm_pkg_deps.json +0 -12
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
> provides functions to render client-side data but only if it matches a secure digest
|
|
4
4
|
|
|
5
|
+
[View `knowitwhenyouseeit` on npm](https://www.npmjs.com/package/knowitwhenyouseeit)
|
|
6
|
+
|
|
5
7
|
[](https://www.npmjs.com/package/knowitwhenyouseeit)
|
|
6
8
|
|
|
7
9
|
## Install
|
package/index.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Allowlist takes a set of bcrypt digests, and returns a function which, when passed an input returns that
|
|
3
|
-
* same input provided it matches one of the bcrypt digests. Otherwise, it returns `false`.
|
|
4
|
-
*
|
|
5
|
-
* This can be used to store some secret in the client without making it implicitly available to anyone who views the source.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* // if our website is https://cool.com, this alerts 'hello world' if loaded as https://cool.com#hello%20world
|
|
9
|
-
* const getMessage = allowlist('$2y$12$hxyWxMx.qap70Snn1QKMwuDp/9XgNM7HpwbrGnsPu/j7dyTEWh0M2');
|
|
10
|
-
* alert(getMessage(decodeURIComponent(window.hash.slice(1))))
|
|
11
|
-
*/
|
|
12
|
-
declare const allowlist: (...bcrypt_digests: string[]) => <S extends string>(input: S) =>
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export { }
|
|
1
|
+
/**
|
|
2
|
+
* Allowlist takes a set of bcrypt digests, and returns a function which, when passed an input returns that
|
|
3
|
+
* same input provided it matches one of the bcrypt digests. Otherwise, it returns `false`.
|
|
4
|
+
*
|
|
5
|
+
* This can be used to store some secret in the client without making it implicitly available to anyone who views the source.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // if our website is https://cool.com, this alerts 'hello world' if loaded as https://cool.com#hello%20world
|
|
9
|
+
* const getMessage = allowlist('$2y$12$hxyWxMx.qap70Snn1QKMwuDp/9XgNM7HpwbrGnsPu/j7dyTEWh0M2');
|
|
10
|
+
* alert(getMessage(decodeURIComponent(window.hash.slice(1))))
|
|
11
|
+
*/
|
|
12
|
+
export declare const allowlist: (...bcrypt_digests: string[]) => <S extends string>(input: S) => S | false;
|
|
13
|
+
export default allowlist;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,sBACD,MAAM,EAAE,MAC3B,CAAC,SAAS,MAAM,SAAS,CAAC,KAAG,CAAC,GAAG,KAE5B,CAAC;eAEO,SAAS"}
|
package/index.js
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
const _bcryptjs = /*#__PURE__*/ _interopRequireDefault(require("bcryptjs"));
|
|
16
|
-
function _interopRequireDefault(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const allowlist = (...bcrypt_digests)=>(input)=>bcrypt_digests.some((digest)=>_bcryptjs.default.compareSync(input, digest)) && input;
|
|
22
|
-
const _default = allowlist;
|
|
23
|
-
|
|
1
|
+
import bcrypt from 'bcryptjs';
|
|
2
|
+
/**
|
|
3
|
+
* Allowlist takes a set of bcrypt digests, and returns a function which, when passed an input returns that
|
|
4
|
+
* same input provided it matches one of the bcrypt digests. Otherwise, it returns `false`.
|
|
5
|
+
*
|
|
6
|
+
* This can be used to store some secret in the client without making it implicitly available to anyone who views the source.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // if our website is https://cool.com, this alerts 'hello world' if loaded as https://cool.com#hello%20world
|
|
10
|
+
* const getMessage = allowlist('$2y$12$hxyWxMx.qap70Snn1QKMwuDp/9XgNM7HpwbrGnsPu/j7dyTEWh0M2');
|
|
11
|
+
* alert(getMessage(decodeURIComponent(window.hash.slice(1))))
|
|
12
|
+
*/ export const allowlist = (...bcrypt_digests)=>(input)=>bcrypt_digests.some((digest)=>bcrypt.compareSync(input, digest)) && input;
|
|
13
|
+
export default allowlist;
|
|
24
14
|
|
|
25
15
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["import bcrypt from 'bcryptjs';\n\n/**\n * Allowlist takes a set of bcrypt digests, and returns a function which, when passed an input returns that\n * same input provided it matches one of the bcrypt digests. Otherwise, it returns `false`.\n *\n * This can be used to store some secret in the client without making it implicitly available to anyone who views the source.\n *\n * @example\n * // if our website is https://cool.com, this alerts 'hello world' if loaded as https://cool.com#hello%20world\n * const getMessage = allowlist('$2y$12$hxyWxMx.qap70Snn1QKMwuDp/9XgNM7HpwbrGnsPu/j7dyTEWh0M2');\n * alert(getMessage(decodeURIComponent(window.hash.slice(1))))\n */\nexport const allowlist =\n\t(...bcrypt_digests: string[]) =>\n\t<S extends string>(input: S): S | false =>\n\t\tbcrypt_digests.some(digest => bcrypt.compareSync(input, digest)) &&\n\t\tinput;\n\nexport default allowlist;\n"],"names":["bcrypt","allowlist","bcrypt_digests","input","some","digest","compareSync"],"mappings":"AAAA,OAAOA,YAAY,WAAW;AAE9B;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,YACZ,CAAC,GAAGC,iBACJ,CAAmBC,QAClBD,eAAeE,IAAI,CAACC,CAAAA,SAAUL,OAAOM,WAAW,CAACH,OAAOE,YACxDF,MAAM;AAER,eAAeF,UAAU"}
|
package/package.json
CHANGED
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
"node": ">=8",
|
|
9
9
|
"npm": ">=5"
|
|
10
10
|
},
|
|
11
|
-
"version": "
|
|
11
|
+
"version": "2.42.2",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"bcryptjs": "
|
|
14
|
-
"react": "
|
|
15
|
-
"react-dom": "
|
|
16
|
-
"regenerator-runtime": "0.
|
|
13
|
+
"bcryptjs": "3.0.3",
|
|
14
|
+
"react": "19.2.8",
|
|
15
|
+
"react-dom": "19.2.8",
|
|
16
|
+
"regenerator-runtime": "0.14.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/bcryptjs": "
|
|
20
|
-
"@types/node": "
|
|
19
|
+
"@types/bcryptjs": "3.0.0",
|
|
20
|
+
"@types/node": "24.13.3"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "git+https://github.com/zemn-me/monorepo.git",
|
|
25
25
|
"directory": "ts/knowitwhenyouseeit"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/zemn-me/monorepo/issues/new?title=%2F%2Fts%2Fknowitwhenyouseeit%402.42.2%3A+something+went+wrong%21"
|
|
29
29
|
}
|
|
30
30
|
}
|