securequ 1.0.8 → 1.0.9
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/client/index.js +213 -2
- package/client/index.js.map +1 -7
- package/client/index.mjs +213 -0
- package/client/index.mjs.map +1 -0
- package/include/lib/base64.js +47 -2
- package/include/lib/base64.js.map +1 -7
- package/include/lib/base64.mjs +47 -0
- package/include/lib/base64.mjs.map +1 -0
- package/include/lib/cache.js +74 -2
- package/include/lib/cache.js.map +1 -7
- package/include/lib/cache.mjs +74 -0
- package/include/lib/cache.mjs.map +1 -0
- package/include/lib/crypto.js +69 -2
- package/include/lib/crypto.js.map +1 -7
- package/include/lib/crypto.mjs +69 -0
- package/include/lib/crypto.mjs.map +1 -0
- package/include/lib/pako.js +28 -2
- package/include/lib/pako.js.map +1 -7
- package/include/lib/pako.mjs +28 -0
- package/include/lib/pako.mjs.map +1 -0
- package/include/lib/reverser.js +25 -2
- package/include/lib/reverser.js.map +1 -7
- package/include/lib/reverser.mjs +25 -0
- package/include/lib/reverser.mjs.map +1 -0
- package/include/lib/urlpath.js +10 -2
- package/include/lib/urlpath.js.map +1 -7
- package/include/lib/urlpath.mjs +10 -0
- package/include/lib/urlpath.mjs.map +1 -0
- package/include/responseValue.js +10 -2
- package/include/responseValue.js.map +1 -7
- package/include/responseValue.mjs +10 -0
- package/include/responseValue.mjs.map +1 -0
- package/include/signeture.js +20 -2
- package/include/signeture.js.map +1 -7
- package/include/signeture.mjs +20 -0
- package/include/signeture.mjs.map +1 -0
- package/index.d.ts +81 -3
- package/index.js +1 -2
- package/index.js.map +1 -7
- package/index.mjs +1 -0
- package/index.mjs.map +1 -0
- package/package.json +11 -27
- package/server/index.js +187 -2
- package/server/index.js.map +1 -7
- package/server/index.mjs +187 -0
- package/server/index.mjs.map +1 -0
- package/cjs/client/index.js +0 -2
- package/cjs/client/index.js.map +0 -7
- package/cjs/client/types.js +0 -2
- package/cjs/client/types.js.map +0 -7
- package/cjs/include/lib/base64.js +0 -2
- package/cjs/include/lib/base64.js.map +0 -7
- package/cjs/include/lib/cache.js +0 -2
- package/cjs/include/lib/cache.js.map +0 -7
- package/cjs/include/lib/crypto.js +0 -2
- package/cjs/include/lib/crypto.js.map +0 -7
- package/cjs/include/lib/pako.js +0 -2
- package/cjs/include/lib/pako.js.map +0 -7
- package/cjs/include/lib/reverser.js +0 -2
- package/cjs/include/lib/reverser.js.map +0 -7
- package/cjs/include/lib/urlpath.js +0 -2
- package/cjs/include/lib/urlpath.js.map +0 -7
- package/cjs/include/responseValue.js +0 -2
- package/cjs/include/responseValue.js.map +0 -7
- package/cjs/include/signeture.js +0 -2
- package/cjs/include/signeture.js.map +0 -7
- package/cjs/index.js +0 -2
- package/cjs/index.js.map +0 -7
- package/cjs/server/index.js +0 -2
- package/cjs/server/index.js.map +0 -7
- package/cjs/server/types.js +0 -2
- package/cjs/server/types.js.map +0 -7
- package/client/index.d.ts +0 -23
- package/client/types.d.ts +0 -20
- package/client/types.js +0 -1
- package/client/types.js.map +0 -7
- package/include/lib/base64.d.ts +0 -17
- package/include/lib/cache.d.ts +0 -36
- package/include/lib/crypto.d.ts +0 -22
- package/include/lib/pako.d.ts +0 -17
- package/include/lib/reverser.d.ts +0 -5
- package/include/lib/urlpath.d.ts +0 -7
- package/include/responseValue.d.ts +0 -5
- package/include/signeture.d.ts +0 -6
- package/server/index.d.ts +0 -16
- package/server/types.d.ts +0 -37
- package/server/types.js +0 -1
- package/server/types.js.map +0 -7
package/include/lib/crypto.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encrypts data using TweetNaCl, compresses it with Pako (Gzip), and encodes it in Base64.
|
|
3
|
-
* @param data - The plaintext data to encrypt.
|
|
4
|
-
* @param secret - The secret key as a string.
|
|
5
|
-
* @returns A Base64 encoded string (nonce + compressed ciphertext).
|
|
6
|
-
*/
|
|
7
|
-
declare function encrypt(data: string | object, secret: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Decrypts a Base64-encoded NaCl-encrypted data, decompresses it with Pako (Gzip).
|
|
10
|
-
* @param data - The Base64 encoded string (nonce + compressed ciphertext).
|
|
11
|
-
* @param secret - The secret key as a string.
|
|
12
|
-
* @returns The decrypted plaintext string.
|
|
13
|
-
*/
|
|
14
|
-
declare function decrypt(data: string, secret: string): string;
|
|
15
|
-
declare function hash(data: string): string;
|
|
16
|
-
declare const crypto: {
|
|
17
|
-
encrypt: typeof encrypt;
|
|
18
|
-
decrypt: typeof decrypt;
|
|
19
|
-
hash: typeof hash;
|
|
20
|
-
makeSecret: (secret: string) => string;
|
|
21
|
-
};
|
|
22
|
-
export default crypto;
|
package/include/lib/pako.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compresses a string message using Pako (Gzip).
|
|
3
|
-
* @param message - The plaintext string message to compress.
|
|
4
|
-
* @returns A Base64 encoded string of the compressed data.
|
|
5
|
-
*/
|
|
6
|
-
export declare function compress(data: string, returnUnit8?: boolean): string | Uint8Array;
|
|
7
|
-
/**
|
|
8
|
-
* Decompresses a Base64 encoded compressed message using Pako (Gzip).
|
|
9
|
-
* @param data - The Base64 encoded compressed data.
|
|
10
|
-
* @returns The decompressed plaintext string.
|
|
11
|
-
*/
|
|
12
|
-
export declare function decompress(data: string | Uint8Array): string;
|
|
13
|
-
declare const _default: {
|
|
14
|
-
compress: typeof compress;
|
|
15
|
-
decompress: typeof decompress;
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
package/include/lib/urlpath.d.ts
DELETED
package/include/signeture.d.ts
DELETED
package/server/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { HandlerFunction, HandlerInfo, HTTPMethods, ListenerInfo, ServerResponse, SecurequServerConfig } from "./types";
|
|
2
|
-
declare class SecurequServer {
|
|
3
|
-
private HandlerCache;
|
|
4
|
-
private routes;
|
|
5
|
-
private config;
|
|
6
|
-
private secret;
|
|
7
|
-
constructor(config: SecurequServerConfig);
|
|
8
|
-
addRoute(path: string, method: HTTPMethods, handler: HandlerFunction): Promise<void>;
|
|
9
|
-
get(path: string, handler: HandlerFunction): Promise<void>;
|
|
10
|
-
post(path: string, handler: HandlerFunction): Promise<void>;
|
|
11
|
-
put(path: string, handler: HandlerFunction): Promise<void>;
|
|
12
|
-
delete(path: string, handler: HandlerFunction): Promise<void>;
|
|
13
|
-
handleRequest(info: HandlerInfo, args?: any): Promise<void>;
|
|
14
|
-
listen(listenerInfo: ListenerInfo, args?: any): Promise<ServerResponse>;
|
|
15
|
-
}
|
|
16
|
-
export default SecurequServer;
|
package/server/types.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { MatchFunction } from "path-to-regexp";
|
|
2
|
-
export type SecurequServerConfig = {
|
|
3
|
-
basepath: string;
|
|
4
|
-
cache?: boolean | {
|
|
5
|
-
get: (key: string) => any;
|
|
6
|
-
set: (key: string, response: Response) => void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export type HTTPMethods = "GET" | "POST" | "PUT" | "DELETE";
|
|
10
|
-
export type ListenerInfo = {
|
|
11
|
-
signeture: string;
|
|
12
|
-
path: string;
|
|
13
|
-
body: any;
|
|
14
|
-
method: HTTPMethods;
|
|
15
|
-
};
|
|
16
|
-
export type HandlerInfo = {
|
|
17
|
-
path: string;
|
|
18
|
-
body: object;
|
|
19
|
-
searchParams: Object;
|
|
20
|
-
params: Object;
|
|
21
|
-
method: HTTPMethods;
|
|
22
|
-
};
|
|
23
|
-
export type ServerResponse = {
|
|
24
|
-
value: string;
|
|
25
|
-
status: number;
|
|
26
|
-
};
|
|
27
|
-
export type HandlerFunction = (info: HandlerInfo, args?: any) => (any | void) | Promise<Partial<any> | void>;
|
|
28
|
-
export type RouteFactory = {
|
|
29
|
-
[key in HTTPMethods]: {
|
|
30
|
-
[path: string]: {
|
|
31
|
-
handler: HandlerFunction;
|
|
32
|
-
test: MatchFunction<{
|
|
33
|
-
[key: string]: string;
|
|
34
|
-
}>;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
package/server/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|