ayiin 2.0.4 → 2.0.6

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.
@@ -0,0 +1,85 @@
1
+ import Crypt from "./crypt";
2
+ import Tools from "./tools";
3
+ import ResponseApi from "./response";
4
+ declare class BaseMethods<C extends Crypt, T extends Tools, R extends ResponseApi> {
5
+ crypt: C;
6
+ tools: T;
7
+ response: R;
8
+ constructor();
9
+ /**
10
+ * Converts an ASCII string to its corresponding Hex representation.
11
+ * @param {string} asciiString - The ASCII string to be converted.
12
+ * @returns {string} - The Hex representation of the ASCII string.
13
+ */
14
+ asciiToHex: (asciiString: string) => string;
15
+ /**
16
+ * Converts a Hex string to its corresponding ASCII representation.
17
+ * @param {string} hexString - The Hex string to be converted.
18
+ * @returns {string} - The ASCII representation of the Hex string.
19
+ */
20
+ hexToAscii: (hexString: string) => string;
21
+ /**
22
+ * Encrypts a plaintext message using the given key.
23
+ * @param {string} text - The plaintext message to be encrypted.
24
+ * @param {string} key - The encryption key.
25
+ * @returns {string} - The encrypted data in Hex format.
26
+ */
27
+ encrypt: (text: string, key: string, bufferEncoding?: BufferEncoding) => string;
28
+ /**
29
+ * Decrypts an encrypted message using the given key.
30
+ * @param {string} encrypted - The encrypted data in Hex format.
31
+ * @param {string} key - The decryption key.
32
+ * @returns {string} - The decrypted plaintext message.
33
+ */
34
+ decrypt: (text: string, key: string, bufferEncoding?: BufferEncoding) => string;
35
+ md5: (data: string, encoding: BufferEncoding) => string;
36
+ /**
37
+ * Format money
38
+ * @memberof Tools
39
+ * @param {number} amount
40
+ * @param {"long" | "short"} [compactDisplay="long"]
41
+ * @returns string
42
+ * */
43
+ formatMoney: (value: number, locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions) => string;
44
+ /**
45
+ * Generate a random string
46
+ * @returns {string}
47
+ * @memberof Tools
48
+ * @param {number} length
49
+ * */
50
+ randomString: (length: number, prefix?: string) => string;
51
+ successResponse: (caption: string, data: any, code?: number) => {
52
+ responseCode: number;
53
+ responseSuccess: boolean;
54
+ responseMessage: string;
55
+ responseData: any;
56
+ };
57
+ badRequestResponse: (caption: string, title?: string) => {
58
+ responseCode: number;
59
+ responseSuccess: boolean;
60
+ responseMessage: string;
61
+ };
62
+ invalidFieldsResponse: (caption: string) => {
63
+ responseCode: number;
64
+ responseSuccess: boolean;
65
+ responseMessage: string;
66
+ };
67
+ notFoundResponse: (caption: string) => {
68
+ responseCode: number;
69
+ responseSuccess: boolean;
70
+ responseMessage: string;
71
+ };
72
+ unauthorizedResponse: (caption: string) => {
73
+ responseCode: number;
74
+ responseSuccess: boolean;
75
+ responseMessage: string;
76
+ };
77
+ internalServerErrorResponse: (caption: string) => {
78
+ responseCode: number;
79
+ responseSuccess: boolean;
80
+ responseMessage: string;
81
+ };
82
+ }
83
+ declare class Methods extends BaseMethods<Crypt, Tools, ResponseApi> {
84
+ }
85
+ export default Methods;