@monocloud/auth-core 0.1.3 → 0.1.5
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/README.md +19 -3
- package/dist/index.cjs +101 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +72 -35
- package/dist/index.mjs +75 -40
- package/dist/index.mjs.map +1 -1
- package/dist/types-hokU85Zr.d.mts +1243 -0
- package/dist/utils/index.cjs +19 -19
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +5 -7
- package/dist/utils/index.mjs +5 -6
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/internal.cjs +365 -23
- package/dist/utils/internal.cjs.map +1 -0
- package/dist/utils/internal.d.mts +5 -6
- package/dist/utils/internal.mjs +342 -2
- package/dist/utils/internal.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/index.d.cts +0 -274
- package/dist/internal-DXHuqjJJ.mjs +0 -343
- package/dist/internal-DXHuqjJJ.mjs.map +0 -1
- package/dist/internal-DytuO03E.cjs +0 -475
- package/dist/internal-DytuO03E.cjs.map +0 -1
- package/dist/types-CnxqWHwA.d.cts +0 -481
- package/dist/types-DwJl9ZUf.d.mts +0 -481
- package/dist/utils/index.d.cts +0 -106
- package/dist/utils/internal.d.cts +0 -209
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { g as Jwk, t as AccessToken, v as JwsHeaderParameters } from "../types-CnxqWHwA.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/utils/internal.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @ignore
|
|
7
|
-
* Converts a string to a Base64URL encoded string.
|
|
8
|
-
*
|
|
9
|
-
* @param input - The string to encode.
|
|
10
|
-
*
|
|
11
|
-
* @returns The Base64URL encoded string.
|
|
12
|
-
*/
|
|
13
|
-
declare const toB64Url: (input: string) => string;
|
|
14
|
-
/**
|
|
15
|
-
* @ignore
|
|
16
|
-
* Parses a string value into a boolean.
|
|
17
|
-
*
|
|
18
|
-
* @param value - The string value to parse.
|
|
19
|
-
*
|
|
20
|
-
* @returns `true` if "true", `false` if "false", otherwise `undefined`.
|
|
21
|
-
*/
|
|
22
|
-
declare const getBoolean: (value?: string) => boolean | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* @ignore
|
|
25
|
-
* Parses a string value into a number.
|
|
26
|
-
*
|
|
27
|
-
* @param value - The string value to parse.
|
|
28
|
-
*
|
|
29
|
-
* @returns The parsed number, or `undefined` if empty or invalid.
|
|
30
|
-
*/
|
|
31
|
-
declare const getNumber: (value?: string) => number | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* @ignore
|
|
34
|
-
* Ensures that a string has a leading forward slash.
|
|
35
|
-
*
|
|
36
|
-
* @param val - The string to check.
|
|
37
|
-
*
|
|
38
|
-
* @returns The string with a leading slash.
|
|
39
|
-
*/
|
|
40
|
-
declare const ensureLeadingSlash: (val?: string) => string;
|
|
41
|
-
/**
|
|
42
|
-
* @ignore
|
|
43
|
-
* Removes a trailing forward slash from a string.
|
|
44
|
-
*
|
|
45
|
-
* @param val - The string to check.
|
|
46
|
-
*
|
|
47
|
-
* @returns The string without a trailing slash.
|
|
48
|
-
*/
|
|
49
|
-
declare const removeTrailingSlash: (val?: string) => string;
|
|
50
|
-
/**
|
|
51
|
-
* @ignore
|
|
52
|
-
* Checks if a value is present (not null, undefined, or an empty string).
|
|
53
|
-
*
|
|
54
|
-
* @param value - The value to check.
|
|
55
|
-
*
|
|
56
|
-
* @returns `true` if the value is present, `false` otherwise.
|
|
57
|
-
*/
|
|
58
|
-
declare const isPresent: (value?: string | number | boolean) => boolean;
|
|
59
|
-
/**
|
|
60
|
-
* @ignore
|
|
61
|
-
* Checks if a URL is an absolute URL (starts with http:// or https://).
|
|
62
|
-
*
|
|
63
|
-
* @param url - The URL to check.
|
|
64
|
-
*
|
|
65
|
-
* @returns `true` if absolute, `false` otherwise.
|
|
66
|
-
*/
|
|
67
|
-
declare const isAbsoluteUrl: (url: string) => boolean;
|
|
68
|
-
/**
|
|
69
|
-
* @ignore
|
|
70
|
-
* Checks if two URLs have the same origin (host and port).
|
|
71
|
-
*
|
|
72
|
-
* @param url - The first URL.
|
|
73
|
-
* @param urlToCheck - The second URL to compare against.
|
|
74
|
-
*
|
|
75
|
-
* @returns `true` if they share the same origin, `false` otherwise.
|
|
76
|
-
*/
|
|
77
|
-
declare const isSameHost: (url: string, urlToCheck: string) => boolean;
|
|
78
|
-
/**
|
|
79
|
-
* @ignore
|
|
80
|
-
* Converts a string to a Uint8Array using TextEncoder.
|
|
81
|
-
*
|
|
82
|
-
* @param str - The string to convert.
|
|
83
|
-
*
|
|
84
|
-
* @returns A Uint8Array representation of the string.
|
|
85
|
-
*/
|
|
86
|
-
declare const stringToArrayBuffer: (str: string) => Uint8Array;
|
|
87
|
-
/**
|
|
88
|
-
* @ignore
|
|
89
|
-
* Converts an ArrayBuffer to a string using TextDecoder.
|
|
90
|
-
*
|
|
91
|
-
* @param buffer - The buffer to convert.
|
|
92
|
-
*
|
|
93
|
-
* @returns The decoded string.
|
|
94
|
-
*/
|
|
95
|
-
declare const arrayBufferToString: (buffer: ArrayBuffer) => string;
|
|
96
|
-
/**
|
|
97
|
-
* @ignore
|
|
98
|
-
* Converts a Base64URL string back to a standard Base64 string with padding.
|
|
99
|
-
*
|
|
100
|
-
* @param input - The Base64URL string.
|
|
101
|
-
*
|
|
102
|
-
* @returns A standard Base64 string.
|
|
103
|
-
*/
|
|
104
|
-
declare const fromB64Url: (input: string) => string;
|
|
105
|
-
/**
|
|
106
|
-
* @ignore
|
|
107
|
-
* Decodes a Base64URL encoded string.
|
|
108
|
-
*
|
|
109
|
-
* @param input - The Base64URL string to decode.
|
|
110
|
-
*
|
|
111
|
-
* @returns The decoded plaintext string.
|
|
112
|
-
*/
|
|
113
|
-
declare const decodeBase64Url: (input: string) => string;
|
|
114
|
-
/**
|
|
115
|
-
* @ignore
|
|
116
|
-
* Converts a Uint8Array to a Base64URL encoded string.
|
|
117
|
-
*
|
|
118
|
-
* @param buffer - The buffer to encode.
|
|
119
|
-
*
|
|
120
|
-
* @returns The Base64URL encoded string.
|
|
121
|
-
*/
|
|
122
|
-
declare const arrayBufferToBase64: (buffer: Uint8Array) => string;
|
|
123
|
-
/**
|
|
124
|
-
* @ignore
|
|
125
|
-
* Gets the current Unix timestamp in seconds.
|
|
126
|
-
*
|
|
127
|
-
* @returns The current timestamp.
|
|
128
|
-
*/
|
|
129
|
-
declare const now: () => number;
|
|
130
|
-
/**
|
|
131
|
-
* Retrieves a public CryptoKey from a JWK set based on the JWS header.
|
|
132
|
-
*
|
|
133
|
-
* @param jwks - The set of JSON Web Keys.
|
|
134
|
-
* @param header - The JWS header containing the algorithm and key ID.
|
|
135
|
-
*
|
|
136
|
-
* @returns A promise that resolves to the CryptoKey.
|
|
137
|
-
*
|
|
138
|
-
* @throws If no applicable key or multiple keys are found or the algorithm is unsupported.
|
|
139
|
-
*/
|
|
140
|
-
declare const getPublicSigKeyFromIssuerJwks: (jwks: Jwk[], header: JwsHeaderParameters) => Promise<CryptoKey>;
|
|
141
|
-
/**
|
|
142
|
-
* @ignore
|
|
143
|
-
* Encodes a Uint8Array or ArrayBuffer into a Base64URL string using chunked processing.
|
|
144
|
-
*
|
|
145
|
-
* @param input - The data to encode.
|
|
146
|
-
*
|
|
147
|
-
* @returns The Base64URL encoded string.
|
|
148
|
-
*/
|
|
149
|
-
declare const encodeBase64Url: (input: Uint8Array | ArrayBuffer) => string;
|
|
150
|
-
/**
|
|
151
|
-
* @ignore
|
|
152
|
-
* Generates a random Base64URL encoded string.
|
|
153
|
-
*
|
|
154
|
-
* @param length - The number of random bytes to generate.
|
|
155
|
-
*
|
|
156
|
-
* @returns A random Base64URL string.
|
|
157
|
-
*/
|
|
158
|
-
declare const randomBytes: (length?: number) => string;
|
|
159
|
-
/**
|
|
160
|
-
* @ignore
|
|
161
|
-
* Checks if a value is a non-null, non-array JSON object.
|
|
162
|
-
*
|
|
163
|
-
* @param input - The value to check.
|
|
164
|
-
*
|
|
165
|
-
* @returns `true` if the value is a JSON object.
|
|
166
|
-
*/
|
|
167
|
-
declare const isJsonObject: <T>(input: unknown) => input is T;
|
|
168
|
-
/**
|
|
169
|
-
* @ignore
|
|
170
|
-
* Parses a space-separated string into an array of strings.
|
|
171
|
-
*
|
|
172
|
-
* @param s - The space-separated string.
|
|
173
|
-
*
|
|
174
|
-
* @returns An array of strings, or `undefined` if input is empty.
|
|
175
|
-
*/
|
|
176
|
-
declare const parseSpaceSeparated: (s?: string) => string[] | undefined;
|
|
177
|
-
/**
|
|
178
|
-
* @ignore
|
|
179
|
-
* Parses a space-separated string into a Set of strings.
|
|
180
|
-
*
|
|
181
|
-
* @param s - The space-separated string.
|
|
182
|
-
*
|
|
183
|
-
* @returns A Set containing the unique strings.
|
|
184
|
-
*/
|
|
185
|
-
declare const parseSpaceSeparatedSet: (s?: string) => Set<string>;
|
|
186
|
-
/**
|
|
187
|
-
* @ignore
|
|
188
|
-
* Compares two Sets for equality.
|
|
189
|
-
*
|
|
190
|
-
* @param a - The first Set
|
|
191
|
-
* @param b - The second Set
|
|
192
|
-
* @param strict - If `true`, requires both sets to be the same size. @defaultValue true
|
|
193
|
-
*
|
|
194
|
-
* @returns `true` if the sets are equal
|
|
195
|
-
*/
|
|
196
|
-
declare const setsEqual: (a: Set<string>, b: Set<string>, strict?: boolean) => boolean;
|
|
197
|
-
/**
|
|
198
|
-
* Finds a specific access token in an array based on resource and scopes.
|
|
199
|
-
*
|
|
200
|
-
* @param tokens - The array of access tokens.
|
|
201
|
-
* @param resource - Space-separated resource indicators.
|
|
202
|
-
* @param scopes - Space-separated scopes.
|
|
203
|
-
*
|
|
204
|
-
* @returns The matching AccessToken, or `undefined` if not found.
|
|
205
|
-
*/
|
|
206
|
-
declare const findToken: (tokens?: AccessToken[], resource?: string, scopes?: string) => AccessToken | undefined;
|
|
207
|
-
//#endregion
|
|
208
|
-
export { arrayBufferToBase64, arrayBufferToString, decodeBase64Url, encodeBase64Url, ensureLeadingSlash, findToken, fromB64Url, getBoolean, getNumber, getPublicSigKeyFromIssuerJwks, isAbsoluteUrl, isJsonObject, isPresent, isSameHost, now, parseSpaceSeparated, parseSpaceSeparatedSet, randomBytes, removeTrailingSlash, setsEqual, stringToArrayBuffer, toB64Url };
|
|
209
|
-
//# sourceMappingURL=internal.d.cts.map
|