@rolder/kit 3.0.0-alpha-5 → 3.0.0-alpha-7
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.
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
private key;
|
|
3
|
-
constructor(secretHash: string);
|
|
1
|
+
type EncryptionInstance = {
|
|
4
2
|
encrypt(text: string): string;
|
|
5
3
|
decrypt(encryptedText: string): string;
|
|
6
|
-
}
|
|
7
|
-
export declare const encryptionFn: (secretHash: string) =>
|
|
4
|
+
};
|
|
5
|
+
export declare const encryptionFn: (secretHash: string) => EncryptionInstance;
|
|
8
6
|
export {};
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
2
2
|
import { createServerOnlyFn } from "@tanstack/react-start";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const encryptionFn = createServerOnlyFn((secretHash)=>{
|
|
4
|
+
class Encryption {
|
|
5
|
+
key;
|
|
6
|
+
constructor(secretHash){
|
|
7
|
+
this.key = Buffer.from(secretHash, 'hex');
|
|
8
|
+
}
|
|
9
|
+
encrypt(text) {
|
|
10
|
+
const algorithm = 'aes-256-cbc';
|
|
11
|
+
const iv = randomBytes(16);
|
|
12
|
+
const cipher = createCipheriv(algorithm, this.key, iv);
|
|
13
|
+
let encrypted = cipher.update(text, 'utf8', 'hex');
|
|
14
|
+
encrypted += cipher.final('hex');
|
|
15
|
+
return `${iv.toString('hex')}:${encrypted}`;
|
|
16
|
+
}
|
|
17
|
+
decrypt(encryptedText) {
|
|
18
|
+
const algorithm = 'aes-256-cbc';
|
|
19
|
+
const parts = encryptedText.split(':');
|
|
20
|
+
const iv = Buffer.from(parts[0], 'hex');
|
|
21
|
+
const encrypted = parts[1];
|
|
22
|
+
const decipher = createDecipheriv(algorithm, this.key, iv);
|
|
23
|
+
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
|
|
24
|
+
decrypted += decipher.final('utf8');
|
|
25
|
+
return decrypted;
|
|
26
|
+
}
|
|
7
27
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const iv = randomBytes(16);
|
|
11
|
-
const cipher = createCipheriv(algorithm, this.key, iv);
|
|
12
|
-
let encrypted = cipher.update(text, 'utf8', 'hex');
|
|
13
|
-
encrypted += cipher.final('hex');
|
|
14
|
-
return `${iv.toString('hex')}:${encrypted}`;
|
|
15
|
-
}
|
|
16
|
-
decrypt(encryptedText) {
|
|
17
|
-
const algorithm = 'aes-256-cbc';
|
|
18
|
-
const parts = encryptedText.split(':');
|
|
19
|
-
const iv = Buffer.from(parts[0], 'hex');
|
|
20
|
-
const encrypted = parts[1];
|
|
21
|
-
const decipher = createDecipheriv(algorithm, this.key, iv);
|
|
22
|
-
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
|
|
23
|
-
decrypted += decipher.final('utf8');
|
|
24
|
-
return decrypted;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
const encryptionFn = createServerOnlyFn((secretHash)=>new Encryption(secretHash));
|
|
28
|
+
return new Encryption(secretHash);
|
|
29
|
+
});
|
|
28
30
|
export { encryptionFn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Forbidden: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Stack, Title } from "@mantine/core";
|
|
3
|
+
import { RouterLink } from "../routerLink/index.js";
|
|
4
|
+
const Forbidden = ()=>/*#__PURE__*/ jsxs(Stack, {
|
|
5
|
+
align: "center",
|
|
6
|
+
justify: "center",
|
|
7
|
+
gap: 0,
|
|
8
|
+
ta: "center",
|
|
9
|
+
h: "100vh",
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ jsx(Title, {
|
|
12
|
+
textWrap: "balance",
|
|
13
|
+
size: 65,
|
|
14
|
+
children: "Доступ запрещен!"
|
|
15
|
+
}),
|
|
16
|
+
/*#__PURE__*/ jsx(Title, {
|
|
17
|
+
order: 3,
|
|
18
|
+
ml: 4,
|
|
19
|
+
textWrap: "balance",
|
|
20
|
+
c: "var(--mantine-color-error)",
|
|
21
|
+
children: "У вас нет доступа к этой странице"
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ jsx(RouterLink.Button, {
|
|
24
|
+
to: "/",
|
|
25
|
+
mt: "xl",
|
|
26
|
+
size: "lg",
|
|
27
|
+
radius: "md",
|
|
28
|
+
children: "На главную"
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
export { Forbidden };
|
package/dist/ui/error/index.d.ts
CHANGED
package/dist/ui/error/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolder/kit",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
"@biomejs/biome": "2.3.11",
|
|
22
22
|
"@rsbuild/plugin-react": "^1.4.2",
|
|
23
23
|
"@rslib/core": "^0.19.2",
|
|
24
|
+
"@types/bun": "^1.3.5",
|
|
25
|
+
"@types/js-cookie": "^3.0.6",
|
|
26
|
+
"@types/omgopass": "^3.2.3",
|
|
24
27
|
"@types/react": "^19.2.8",
|
|
25
28
|
"react": "^19.2.3",
|
|
26
|
-
"typescript": "^5.9.3"
|
|
27
|
-
"@types/bun": "^1.3.5",
|
|
28
|
-
"@types/js-cookie": "^3.0.6"
|
|
29
|
+
"typescript": "^5.9.3"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"react": ">=16.9.0",
|
|
@@ -51,10 +52,12 @@
|
|
|
51
52
|
"@tanstack/react-form": "1.27.7",
|
|
52
53
|
"@tanstack/react-start": "^1.149.1",
|
|
53
54
|
"@tanstack/react-query": "^5.90.16",
|
|
55
|
+
"@tanstack/react-router-ssr-query": "^1.147.3",
|
|
54
56
|
"zod": "^4.3.5",
|
|
55
57
|
"js-cookie": "^3.0.5",
|
|
56
58
|
"nanostores": "^1.1.0",
|
|
57
|
-
"surrealdb": "^2.0.0-alpha.16"
|
|
59
|
+
"surrealdb": "^2.0.0-alpha.16",
|
|
60
|
+
"omgopass": "^3.2.1"
|
|
58
61
|
},
|
|
59
62
|
"trustedDependencies": [
|
|
60
63
|
"core-js",
|