@guren/server 0.2.0-alpha.7 → 1.0.0-rc.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/dist/Application-DtWDHXr1.d.ts +2110 -0
- package/dist/BroadcastManager-AkIWUGJo.d.ts +466 -0
- package/dist/CacheManager-BkvHEOZX.d.ts +244 -0
- package/dist/ConsoleKernel-CqCVrdZs.d.ts +207 -0
- package/dist/EventManager-CmIoLt7r.d.ts +207 -0
- package/dist/Gate-CNkBYf8m.d.ts +268 -0
- package/dist/HealthManager-DUyMIzsZ.d.ts +141 -0
- package/dist/I18nManager-Dtgzsf5n.d.ts +270 -0
- package/dist/LogManager-7mxnkaPM.d.ts +256 -0
- package/dist/MailManager-DpMvYiP9.d.ts +292 -0
- package/dist/Scheduler-BstvSca7.d.ts +469 -0
- package/dist/StorageManager-oZTHqaza.d.ts +337 -0
- package/dist/api-token-JOif2CtG.d.ts +1792 -0
- package/dist/app-key-CsBfRC_Q.d.ts +214 -0
- package/dist/auth/index.d.ts +418 -0
- package/dist/auth/index.js +6742 -0
- package/dist/authorization/index.d.ts +129 -0
- package/dist/authorization/index.js +621 -0
- package/dist/broadcasting/index.d.ts +233 -0
- package/dist/broadcasting/index.js +907 -0
- package/dist/cache/index.d.ts +233 -0
- package/dist/cache/index.js +817 -0
- package/dist/encryption/index.d.ts +222 -0
- package/dist/encryption/index.js +602 -0
- package/dist/events/index.d.ts +155 -0
- package/dist/events/index.js +330 -0
- package/dist/health/index.d.ts +185 -0
- package/dist/health/index.js +379 -0
- package/dist/i18n/index.d.ts +101 -0
- package/dist/i18n/index.js +597 -0
- package/dist/index-9_Jzj5jo.d.ts +7 -0
- package/dist/index.d.ts +2628 -619
- package/dist/index.js +22229 -3116
- package/dist/lambda/index.d.ts +156 -0
- package/dist/lambda/index.js +91 -0
- package/dist/logging/index.d.ts +50 -0
- package/dist/logging/index.js +557 -0
- package/dist/mail/index.d.ts +288 -0
- package/dist/mail/index.js +695 -0
- package/dist/mcp/index.d.ts +139 -0
- package/dist/mcp/index.js +382 -0
- package/dist/notifications/index.d.ts +271 -0
- package/dist/notifications/index.js +741 -0
- package/dist/queue/index.d.ts +423 -0
- package/dist/queue/index.js +958 -0
- package/dist/runtime/index.d.ts +93 -0
- package/dist/runtime/index.js +834 -0
- package/dist/scheduling/index.d.ts +41 -0
- package/dist/scheduling/index.js +836 -0
- package/dist/storage/index.d.ts +196 -0
- package/dist/storage/index.js +832 -0
- package/dist/vite/index.js +203 -3
- package/package.json +93 -6
- package/dist/chunk-FK2XQSBF.js +0 -160
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { A as AppKeyring, H as HashAlgorithm, P as PasswordHashOptions, d as HmacOptions, R as RandomStringOptions } from '../app-key-CsBfRC_Q.js';
|
|
2
|
+
export { D as DecryptOptions, a as EncryptOptions, b as EncryptedPayload, E as Encrypter, c as EncrypterConfig, e as createEncrypter, f as decrypt, g as deriveAppKey, h as deriveAppKeyring, q as encodeDerivedKey, i as encrypt, j as generateAppKey, k as generateKey, l as getAppKeyringFromEnv, m as getEncrypter, n as normalizeAppKey, p as parseAppKey, o as parsePreviousAppKeys, s as setEncrypter } from '../app-key-CsBfRC_Q.js';
|
|
3
|
+
|
|
4
|
+
interface SignedMessageClaims {
|
|
5
|
+
purpose?: string;
|
|
6
|
+
iat: number;
|
|
7
|
+
exp?: number;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface SignMessageOptions {
|
|
11
|
+
purpose?: string;
|
|
12
|
+
expiresIn?: number;
|
|
13
|
+
}
|
|
14
|
+
interface VerifySignedMessageOptions {
|
|
15
|
+
purpose?: string;
|
|
16
|
+
allowExpired?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare class MessageSigner {
|
|
19
|
+
private readonly keyring;
|
|
20
|
+
constructor(keyring: AppKeyring);
|
|
21
|
+
sign<T extends Record<string, unknown>>(payload: T, options?: SignMessageOptions): string;
|
|
22
|
+
verify<T extends Record<string, unknown> = Record<string, unknown>>(token: string, options?: VerifySignedMessageOptions): (T & SignedMessageClaims) | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface SignedUrlOptions {
|
|
26
|
+
expiresIn?: number;
|
|
27
|
+
}
|
|
28
|
+
interface VerifySignedUrlOptions {
|
|
29
|
+
requireExpiration?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare function signUrl(value: string, keyring: AppKeyring, options?: SignedUrlOptions): string;
|
|
32
|
+
declare function verifySignedUrl(value: string, keyring: AppKeyring, options?: VerifySignedUrlOptions): boolean;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Hash a value using the specified algorithm.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* hash('hello') // SHA-256 by default
|
|
40
|
+
* hash('hello', 'sha512')
|
|
41
|
+
* hash('hello', 'md5')
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare function hash(value: string | Buffer, algorithm?: HashAlgorithm, encoding?: 'hex' | 'base64'): string;
|
|
45
|
+
/**
|
|
46
|
+
* Create an HMAC signature.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* hmac('message', 'secret-key')
|
|
51
|
+
* hmac('message', 'secret-key', { algorithm: 'sha512' })
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare function hmac(value: string | Buffer, key: string | Buffer, options?: HmacOptions): string;
|
|
55
|
+
/**
|
|
56
|
+
* Verify an HMAC signature.
|
|
57
|
+
*/
|
|
58
|
+
declare function verifyHmac(value: string | Buffer, signature: string, key: string | Buffer, options?: HmacOptions): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Create a SHA-256 hash.
|
|
61
|
+
*/
|
|
62
|
+
declare function sha256(value: string | Buffer): string;
|
|
63
|
+
/**
|
|
64
|
+
* Create a SHA-512 hash.
|
|
65
|
+
*/
|
|
66
|
+
declare function sha512(value: string | Buffer): string;
|
|
67
|
+
/**
|
|
68
|
+
* Create an MD5 hash (not secure, use only for checksums).
|
|
69
|
+
*/
|
|
70
|
+
declare function md5(value: string | Buffer): string;
|
|
71
|
+
/**
|
|
72
|
+
* Hash a password using scrypt.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const hashed = await hashPassword('mypassword')
|
|
77
|
+
* // Returns: $scrypt$N=16384,r=8,p=1$salt$hash
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare function hashPassword(password: string, options?: PasswordHashOptions): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Verify a password against a hash.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const isValid = await verifyPassword('mypassword', hashedPassword)
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
declare function verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
90
|
+
/**
|
|
91
|
+
* Check if a password needs to be rehashed (parameters changed).
|
|
92
|
+
*/
|
|
93
|
+
declare function needsRehash(hash: string, options?: PasswordHashOptions): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Constant-time string comparison.
|
|
96
|
+
*/
|
|
97
|
+
declare function secureCompare(a: string, b: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Check if a value matches a hash.
|
|
100
|
+
*/
|
|
101
|
+
declare function check(value: string | Buffer, hash: string, algorithm?: HashAlgorithm): boolean;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Generate a cryptographically secure random string.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* randomString(32) // 32-character alphanumeric string
|
|
109
|
+
* randomString(16, { charset: 'hex' }) // 16-character hex string
|
|
110
|
+
* randomString(24, { charset: 'url-safe' }) // URL-safe string
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function randomString(length: number, options?: RandomStringOptions): string;
|
|
114
|
+
/**
|
|
115
|
+
* Generate random bytes.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const bytes = random(32) // 32 random bytes
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare function random(length: number): Buffer;
|
|
123
|
+
/**
|
|
124
|
+
* Generate random bytes as hex string.
|
|
125
|
+
*/
|
|
126
|
+
declare function randomHex(length: number): string;
|
|
127
|
+
/**
|
|
128
|
+
* Generate random bytes as base64 string.
|
|
129
|
+
*/
|
|
130
|
+
declare function randomBase64(length: number): string;
|
|
131
|
+
/**
|
|
132
|
+
* Generate random bytes as URL-safe base64 string.
|
|
133
|
+
*/
|
|
134
|
+
declare function randomBase64Url(length: number): string;
|
|
135
|
+
/**
|
|
136
|
+
* Generate a UUID v4.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const id = uuid() // e.g., '550e8400-e29b-41d4-a716-446655440000'
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
declare function uuid(): string;
|
|
144
|
+
/**
|
|
145
|
+
* Generate a secure random integer.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* randomInt(1, 100) // Random number between 1 and 100 (inclusive)
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
declare function randomInt(min: number, max: number): number;
|
|
153
|
+
/**
|
|
154
|
+
* Generate a random token suitable for URLs.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const token = urlSafeToken(32) // URL-safe 32-character token
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
declare function urlSafeToken(length?: number): string;
|
|
162
|
+
/**
|
|
163
|
+
* Generate a secure random password.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const password = generatePassword(16) // Random 16-character password
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
declare function generatePassword(length?: number, options?: {
|
|
171
|
+
uppercase?: boolean;
|
|
172
|
+
lowercase?: boolean;
|
|
173
|
+
numbers?: boolean;
|
|
174
|
+
symbols?: boolean;
|
|
175
|
+
}): string;
|
|
176
|
+
/**
|
|
177
|
+
* Generate a random OTP (One-Time Password).
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* const otp = generateOtp(6) // e.g., '482901'
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare function generateOtp(length?: number): string;
|
|
185
|
+
/**
|
|
186
|
+
* Generate a random slug-friendly string.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const slug = generateSlug() // e.g., 'a8b2c4d6e8'
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
declare function generateSlug(length?: number): string;
|
|
194
|
+
/**
|
|
195
|
+
* Shuffle an array using Fisher-Yates algorithm with secure random.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const shuffled = shuffle([1, 2, 3, 4, 5])
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
declare function shuffle<T>(array: T[]): T[];
|
|
203
|
+
/**
|
|
204
|
+
* Pick a random element from an array.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* const item = pick(['a', 'b', 'c']) // Random element
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare function pick<T>(array: T[]): T;
|
|
212
|
+
/**
|
|
213
|
+
* Pick multiple random elements from an array.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const items = sample(['a', 'b', 'c', 'd'], 2) // Two random elements
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
declare function sample<T>(array: T[], count: number): T[];
|
|
221
|
+
|
|
222
|
+
export { AppKeyring, HashAlgorithm, HmacOptions, MessageSigner, PasswordHashOptions, RandomStringOptions, type SignMessageOptions, type SignedMessageClaims, type SignedUrlOptions, type VerifySignedMessageOptions, type VerifySignedUrlOptions, check, generateOtp, generatePassword, generateSlug, hash, hashPassword, hmac, md5, needsRehash, pick, random, randomBase64, randomBase64Url, randomHex, randomInt, randomString, sample, secureCompare, sha256, sha512, shuffle, signUrl, urlSafeToken, uuid, verifyHmac, verifyPassword, verifySignedUrl };
|