@utilix-tech/sdk 0.1.0

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.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +199 -0
  3. package/dist/api-8aZtWhSj.d.cts +308 -0
  4. package/dist/api-8aZtWhSj.d.ts +308 -0
  5. package/dist/chunk-2CJSLYWI.js +520 -0
  6. package/dist/chunk-3BAHSW4C.js +1385 -0
  7. package/dist/chunk-6YPV2AB5.js +1246 -0
  8. package/dist/chunk-BPVAB4P2.js +1126 -0
  9. package/dist/chunk-FL53T24A.js +257 -0
  10. package/dist/chunk-L6KCTHUW.js +1086 -0
  11. package/dist/chunk-MLKGABMK.js +7 -0
  12. package/dist/chunk-ROTPLW7T.js +265 -0
  13. package/dist/chunk-TSAGO3XP.js +1253 -0
  14. package/dist/chunk-UC656APA.js +1080 -0
  15. package/dist/chunk-W4UBLYFU.js +1219 -0
  16. package/dist/chunk-XST6X3HT.js +896 -0
  17. package/dist/chunk-XXYZLLHI.js +2227 -0
  18. package/dist/chunk-ZKL2VX2G.js +2215 -0
  19. package/dist/chunk-ZPQZEIXP.js +685 -0
  20. package/dist/code-QNrdLIR3.d.cts +327 -0
  21. package/dist/code-QNrdLIR3.d.ts +327 -0
  22. package/dist/color-tPwZCr9H.d.cts +229 -0
  23. package/dist/color-tPwZCr9H.d.ts +229 -0
  24. package/dist/css-Cf7AMGM-.d.cts +318 -0
  25. package/dist/css-Cf7AMGM-.d.ts +318 -0
  26. package/dist/data-rMjWNiOJ.d.cts +215 -0
  27. package/dist/data-rMjWNiOJ.d.ts +215 -0
  28. package/dist/encoding-7gmq-vkV.d.cts +108 -0
  29. package/dist/encoding-7gmq-vkV.d.ts +108 -0
  30. package/dist/generators-BGtRGpJZ.d.cts +118 -0
  31. package/dist/generators-BGtRGpJZ.d.ts +118 -0
  32. package/dist/hashing-CnetQFD_.d.cts +76 -0
  33. package/dist/hashing-CnetQFD_.d.ts +76 -0
  34. package/dist/index.cjs +15466 -0
  35. package/dist/index.d.cts +18 -0
  36. package/dist/index.d.ts +18 -0
  37. package/dist/index.js +20 -0
  38. package/dist/json-BjSoIS1h.d.cts +198 -0
  39. package/dist/json-BjSoIS1h.d.ts +198 -0
  40. package/dist/misc-DcVBManm.d.cts +201 -0
  41. package/dist/misc-DcVBManm.d.ts +201 -0
  42. package/dist/network-CNtmrDeN.d.cts +170 -0
  43. package/dist/network-CNtmrDeN.d.ts +170 -0
  44. package/dist/text-DqAjPtQ0.d.cts +319 -0
  45. package/dist/text-DqAjPtQ0.d.ts +319 -0
  46. package/dist/time-DbT8fjaF.d.cts +145 -0
  47. package/dist/time-DbT8fjaF.d.ts +145 -0
  48. package/dist/tools/api.cjs +1216 -0
  49. package/dist/tools/api.d.cts +1 -0
  50. package/dist/tools/api.d.ts +1 -0
  51. package/dist/tools/api.js +2 -0
  52. package/dist/tools/code.cjs +2212 -0
  53. package/dist/tools/code.d.cts +1 -0
  54. package/dist/tools/code.d.ts +1 -0
  55. package/dist/tools/code.js +2 -0
  56. package/dist/tools/color.cjs +1122 -0
  57. package/dist/tools/color.d.cts +1 -0
  58. package/dist/tools/color.d.ts +1 -0
  59. package/dist/tools/color.js +2 -0
  60. package/dist/tools/css.cjs +1242 -0
  61. package/dist/tools/css.d.cts +1 -0
  62. package/dist/tools/css.d.ts +1 -0
  63. package/dist/tools/css.js +2 -0
  64. package/dist/tools/data.cjs +1097 -0
  65. package/dist/tools/data.d.cts +1 -0
  66. package/dist/tools/data.d.ts +1 -0
  67. package/dist/tools/data.js +2 -0
  68. package/dist/tools/encoding.cjs +261 -0
  69. package/dist/tools/encoding.d.cts +1 -0
  70. package/dist/tools/encoding.d.ts +1 -0
  71. package/dist/tools/encoding.js +2 -0
  72. package/dist/tools/generators.cjs +521 -0
  73. package/dist/tools/generators.d.cts +1 -0
  74. package/dist/tools/generators.d.ts +1 -0
  75. package/dist/tools/generators.js +2 -0
  76. package/dist/tools/hashing.cjs +259 -0
  77. package/dist/tools/hashing.d.cts +1 -0
  78. package/dist/tools/hashing.d.ts +1 -0
  79. package/dist/tools/hashing.js +2 -0
  80. package/dist/tools/json.cjs +1270 -0
  81. package/dist/tools/json.d.cts +1 -0
  82. package/dist/tools/json.d.ts +1 -0
  83. package/dist/tools/json.js +2 -0
  84. package/dist/tools/misc.cjs +1082 -0
  85. package/dist/tools/misc.d.cts +1 -0
  86. package/dist/tools/misc.d.ts +1 -0
  87. package/dist/tools/misc.js +2 -0
  88. package/dist/tools/network.cjs +1381 -0
  89. package/dist/tools/network.d.cts +1 -0
  90. package/dist/tools/network.d.ts +1 -0
  91. package/dist/tools/network.js +2 -0
  92. package/dist/tools/text.cjs +2224 -0
  93. package/dist/tools/text.d.cts +1 -0
  94. package/dist/tools/text.d.ts +1 -0
  95. package/dist/tools/text.js +2 -0
  96. package/dist/tools/time.cjs +681 -0
  97. package/dist/tools/time.d.cts +1 -0
  98. package/dist/tools/time.d.ts +1 -0
  99. package/dist/tools/time.js +2 -0
  100. package/dist/tools/units.cjs +892 -0
  101. package/dist/tools/units.d.cts +1 -0
  102. package/dist/tools/units.d.ts +1 -0
  103. package/dist/tools/units.js +2 -0
  104. package/dist/units-6lwDYBvX.d.cts +302 -0
  105. package/dist/units-6lwDYBvX.d.ts +302 -0
  106. package/package.json +148 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @module generators
3
+ *
4
+ * Generator utilities for the @utilix/sdk Node.js SDK.
5
+ *
6
+ * Tools covered:
7
+ * - uuid-generator : generateV4, generateV7, generateUuid, generateBulk, isValidUuid, parseUuidVersion
8
+ * - ulid-generator : generateUlid, generateBulkUlids, parseUlid, isValidUlid
9
+ * - password-generator : generatePassword, generateBulkPasswords, checkStrength
10
+ * - random-data : generateSingle, generateData
11
+ * - qr-code : generateQrSvg, generateQrDataUrl
12
+ */
13
+ type UuidVersion = 'v4' | 'v7';
14
+ interface GeneratedUuid {
15
+ value: string;
16
+ version: UuidVersion;
17
+ timestamp: number;
18
+ }
19
+ declare function generateV4(): string;
20
+ declare function generateV7(): string;
21
+ declare function generateUuid(version: UuidVersion): GeneratedUuid;
22
+ declare function generateBulk(version: UuidVersion, count: number): GeneratedUuid[];
23
+ declare function isValidUuid(uuid: string): boolean;
24
+ declare function parseUuidVersion(uuid: string): string | null;
25
+ declare const ULID_REGEX: RegExp;
26
+ declare function generateUlid(): string;
27
+ declare function generateBulkUlids(count: number): string[];
28
+ declare function parseUlid(ulid: string): {
29
+ valid: boolean;
30
+ timestamp?: number;
31
+ date?: string;
32
+ error?: string;
33
+ };
34
+ declare function isValidUlid(ulid: string): boolean;
35
+ declare const SYMBOL_CHARS = "!@#$%^&*()_+-=[]{}|;:,.<>?";
36
+ declare const AMBIGUOUS_CHARS = "Il1O0";
37
+ interface PasswordOptions {
38
+ length: number;
39
+ uppercase: boolean;
40
+ lowercase: boolean;
41
+ numbers: boolean;
42
+ symbols: boolean;
43
+ excludeAmbiguous: boolean;
44
+ }
45
+ declare const DEFAULT_OPTIONS: PasswordOptions;
46
+ declare function generatePassword(options: PasswordOptions): string;
47
+ declare function generateBulkPasswords(options: PasswordOptions, count: number): string[];
48
+ declare function checkStrength(password: string): {
49
+ score: 0 | 1 | 2 | 3 | 4;
50
+ label: 'Very Weak' | 'Weak' | 'Fair' | 'Strong' | 'Very Strong';
51
+ color: string;
52
+ };
53
+ type DataType = 'name' | 'email' | 'uuid' | 'phone' | 'date' | 'number' | 'boolean' | 'color' | 'url' | 'ipv4' | 'sentence' | 'paragraph';
54
+ interface RandomConfig {
55
+ type: DataType;
56
+ count: number;
57
+ options?: {
58
+ min?: number;
59
+ max?: number;
60
+ dateFormat?: 'iso' | 'us' | 'eu';
61
+ };
62
+ }
63
+ declare const DATA_TYPES: {
64
+ value: DataType;
65
+ label: string;
66
+ example: string;
67
+ }[];
68
+ declare function generateSingle(type: DataType, options?: RandomConfig['options']): string;
69
+ declare function generateData(config: RandomConfig): string[];
70
+ type QrErrorLevel = 'L' | 'M' | 'Q' | 'H';
71
+ type QrOutputFormat = 'svg' | 'dataUrl';
72
+ interface QrOptions {
73
+ errorLevel?: QrErrorLevel;
74
+ size?: number;
75
+ margin?: number;
76
+ darkColor?: string;
77
+ lightColor?: string;
78
+ }
79
+ declare const DEFAULT_QR_OPTIONS: QrOptions;
80
+ declare function generateQrSvg(text: string, options?: QrOptions): Promise<string>;
81
+ declare function generateQrDataUrl(text: string, options?: QrOptions): Promise<string>;
82
+
83
+ declare const generators_AMBIGUOUS_CHARS: typeof AMBIGUOUS_CHARS;
84
+ declare const generators_DATA_TYPES: typeof DATA_TYPES;
85
+ declare const generators_DEFAULT_OPTIONS: typeof DEFAULT_OPTIONS;
86
+ declare const generators_DEFAULT_QR_OPTIONS: typeof DEFAULT_QR_OPTIONS;
87
+ type generators_DataType = DataType;
88
+ type generators_GeneratedUuid = GeneratedUuid;
89
+ type generators_PasswordOptions = PasswordOptions;
90
+ type generators_QrErrorLevel = QrErrorLevel;
91
+ type generators_QrOptions = QrOptions;
92
+ type generators_QrOutputFormat = QrOutputFormat;
93
+ type generators_RandomConfig = RandomConfig;
94
+ declare const generators_SYMBOL_CHARS: typeof SYMBOL_CHARS;
95
+ declare const generators_ULID_REGEX: typeof ULID_REGEX;
96
+ type generators_UuidVersion = UuidVersion;
97
+ declare const generators_checkStrength: typeof checkStrength;
98
+ declare const generators_generateBulk: typeof generateBulk;
99
+ declare const generators_generateBulkPasswords: typeof generateBulkPasswords;
100
+ declare const generators_generateBulkUlids: typeof generateBulkUlids;
101
+ declare const generators_generateData: typeof generateData;
102
+ declare const generators_generatePassword: typeof generatePassword;
103
+ declare const generators_generateQrDataUrl: typeof generateQrDataUrl;
104
+ declare const generators_generateQrSvg: typeof generateQrSvg;
105
+ declare const generators_generateSingle: typeof generateSingle;
106
+ declare const generators_generateUlid: typeof generateUlid;
107
+ declare const generators_generateUuid: typeof generateUuid;
108
+ declare const generators_generateV4: typeof generateV4;
109
+ declare const generators_generateV7: typeof generateV7;
110
+ declare const generators_isValidUlid: typeof isValidUlid;
111
+ declare const generators_isValidUuid: typeof isValidUuid;
112
+ declare const generators_parseUlid: typeof parseUlid;
113
+ declare const generators_parseUuidVersion: typeof parseUuidVersion;
114
+ declare namespace generators {
115
+ export { generators_AMBIGUOUS_CHARS as AMBIGUOUS_CHARS, generators_DATA_TYPES as DATA_TYPES, generators_DEFAULT_OPTIONS as DEFAULT_OPTIONS, generators_DEFAULT_QR_OPTIONS as DEFAULT_QR_OPTIONS, type generators_DataType as DataType, type generators_GeneratedUuid as GeneratedUuid, type generators_PasswordOptions as PasswordOptions, type generators_QrErrorLevel as QrErrorLevel, type generators_QrOptions as QrOptions, type generators_QrOutputFormat as QrOutputFormat, type generators_RandomConfig as RandomConfig, generators_SYMBOL_CHARS as SYMBOL_CHARS, generators_ULID_REGEX as ULID_REGEX, type generators_UuidVersion as UuidVersion, generators_checkStrength as checkStrength, generators_generateBulk as generateBulk, generators_generateBulkPasswords as generateBulkPasswords, generators_generateBulkUlids as generateBulkUlids, generators_generateData as generateData, generators_generatePassword as generatePassword, generators_generateQrDataUrl as generateQrDataUrl, generators_generateQrSvg as generateQrSvg, generators_generateSingle as generateSingle, generators_generateUlid as generateUlid, generators_generateUuid as generateUuid, generators_generateV4 as generateV4, generators_generateV7 as generateV7, generators_isValidUlid as isValidUlid, generators_isValidUuid as isValidUuid, generators_parseUlid as parseUlid, generators_parseUuidVersion as parseUuidVersion };
116
+ }
117
+
118
+ export { AMBIGUOUS_CHARS as A, DATA_TYPES as D, type GeneratedUuid as G, type PasswordOptions as P, type QrErrorLevel as Q, type RandomConfig as R, SYMBOL_CHARS as S, ULID_REGEX as U, DEFAULT_OPTIONS as a, DEFAULT_QR_OPTIONS as b, type DataType as c, type QrOptions as d, type QrOutputFormat as e, type UuidVersion as f, generators as g, checkStrength as h, generateBulk as i, generateBulkPasswords as j, generateBulkUlids as k, generateData as l, generatePassword as m, generateQrDataUrl as n, generateQrSvg as o, generateSingle as p, generateUlid as q, generateUuid as r, generateV4 as s, generateV7 as t, isValidUlid as u, isValidUuid as v, parseUlid as w, parseUuidVersion as x };
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @module generators
3
+ *
4
+ * Generator utilities for the @utilix/sdk Node.js SDK.
5
+ *
6
+ * Tools covered:
7
+ * - uuid-generator : generateV4, generateV7, generateUuid, generateBulk, isValidUuid, parseUuidVersion
8
+ * - ulid-generator : generateUlid, generateBulkUlids, parseUlid, isValidUlid
9
+ * - password-generator : generatePassword, generateBulkPasswords, checkStrength
10
+ * - random-data : generateSingle, generateData
11
+ * - qr-code : generateQrSvg, generateQrDataUrl
12
+ */
13
+ type UuidVersion = 'v4' | 'v7';
14
+ interface GeneratedUuid {
15
+ value: string;
16
+ version: UuidVersion;
17
+ timestamp: number;
18
+ }
19
+ declare function generateV4(): string;
20
+ declare function generateV7(): string;
21
+ declare function generateUuid(version: UuidVersion): GeneratedUuid;
22
+ declare function generateBulk(version: UuidVersion, count: number): GeneratedUuid[];
23
+ declare function isValidUuid(uuid: string): boolean;
24
+ declare function parseUuidVersion(uuid: string): string | null;
25
+ declare const ULID_REGEX: RegExp;
26
+ declare function generateUlid(): string;
27
+ declare function generateBulkUlids(count: number): string[];
28
+ declare function parseUlid(ulid: string): {
29
+ valid: boolean;
30
+ timestamp?: number;
31
+ date?: string;
32
+ error?: string;
33
+ };
34
+ declare function isValidUlid(ulid: string): boolean;
35
+ declare const SYMBOL_CHARS = "!@#$%^&*()_+-=[]{}|;:,.<>?";
36
+ declare const AMBIGUOUS_CHARS = "Il1O0";
37
+ interface PasswordOptions {
38
+ length: number;
39
+ uppercase: boolean;
40
+ lowercase: boolean;
41
+ numbers: boolean;
42
+ symbols: boolean;
43
+ excludeAmbiguous: boolean;
44
+ }
45
+ declare const DEFAULT_OPTIONS: PasswordOptions;
46
+ declare function generatePassword(options: PasswordOptions): string;
47
+ declare function generateBulkPasswords(options: PasswordOptions, count: number): string[];
48
+ declare function checkStrength(password: string): {
49
+ score: 0 | 1 | 2 | 3 | 4;
50
+ label: 'Very Weak' | 'Weak' | 'Fair' | 'Strong' | 'Very Strong';
51
+ color: string;
52
+ };
53
+ type DataType = 'name' | 'email' | 'uuid' | 'phone' | 'date' | 'number' | 'boolean' | 'color' | 'url' | 'ipv4' | 'sentence' | 'paragraph';
54
+ interface RandomConfig {
55
+ type: DataType;
56
+ count: number;
57
+ options?: {
58
+ min?: number;
59
+ max?: number;
60
+ dateFormat?: 'iso' | 'us' | 'eu';
61
+ };
62
+ }
63
+ declare const DATA_TYPES: {
64
+ value: DataType;
65
+ label: string;
66
+ example: string;
67
+ }[];
68
+ declare function generateSingle(type: DataType, options?: RandomConfig['options']): string;
69
+ declare function generateData(config: RandomConfig): string[];
70
+ type QrErrorLevel = 'L' | 'M' | 'Q' | 'H';
71
+ type QrOutputFormat = 'svg' | 'dataUrl';
72
+ interface QrOptions {
73
+ errorLevel?: QrErrorLevel;
74
+ size?: number;
75
+ margin?: number;
76
+ darkColor?: string;
77
+ lightColor?: string;
78
+ }
79
+ declare const DEFAULT_QR_OPTIONS: QrOptions;
80
+ declare function generateQrSvg(text: string, options?: QrOptions): Promise<string>;
81
+ declare function generateQrDataUrl(text: string, options?: QrOptions): Promise<string>;
82
+
83
+ declare const generators_AMBIGUOUS_CHARS: typeof AMBIGUOUS_CHARS;
84
+ declare const generators_DATA_TYPES: typeof DATA_TYPES;
85
+ declare const generators_DEFAULT_OPTIONS: typeof DEFAULT_OPTIONS;
86
+ declare const generators_DEFAULT_QR_OPTIONS: typeof DEFAULT_QR_OPTIONS;
87
+ type generators_DataType = DataType;
88
+ type generators_GeneratedUuid = GeneratedUuid;
89
+ type generators_PasswordOptions = PasswordOptions;
90
+ type generators_QrErrorLevel = QrErrorLevel;
91
+ type generators_QrOptions = QrOptions;
92
+ type generators_QrOutputFormat = QrOutputFormat;
93
+ type generators_RandomConfig = RandomConfig;
94
+ declare const generators_SYMBOL_CHARS: typeof SYMBOL_CHARS;
95
+ declare const generators_ULID_REGEX: typeof ULID_REGEX;
96
+ type generators_UuidVersion = UuidVersion;
97
+ declare const generators_checkStrength: typeof checkStrength;
98
+ declare const generators_generateBulk: typeof generateBulk;
99
+ declare const generators_generateBulkPasswords: typeof generateBulkPasswords;
100
+ declare const generators_generateBulkUlids: typeof generateBulkUlids;
101
+ declare const generators_generateData: typeof generateData;
102
+ declare const generators_generatePassword: typeof generatePassword;
103
+ declare const generators_generateQrDataUrl: typeof generateQrDataUrl;
104
+ declare const generators_generateQrSvg: typeof generateQrSvg;
105
+ declare const generators_generateSingle: typeof generateSingle;
106
+ declare const generators_generateUlid: typeof generateUlid;
107
+ declare const generators_generateUuid: typeof generateUuid;
108
+ declare const generators_generateV4: typeof generateV4;
109
+ declare const generators_generateV7: typeof generateV7;
110
+ declare const generators_isValidUlid: typeof isValidUlid;
111
+ declare const generators_isValidUuid: typeof isValidUuid;
112
+ declare const generators_parseUlid: typeof parseUlid;
113
+ declare const generators_parseUuidVersion: typeof parseUuidVersion;
114
+ declare namespace generators {
115
+ export { generators_AMBIGUOUS_CHARS as AMBIGUOUS_CHARS, generators_DATA_TYPES as DATA_TYPES, generators_DEFAULT_OPTIONS as DEFAULT_OPTIONS, generators_DEFAULT_QR_OPTIONS as DEFAULT_QR_OPTIONS, type generators_DataType as DataType, type generators_GeneratedUuid as GeneratedUuid, type generators_PasswordOptions as PasswordOptions, type generators_QrErrorLevel as QrErrorLevel, type generators_QrOptions as QrOptions, type generators_QrOutputFormat as QrOutputFormat, type generators_RandomConfig as RandomConfig, generators_SYMBOL_CHARS as SYMBOL_CHARS, generators_ULID_REGEX as ULID_REGEX, type generators_UuidVersion as UuidVersion, generators_checkStrength as checkStrength, generators_generateBulk as generateBulk, generators_generateBulkPasswords as generateBulkPasswords, generators_generateBulkUlids as generateBulkUlids, generators_generateData as generateData, generators_generatePassword as generatePassword, generators_generateQrDataUrl as generateQrDataUrl, generators_generateQrSvg as generateQrSvg, generators_generateSingle as generateSingle, generators_generateUlid as generateUlid, generators_generateUuid as generateUuid, generators_generateV4 as generateV4, generators_generateV7 as generateV7, generators_isValidUlid as isValidUlid, generators_isValidUuid as isValidUuid, generators_parseUlid as parseUlid, generators_parseUuidVersion as parseUuidVersion };
116
+ }
117
+
118
+ export { AMBIGUOUS_CHARS as A, DATA_TYPES as D, type GeneratedUuid as G, type PasswordOptions as P, type QrErrorLevel as Q, type RandomConfig as R, SYMBOL_CHARS as S, ULID_REGEX as U, DEFAULT_OPTIONS as a, DEFAULT_QR_OPTIONS as b, type DataType as c, type QrOptions as d, type QrOutputFormat as e, type UuidVersion as f, generators as g, checkStrength as h, generateBulk as i, generateBulkPasswords as j, generateBulkUlids as k, generateData as l, generatePassword as m, generateQrDataUrl as n, generateQrSvg as o, generateSingle as p, generateUlid as q, generateUuid as r, generateV4 as s, generateV7 as t, isValidUlid as u, isValidUuid as v, parseUlid as w, parseUuidVersion as x };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @utilix/sdk — hashing module
3
+ *
4
+ * Tools covered:
5
+ * - hash-generator : hashAll, hashOne (MD5, SHA-1, SHA-256, SHA-384, SHA-512)
6
+ * - bcrypt-tool : hashPassword, verifyPassword, hashWithTiming, validateRounds
7
+ * - htpasswd : generateSha1Hash, generateMd5Hash, generateBcryptHash,
8
+ * generatePlain, createEntry, parseHtpasswdFile,
9
+ * generateHtpasswdFile, validateUsername
10
+ */
11
+ type HashAlgorithm = 'MD5' | 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
12
+ declare const HASH_ALGORITHMS: HashAlgorithm[];
13
+ declare const HASH_BITS: Record<HashAlgorithm, number>;
14
+ interface HashResult {
15
+ algorithm: HashAlgorithm;
16
+ hex: string;
17
+ bits: number;
18
+ }
19
+ declare function hashAll(input: string): Promise<HashResult[]>;
20
+ declare function hashOne(algorithm: HashAlgorithm, input: string): Promise<string>;
21
+ declare const ROUND_OPTIONS: readonly [8, 10, 12, 14];
22
+ declare function hashPassword(password: string, rounds?: number): Promise<string>;
23
+ declare function verifyPassword(password: string, hash: string): Promise<boolean>;
24
+ interface BcryptResult {
25
+ hash: string;
26
+ rounds: number;
27
+ timingMs: number;
28
+ }
29
+ declare function hashWithTiming(password: string, rounds: number): Promise<BcryptResult>;
30
+ declare function validateRounds(rounds: number): {
31
+ valid: boolean;
32
+ warning?: string;
33
+ };
34
+ type HtpasswdAlgorithm = 'bcrypt' | 'sha1' | 'md5' | 'plain';
35
+ interface HtpasswdEntry {
36
+ username: string;
37
+ hashedPassword: string;
38
+ algorithm: HtpasswdAlgorithm;
39
+ line: string;
40
+ }
41
+ declare function generateSha1Hash(password: string): string;
42
+ declare function generateMd5Hash(password: string): string;
43
+ declare function generateBcryptHash(password: string, rounds?: number): string;
44
+ declare function generatePlain(password: string): string;
45
+ declare function createEntry(username: string, password: string, algorithm?: HtpasswdAlgorithm): HtpasswdEntry;
46
+ declare function parseHtpasswdFile(content: string): HtpasswdEntry[];
47
+ declare function generateHtpasswdFile(entries: HtpasswdEntry[]): string;
48
+ declare function validateUsername(username: string): boolean;
49
+
50
+ type hashing_BcryptResult = BcryptResult;
51
+ declare const hashing_HASH_ALGORITHMS: typeof HASH_ALGORITHMS;
52
+ declare const hashing_HASH_BITS: typeof HASH_BITS;
53
+ type hashing_HashAlgorithm = HashAlgorithm;
54
+ type hashing_HashResult = HashResult;
55
+ type hashing_HtpasswdAlgorithm = HtpasswdAlgorithm;
56
+ type hashing_HtpasswdEntry = HtpasswdEntry;
57
+ declare const hashing_ROUND_OPTIONS: typeof ROUND_OPTIONS;
58
+ declare const hashing_createEntry: typeof createEntry;
59
+ declare const hashing_generateBcryptHash: typeof generateBcryptHash;
60
+ declare const hashing_generateHtpasswdFile: typeof generateHtpasswdFile;
61
+ declare const hashing_generateMd5Hash: typeof generateMd5Hash;
62
+ declare const hashing_generatePlain: typeof generatePlain;
63
+ declare const hashing_generateSha1Hash: typeof generateSha1Hash;
64
+ declare const hashing_hashAll: typeof hashAll;
65
+ declare const hashing_hashOne: typeof hashOne;
66
+ declare const hashing_hashPassword: typeof hashPassword;
67
+ declare const hashing_hashWithTiming: typeof hashWithTiming;
68
+ declare const hashing_parseHtpasswdFile: typeof parseHtpasswdFile;
69
+ declare const hashing_validateRounds: typeof validateRounds;
70
+ declare const hashing_validateUsername: typeof validateUsername;
71
+ declare const hashing_verifyPassword: typeof verifyPassword;
72
+ declare namespace hashing {
73
+ export { type hashing_BcryptResult as BcryptResult, hashing_HASH_ALGORITHMS as HASH_ALGORITHMS, hashing_HASH_BITS as HASH_BITS, type hashing_HashAlgorithm as HashAlgorithm, type hashing_HashResult as HashResult, type hashing_HtpasswdAlgorithm as HtpasswdAlgorithm, type hashing_HtpasswdEntry as HtpasswdEntry, hashing_ROUND_OPTIONS as ROUND_OPTIONS, hashing_createEntry as createEntry, hashing_generateBcryptHash as generateBcryptHash, hashing_generateHtpasswdFile as generateHtpasswdFile, hashing_generateMd5Hash as generateMd5Hash, hashing_generatePlain as generatePlain, hashing_generateSha1Hash as generateSha1Hash, hashing_hashAll as hashAll, hashing_hashOne as hashOne, hashing_hashPassword as hashPassword, hashing_hashWithTiming as hashWithTiming, hashing_parseHtpasswdFile as parseHtpasswdFile, hashing_validateRounds as validateRounds, hashing_validateUsername as validateUsername, hashing_verifyPassword as verifyPassword };
74
+ }
75
+
76
+ export { type BcryptResult as B, HASH_ALGORITHMS as H, ROUND_OPTIONS as R, HASH_BITS as a, type HashAlgorithm as b, type HashResult as c, type HtpasswdAlgorithm as d, type HtpasswdEntry as e, createEntry as f, generateBcryptHash as g, hashing as h, generateHtpasswdFile as i, generateMd5Hash as j, generatePlain as k, generateSha1Hash as l, hashAll as m, hashOne as n, hashPassword as o, hashWithTiming as p, parseHtpasswdFile as q, validateUsername as r, verifyPassword as s, validateRounds as v };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @utilix/sdk — hashing module
3
+ *
4
+ * Tools covered:
5
+ * - hash-generator : hashAll, hashOne (MD5, SHA-1, SHA-256, SHA-384, SHA-512)
6
+ * - bcrypt-tool : hashPassword, verifyPassword, hashWithTiming, validateRounds
7
+ * - htpasswd : generateSha1Hash, generateMd5Hash, generateBcryptHash,
8
+ * generatePlain, createEntry, parseHtpasswdFile,
9
+ * generateHtpasswdFile, validateUsername
10
+ */
11
+ type HashAlgorithm = 'MD5' | 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
12
+ declare const HASH_ALGORITHMS: HashAlgorithm[];
13
+ declare const HASH_BITS: Record<HashAlgorithm, number>;
14
+ interface HashResult {
15
+ algorithm: HashAlgorithm;
16
+ hex: string;
17
+ bits: number;
18
+ }
19
+ declare function hashAll(input: string): Promise<HashResult[]>;
20
+ declare function hashOne(algorithm: HashAlgorithm, input: string): Promise<string>;
21
+ declare const ROUND_OPTIONS: readonly [8, 10, 12, 14];
22
+ declare function hashPassword(password: string, rounds?: number): Promise<string>;
23
+ declare function verifyPassword(password: string, hash: string): Promise<boolean>;
24
+ interface BcryptResult {
25
+ hash: string;
26
+ rounds: number;
27
+ timingMs: number;
28
+ }
29
+ declare function hashWithTiming(password: string, rounds: number): Promise<BcryptResult>;
30
+ declare function validateRounds(rounds: number): {
31
+ valid: boolean;
32
+ warning?: string;
33
+ };
34
+ type HtpasswdAlgorithm = 'bcrypt' | 'sha1' | 'md5' | 'plain';
35
+ interface HtpasswdEntry {
36
+ username: string;
37
+ hashedPassword: string;
38
+ algorithm: HtpasswdAlgorithm;
39
+ line: string;
40
+ }
41
+ declare function generateSha1Hash(password: string): string;
42
+ declare function generateMd5Hash(password: string): string;
43
+ declare function generateBcryptHash(password: string, rounds?: number): string;
44
+ declare function generatePlain(password: string): string;
45
+ declare function createEntry(username: string, password: string, algorithm?: HtpasswdAlgorithm): HtpasswdEntry;
46
+ declare function parseHtpasswdFile(content: string): HtpasswdEntry[];
47
+ declare function generateHtpasswdFile(entries: HtpasswdEntry[]): string;
48
+ declare function validateUsername(username: string): boolean;
49
+
50
+ type hashing_BcryptResult = BcryptResult;
51
+ declare const hashing_HASH_ALGORITHMS: typeof HASH_ALGORITHMS;
52
+ declare const hashing_HASH_BITS: typeof HASH_BITS;
53
+ type hashing_HashAlgorithm = HashAlgorithm;
54
+ type hashing_HashResult = HashResult;
55
+ type hashing_HtpasswdAlgorithm = HtpasswdAlgorithm;
56
+ type hashing_HtpasswdEntry = HtpasswdEntry;
57
+ declare const hashing_ROUND_OPTIONS: typeof ROUND_OPTIONS;
58
+ declare const hashing_createEntry: typeof createEntry;
59
+ declare const hashing_generateBcryptHash: typeof generateBcryptHash;
60
+ declare const hashing_generateHtpasswdFile: typeof generateHtpasswdFile;
61
+ declare const hashing_generateMd5Hash: typeof generateMd5Hash;
62
+ declare const hashing_generatePlain: typeof generatePlain;
63
+ declare const hashing_generateSha1Hash: typeof generateSha1Hash;
64
+ declare const hashing_hashAll: typeof hashAll;
65
+ declare const hashing_hashOne: typeof hashOne;
66
+ declare const hashing_hashPassword: typeof hashPassword;
67
+ declare const hashing_hashWithTiming: typeof hashWithTiming;
68
+ declare const hashing_parseHtpasswdFile: typeof parseHtpasswdFile;
69
+ declare const hashing_validateRounds: typeof validateRounds;
70
+ declare const hashing_validateUsername: typeof validateUsername;
71
+ declare const hashing_verifyPassword: typeof verifyPassword;
72
+ declare namespace hashing {
73
+ export { type hashing_BcryptResult as BcryptResult, hashing_HASH_ALGORITHMS as HASH_ALGORITHMS, hashing_HASH_BITS as HASH_BITS, type hashing_HashAlgorithm as HashAlgorithm, type hashing_HashResult as HashResult, type hashing_HtpasswdAlgorithm as HtpasswdAlgorithm, type hashing_HtpasswdEntry as HtpasswdEntry, hashing_ROUND_OPTIONS as ROUND_OPTIONS, hashing_createEntry as createEntry, hashing_generateBcryptHash as generateBcryptHash, hashing_generateHtpasswdFile as generateHtpasswdFile, hashing_generateMd5Hash as generateMd5Hash, hashing_generatePlain as generatePlain, hashing_generateSha1Hash as generateSha1Hash, hashing_hashAll as hashAll, hashing_hashOne as hashOne, hashing_hashPassword as hashPassword, hashing_hashWithTiming as hashWithTiming, hashing_parseHtpasswdFile as parseHtpasswdFile, hashing_validateRounds as validateRounds, hashing_validateUsername as validateUsername, hashing_verifyPassword as verifyPassword };
74
+ }
75
+
76
+ export { type BcryptResult as B, HASH_ALGORITHMS as H, ROUND_OPTIONS as R, HASH_BITS as a, type HashAlgorithm as b, type HashResult as c, type HtpasswdAlgorithm as d, type HtpasswdEntry as e, createEntry as f, generateBcryptHash as g, hashing as h, generateHtpasswdFile as i, generateMd5Hash as j, generatePlain as k, generateSha1Hash as l, hashAll as m, hashOne as n, hashPassword as o, hashWithTiming as p, parseHtpasswdFile as q, validateUsername as r, verifyPassword as s, validateRounds as v };