@digitaldefiance/node-ecies-lib 4.16.25 → 4.16.30
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/node-ecies-lib",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.30",
|
|
4
4
|
"description": "Digital Defiance Node ECIES Library",
|
|
5
5
|
"homepage": "https://github.com/Digital-Defiance/node-ecies-lib",
|
|
6
6
|
"repository": {
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"license": "MIT",
|
|
60
60
|
"packageManager": "yarn@4.10.3",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@digitaldefiance/ecies-lib": "4.16.
|
|
63
|
-
"@digitaldefiance/express-suite-test-utils": "1.0
|
|
62
|
+
"@digitaldefiance/ecies-lib": "4.16.30",
|
|
63
|
+
"@digitaldefiance/express-suite-test-utils": "1.1.0",
|
|
64
64
|
"@digitaldefiance/i18n-lib": "4.3.0",
|
|
65
65
|
"@ethereumjs/wallet": "^2.0.4",
|
|
66
66
|
"@noble/curves": "^1.4.2",
|
package/src/lib/guid.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RFC 4122 compliant GUID implementation for Node.js.
|
|
3
|
-
* Extends
|
|
3
|
+
* Extends Buffer directly to ensure full Buffer compatibility in Node.js environments.
|
|
4
4
|
*/
|
|
5
|
-
import { GuidInput, GuidUint8Array, IGuid } from '@digitaldefiance/ecies-lib';
|
|
5
|
+
import { GuidInput, GuidUint8Array, IGuid, type Base64Guid, type BigIntGuid, type FullHexGuid, type RawGuidPlatformBuffer, type ShortHexGuid } from '@digitaldefiance/ecies-lib';
|
|
6
6
|
import * as uuid from 'uuid';
|
|
7
7
|
import { PlatformBuffer } from '../interfaces';
|
|
8
8
|
/**
|
|
@@ -12,55 +12,344 @@ export type VersionedGuidBuffer<V extends 1 | 3 | 4 | 5 | 6 | 7 | undefined = 1
|
|
|
12
12
|
readonly __version: V;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* Node.js GUID implementation that extends
|
|
16
|
-
* This ensures
|
|
15
|
+
* Node.js GUID implementation that extends Buffer directly.
|
|
16
|
+
* This ensures full Buffer compatibility while providing GUID-specific functionality.
|
|
17
|
+
*
|
|
18
|
+
* Implements IGuid interface for compatibility with ecies-lib.
|
|
17
19
|
*/
|
|
18
|
-
export declare class GuidBuffer extends
|
|
20
|
+
export declare class GuidBuffer extends Buffer implements IGuid {
|
|
21
|
+
/**
|
|
22
|
+
* Cached full hex representation for performance
|
|
23
|
+
*/
|
|
24
|
+
private _cachedFullHex?;
|
|
25
|
+
/**
|
|
26
|
+
* Cached short hex representation for performance
|
|
27
|
+
*/
|
|
28
|
+
private _cachedShortHex?;
|
|
29
|
+
/**
|
|
30
|
+
* Cached base64 representation for performance
|
|
31
|
+
*/
|
|
32
|
+
private _cachedBase64?;
|
|
33
|
+
/**
|
|
34
|
+
* The RFC 4122 version of this GUID
|
|
35
|
+
*/
|
|
36
|
+
__version?: 1 | 3 | 4 | 5 | 6 | 7 | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new GuidBuffer from any valid GUID input.
|
|
39
|
+
*
|
|
40
|
+
* Note: Due to Buffer subclassing limitations, this constructor
|
|
41
|
+
* returns a new instance created via Object.setPrototypeOf.
|
|
42
|
+
*/
|
|
19
43
|
constructor(value: GuidInput);
|
|
44
|
+
/**
|
|
45
|
+
* Override species to return Buffer for methods like slice(), map(), etc.
|
|
46
|
+
*/
|
|
47
|
+
static get [Symbol.species](): typeof Buffer;
|
|
48
|
+
/**
|
|
49
|
+
* Internal factory to create a GuidBuffer from validated bytes (no validation).
|
|
50
|
+
*/
|
|
51
|
+
private static createFromBytes;
|
|
52
|
+
/**
|
|
53
|
+
* Static factory method (alternative to constructor).
|
|
54
|
+
*/
|
|
55
|
+
static create(value: GuidInput): GuidBuffer;
|
|
20
56
|
/**
|
|
21
57
|
* Returns the GUID as a raw Buffer.
|
|
58
|
+
* Returns itself since GuidBuffer IS a Buffer.
|
|
59
|
+
* @deprecated Use asRawBuffer for a plain Buffer copy to avoid type mismatches.
|
|
22
60
|
*/
|
|
23
61
|
get asBuffer(): Buffer;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the GUID as a plain Buffer (defensive copy).
|
|
64
|
+
* Use this when you need a plain Buffer type rather than GuidBuffer.
|
|
65
|
+
*/
|
|
66
|
+
get asRawBuffer(): Buffer;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the GUID as a raw Uint8Array (defensive copy).
|
|
69
|
+
*/
|
|
70
|
+
get asRawGuidPlatformBuffer(): RawGuidPlatformBuffer;
|
|
71
|
+
/**
|
|
72
|
+
* Returns the internal buffer without copying.
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
get asRawGuidPlatformBufferUnsafe(): RawGuidPlatformBuffer;
|
|
24
76
|
/**
|
|
25
77
|
* Returns the GUID as a native Uint8Array (not a Buffer).
|
|
26
78
|
*/
|
|
27
79
|
get asUint8Array(): Uint8Array;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the GUID as a PlatformBuffer (Buffer in Node.js).
|
|
82
|
+
* Returns itself since GuidBuffer IS a Buffer.
|
|
83
|
+
*/
|
|
28
84
|
get asPlatformBuffer(): PlatformBuffer;
|
|
29
85
|
/**
|
|
30
|
-
*
|
|
86
|
+
* Returns the GUID as a full hex string (with dashes).
|
|
87
|
+
* Result is cached for performance.
|
|
31
88
|
*/
|
|
32
|
-
|
|
89
|
+
get asFullHexGuid(): FullHexGuid;
|
|
33
90
|
/**
|
|
34
|
-
*
|
|
91
|
+
* Returns the GUID as a short hex string (without dashes).
|
|
92
|
+
* Result is cached for performance.
|
|
35
93
|
*/
|
|
36
|
-
|
|
94
|
+
get asShortHexGuid(): ShortHexGuid;
|
|
37
95
|
/**
|
|
38
|
-
*
|
|
96
|
+
* Returns the GUID as a base64 string.
|
|
97
|
+
* Result is cached for performance.
|
|
39
98
|
*/
|
|
40
|
-
|
|
99
|
+
get asBase64Guid(): Base64Guid;
|
|
41
100
|
/**
|
|
42
|
-
*
|
|
101
|
+
* Returns the GUID as a bigint.
|
|
43
102
|
*/
|
|
44
|
-
|
|
103
|
+
get asBigIntGuid(): BigIntGuid;
|
|
104
|
+
/**
|
|
105
|
+
* Returns a URL-safe base64 representation.
|
|
106
|
+
*/
|
|
107
|
+
get asUrlSafeBase64(): string;
|
|
108
|
+
/**
|
|
109
|
+
* Serializes the GUID to a base64 string.
|
|
110
|
+
*/
|
|
111
|
+
serialize(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Returns the GUID as a JSON string.
|
|
114
|
+
*/
|
|
115
|
+
toJson(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the GUID as a base64 string (default string representation).
|
|
118
|
+
* Overloaded to support both Buffer encoding and IGuid interface.
|
|
119
|
+
*/
|
|
120
|
+
toString(): Base64Guid;
|
|
121
|
+
toString(encoding: BufferEncoding): string;
|
|
122
|
+
/**
|
|
123
|
+
* Extracts the RFC 4122 version from the GUID.
|
|
124
|
+
*/
|
|
125
|
+
getVersion(): number | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Extracts the variant from the GUID.
|
|
128
|
+
*/
|
|
129
|
+
getVariant(): number | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Returns the timestamp from a v1 GUID.
|
|
132
|
+
*/
|
|
133
|
+
getTimestamp(): Date | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Checks if this GUID is empty (all zeros).
|
|
136
|
+
*/
|
|
137
|
+
isEmpty(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Validates that this GUID is a proper v1 GUID.
|
|
140
|
+
*/
|
|
141
|
+
isValidV1(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Validates that this GUID is a proper v3 GUID.
|
|
144
|
+
*/
|
|
145
|
+
isValidV3(): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Validates that this GUID is a proper v4 GUID.
|
|
148
|
+
*/
|
|
149
|
+
isValidV4(): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Validates that this GUID is a proper v5 GUID.
|
|
152
|
+
*/
|
|
153
|
+
isValidV5(): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Validates that this GUID is a proper v6 GUID.
|
|
156
|
+
*/
|
|
157
|
+
isValidV6(): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Validates that this GUID is a proper v7 GUID.
|
|
160
|
+
*/
|
|
161
|
+
isValidV7(): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Compare two Guid instances for equality (IGuid interface).
|
|
164
|
+
* Note: This is named guidEquals to avoid conflict with Buffer.equals()
|
|
165
|
+
*/
|
|
166
|
+
guidEquals(other: IGuid | null | undefined, constantTime?: boolean): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* IGuid.equals implementation - delegates to guidEquals.
|
|
169
|
+
* Uses method overloading to satisfy both Buffer and IGuid interfaces.
|
|
170
|
+
*/
|
|
171
|
+
equals(otherBuffer: Uint8Array): boolean;
|
|
172
|
+
equals(other: IGuid | null | undefined, constantTime?: boolean): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Creates a clone of this GUID.
|
|
175
|
+
*/
|
|
176
|
+
clone(): VersionedGuidBuffer;
|
|
177
|
+
/**
|
|
178
|
+
* Returns a hash code for this GUID.
|
|
179
|
+
*/
|
|
180
|
+
hashCode(): number;
|
|
181
|
+
/**
|
|
182
|
+
* Compares two GUIDs for ordering.
|
|
183
|
+
*/
|
|
184
|
+
compareTo(other: IGuid): number;
|
|
185
|
+
/**
|
|
186
|
+
* Returns a human-readable debug string.
|
|
187
|
+
*/
|
|
188
|
+
toDebugString(): string;
|
|
45
189
|
/**
|
|
46
190
|
* Attaches the RFC 4122 version to a GuidBuffer instance.
|
|
47
191
|
*/
|
|
48
192
|
private static attachVersion;
|
|
193
|
+
/**
|
|
194
|
+
* Generates a new random v4 GUID.
|
|
195
|
+
*/
|
|
49
196
|
static v4(): VersionedGuidBuffer<4>;
|
|
50
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Alias for v4().
|
|
199
|
+
*/
|
|
200
|
+
static generate(): VersionedGuidBuffer<4>;
|
|
201
|
+
/**
|
|
202
|
+
* Alias for v4() for backward compatibility.
|
|
203
|
+
* @deprecated Use generate() instead
|
|
204
|
+
*/
|
|
205
|
+
static new(): VersionedGuidBuffer<4>;
|
|
206
|
+
/**
|
|
207
|
+
* Creates a v1 (time-based) GUID.
|
|
208
|
+
*/
|
|
209
|
+
static v1(options?: uuid.Version1Options): VersionedGuidBuffer<1>;
|
|
210
|
+
/**
|
|
211
|
+
* Creates a v3 (MD5 namespace) GUID.
|
|
212
|
+
*/
|
|
51
213
|
static v3(name: string, namespace: string | Uint8Array): VersionedGuidBuffer<3>;
|
|
214
|
+
/**
|
|
215
|
+
* Creates a v5 (SHA-1 namespace) GUID.
|
|
216
|
+
*/
|
|
217
|
+
static v5(name: string, namespace: string | Uint8Array): VersionedGuidBuffer<5>;
|
|
218
|
+
/**
|
|
219
|
+
* Creates a v6 GUID.
|
|
220
|
+
*/
|
|
52
221
|
static v6(options?: uuid.Version6Options): VersionedGuidBuffer<6>;
|
|
222
|
+
/**
|
|
223
|
+
* Creates a v7 GUID.
|
|
224
|
+
*/
|
|
53
225
|
static v7(options?: uuid.Version7Options): VersionedGuidBuffer<7>;
|
|
54
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Parses a GUID from any valid format.
|
|
228
|
+
*/
|
|
55
229
|
static parse(value: GuidInput): VersionedGuidBuffer;
|
|
230
|
+
/**
|
|
231
|
+
* Attempts to parse a GUID, returning null on failure.
|
|
232
|
+
*/
|
|
56
233
|
static tryParse(value: GuidInput): VersionedGuidBuffer | null;
|
|
57
|
-
|
|
58
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Hydrates a GuidBuffer from a serialized string.
|
|
236
|
+
*/
|
|
237
|
+
static hydrate(value: string): VersionedGuidBuffer;
|
|
238
|
+
/**
|
|
239
|
+
* Factory method to create a GUID from a full hex string.
|
|
240
|
+
*/
|
|
59
241
|
static fromFullHex(fullHex: string): VersionedGuidBuffer;
|
|
242
|
+
/**
|
|
243
|
+
* Factory method to create a GUID from a short hex string.
|
|
244
|
+
*/
|
|
60
245
|
static fromShortHex(shortHex: string): VersionedGuidBuffer;
|
|
246
|
+
/**
|
|
247
|
+
* Factory method to create a GUID from a base64 string.
|
|
248
|
+
*/
|
|
61
249
|
static fromBase64(base64: string): VersionedGuidBuffer;
|
|
250
|
+
/**
|
|
251
|
+
* Factory method to create a GUID from a bigint.
|
|
252
|
+
*/
|
|
62
253
|
static fromBigInt(bigint: bigint): VersionedGuidBuffer;
|
|
254
|
+
/**
|
|
255
|
+
* Factory method to create a GUID from a raw Buffer.
|
|
256
|
+
*/
|
|
257
|
+
static fromBuffer(buffer: Buffer): VersionedGuidBuffer;
|
|
258
|
+
/**
|
|
259
|
+
* Factory method to create a GUID from a raw Uint8Array.
|
|
260
|
+
*/
|
|
261
|
+
static fromUint8Array(bytes: Uint8Array): VersionedGuidBuffer;
|
|
262
|
+
/**
|
|
263
|
+
* Factory method to create a GUID from a platform buffer.
|
|
264
|
+
*/
|
|
63
265
|
static fromPlatformBuffer(bytes: Uint8Array): VersionedGuidBuffer;
|
|
64
|
-
|
|
266
|
+
/**
|
|
267
|
+
* Creates a GUID from URL-safe base64.
|
|
268
|
+
*/
|
|
269
|
+
static fromUrlSafeBase64(urlSafe: string): VersionedGuidBuffer;
|
|
270
|
+
/**
|
|
271
|
+
* Converts a GUID input to a raw Buffer.
|
|
272
|
+
*/
|
|
273
|
+
static toRawGuidBuffer(value: GuidInput): Buffer;
|
|
274
|
+
/**
|
|
275
|
+
* Validates a UUID string.
|
|
276
|
+
*/
|
|
277
|
+
static validateUuid(value: string): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Checks if a value is a valid raw GUID buffer.
|
|
280
|
+
*/
|
|
281
|
+
static isRawGuidBuffer(value: GuidInput): boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Converts a GUID to full hex format.
|
|
284
|
+
*/
|
|
285
|
+
static toFullHexGuid: typeof GuidUint8Array.toFullHexGuid;
|
|
286
|
+
/**
|
|
287
|
+
* Converts a GUID to short hex format.
|
|
288
|
+
*/
|
|
289
|
+
static toShortHexGuid: typeof GuidUint8Array.toShortHexGuid;
|
|
290
|
+
/**
|
|
291
|
+
* Converts a bigint to full hex GUID format.
|
|
292
|
+
*/
|
|
293
|
+
static toFullHexFromBigInt: typeof GuidUint8Array.toFullHexFromBigInt;
|
|
294
|
+
/**
|
|
295
|
+
* Converts a GUID to raw platform buffer.
|
|
296
|
+
*/
|
|
297
|
+
static toRawGuidPlatformBuffer: typeof GuidUint8Array.toRawGuidPlatformBuffer;
|
|
298
|
+
/**
|
|
299
|
+
* Determines the brand/type of a GUID value.
|
|
300
|
+
*/
|
|
301
|
+
static whichBrand: typeof GuidUint8Array.whichBrand;
|
|
302
|
+
/**
|
|
303
|
+
* Verifies if a GUID is valid for a given brand.
|
|
304
|
+
*/
|
|
305
|
+
static verifyGuid: typeof GuidUint8Array.verifyGuid;
|
|
306
|
+
/**
|
|
307
|
+
* Returns the expected length for a GUID brand.
|
|
308
|
+
*/
|
|
309
|
+
static guidBrandToLength: typeof GuidUint8Array.guidBrandToLength;
|
|
310
|
+
/**
|
|
311
|
+
* Returns the GUID brand for a given length.
|
|
312
|
+
*/
|
|
313
|
+
static lengthToGuidBrand: typeof GuidUint8Array.lengthToGuidBrand;
|
|
314
|
+
/**
|
|
315
|
+
* Checks if a value is a valid full hex GUID.
|
|
316
|
+
*/
|
|
317
|
+
static isFullHexGuid: typeof GuidUint8Array.isFullHexGuid;
|
|
318
|
+
/**
|
|
319
|
+
* Checks if a value is a valid short hex GUID.
|
|
320
|
+
*/
|
|
321
|
+
static isShortHexGuid: typeof GuidUint8Array.isShortHexGuid;
|
|
322
|
+
/**
|
|
323
|
+
* Checks if a value is a valid base64 GUID.
|
|
324
|
+
*/
|
|
325
|
+
static isBase64Guid: typeof GuidUint8Array.isBase64Guid;
|
|
326
|
+
/**
|
|
327
|
+
* Checks if a value is a valid bigint GUID.
|
|
328
|
+
*/
|
|
329
|
+
static isBigIntGuid: typeof GuidUint8Array.isBigIntGuid;
|
|
330
|
+
/**
|
|
331
|
+
* Checks if a value is a valid raw GUID Uint8Array.
|
|
332
|
+
*/
|
|
333
|
+
static isRawGuidUint8Array: typeof GuidUint8Array.isRawGuidUint8Array;
|
|
334
|
+
/**
|
|
335
|
+
* Validates whether a value is a valid GUID.
|
|
336
|
+
*/
|
|
337
|
+
static isValid: typeof GuidUint8Array.isValid;
|
|
338
|
+
/**
|
|
339
|
+
* Static helper to check if a GUID is null, undefined, or empty.
|
|
340
|
+
*/
|
|
341
|
+
static isNilOrEmpty(guid: IGuid | null | undefined): boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Common namespace constants for use with v3/v5 GUIDs.
|
|
344
|
+
*/
|
|
345
|
+
static readonly Namespaces: {
|
|
346
|
+
readonly DNS: "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
347
|
+
readonly URL: "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* Empty/nil GUID constant (all zeros).
|
|
351
|
+
*/
|
|
352
|
+
private static _empty?;
|
|
353
|
+
static get Empty(): GuidBuffer;
|
|
65
354
|
}
|
|
66
355
|
//# sourceMappingURL=guid.d.ts.map
|
package/src/lib/guid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guid.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/guid.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"guid.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/guid.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CAA0B;IAE/C;;OAEG;WACW,YAAY,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAInE;;OAEG;IACH,gBAAuB,UAAU;;;MAGtB;IAEX;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAa;IACnC,WAAkB,KAAK,IAAI,UAAU,CAOpC;CACF"}
|
package/src/lib/guid.js
CHANGED
|
@@ -1,127 +1,592 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuidBuffer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
/**
|
|
5
6
|
* RFC 4122 compliant GUID implementation for Node.js.
|
|
6
|
-
* Extends
|
|
7
|
+
* Extends Buffer directly to ensure full Buffer compatibility in Node.js environments.
|
|
7
8
|
*/
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
9
|
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
10
|
+
const uuid = tslib_1.__importStar(require("uuid"));
|
|
10
11
|
/**
|
|
11
|
-
* Node.js GUID implementation that extends
|
|
12
|
-
* This ensures
|
|
12
|
+
* Node.js GUID implementation that extends Buffer directly.
|
|
13
|
+
* This ensures full Buffer compatibility while providing GUID-specific functionality.
|
|
14
|
+
*
|
|
15
|
+
* Implements IGuid interface for compatibility with ecies-lib.
|
|
13
16
|
*/
|
|
14
|
-
class GuidBuffer extends
|
|
17
|
+
class GuidBuffer extends Buffer {
|
|
18
|
+
/**
|
|
19
|
+
* Cached full hex representation for performance
|
|
20
|
+
*/
|
|
21
|
+
_cachedFullHex;
|
|
22
|
+
/**
|
|
23
|
+
* Cached short hex representation for performance
|
|
24
|
+
*/
|
|
25
|
+
_cachedShortHex;
|
|
26
|
+
/**
|
|
27
|
+
* Cached base64 representation for performance
|
|
28
|
+
*/
|
|
29
|
+
_cachedBase64;
|
|
30
|
+
/**
|
|
31
|
+
* The RFC 4122 version of this GUID
|
|
32
|
+
*/
|
|
33
|
+
__version;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new GuidBuffer from any valid GUID input.
|
|
36
|
+
*
|
|
37
|
+
* Note: Due to Buffer subclassing limitations, this constructor
|
|
38
|
+
* returns a new instance created via Object.setPrototypeOf.
|
|
39
|
+
*/
|
|
15
40
|
constructor(value) {
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
// We must call super, but the actual instance is created differently
|
|
42
|
+
super(0);
|
|
43
|
+
// Validate and convert the input using GuidUint8Array
|
|
44
|
+
const validated = new ecies_lib_1.GuidUint8Array(value);
|
|
45
|
+
// Create a proper Buffer and set its prototype to GuidBuffer
|
|
46
|
+
const buffer = Buffer.from(validated);
|
|
47
|
+
Object.setPrototypeOf(buffer, GuidBuffer.prototype);
|
|
48
|
+
// Initialize cache properties on the buffer
|
|
49
|
+
const guid = buffer;
|
|
50
|
+
guid._cachedFullHex = undefined;
|
|
51
|
+
guid._cachedShortHex = undefined;
|
|
52
|
+
guid._cachedBase64 = undefined;
|
|
53
|
+
guid.__version = undefined;
|
|
54
|
+
// Return the properly constructed buffer
|
|
55
|
+
// This is a valid pattern for TypedArray subclasses
|
|
56
|
+
return guid;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Override species to return Buffer for methods like slice(), map(), etc.
|
|
60
|
+
*/
|
|
61
|
+
static get [Symbol.species]() {
|
|
62
|
+
return Buffer;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Internal factory to create a GuidBuffer from validated bytes (no validation).
|
|
66
|
+
*/
|
|
67
|
+
static createFromBytes(bytes) {
|
|
68
|
+
// Create a Buffer from the bytes
|
|
69
|
+
const buffer = Buffer.from(bytes);
|
|
70
|
+
// Set the prototype to GuidBuffer
|
|
71
|
+
Object.setPrototypeOf(buffer, GuidBuffer.prototype);
|
|
72
|
+
// Initialize cache properties
|
|
73
|
+
const guid = buffer;
|
|
74
|
+
guid._cachedFullHex = undefined;
|
|
75
|
+
guid._cachedShortHex = undefined;
|
|
76
|
+
guid._cachedBase64 = undefined;
|
|
77
|
+
guid.__version = undefined;
|
|
78
|
+
return guid;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Static factory method (alternative to constructor).
|
|
82
|
+
*/
|
|
83
|
+
static create(value) {
|
|
84
|
+
// Use GuidUint8Array for validation and conversion
|
|
85
|
+
const validated = new ecies_lib_1.GuidUint8Array(value);
|
|
86
|
+
return GuidBuffer.createFromBytes(validated);
|
|
21
87
|
}
|
|
22
88
|
/**
|
|
23
89
|
* Returns the GUID as a raw Buffer.
|
|
90
|
+
* Returns itself since GuidBuffer IS a Buffer.
|
|
91
|
+
* @deprecated Use asRawBuffer for a plain Buffer copy to avoid type mismatches.
|
|
24
92
|
*/
|
|
25
93
|
get asBuffer() {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns the GUID as a plain Buffer (defensive copy).
|
|
98
|
+
* Use this when you need a plain Buffer type rather than GuidBuffer.
|
|
99
|
+
*/
|
|
100
|
+
get asRawBuffer() {
|
|
101
|
+
return Buffer.from(this);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Returns the GUID as a raw Uint8Array (defensive copy).
|
|
105
|
+
*/
|
|
106
|
+
get asRawGuidPlatformBuffer() {
|
|
107
|
+
return new Uint8Array(this);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Returns the internal buffer without copying.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
get asRawGuidPlatformBufferUnsafe() {
|
|
114
|
+
return this;
|
|
29
115
|
}
|
|
30
116
|
/**
|
|
31
117
|
* Returns the GUID as a native Uint8Array (not a Buffer).
|
|
32
118
|
*/
|
|
33
119
|
get asUint8Array() {
|
|
34
|
-
return new Uint8Array(this
|
|
120
|
+
return new Uint8Array(this);
|
|
35
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Returns the GUID as a PlatformBuffer (Buffer in Node.js).
|
|
124
|
+
* Returns itself since GuidBuffer IS a Buffer.
|
|
125
|
+
*/
|
|
36
126
|
get asPlatformBuffer() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
: Buffer.from(this._value);
|
|
127
|
+
// Return as Buffer type to satisfy PlatformBuffer
|
|
128
|
+
return this;
|
|
40
129
|
}
|
|
41
130
|
/**
|
|
42
|
-
*
|
|
131
|
+
* Returns the GUID as a full hex string (with dashes).
|
|
132
|
+
* Result is cached for performance.
|
|
43
133
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
134
|
+
get asFullHexGuid() {
|
|
135
|
+
if (!this._cachedFullHex) {
|
|
136
|
+
const hexString = this.toString('hex');
|
|
137
|
+
this._cachedFullHex = ecies_lib_1.GuidUint8Array.toFullHexGuid(hexString);
|
|
138
|
+
}
|
|
139
|
+
return this._cachedFullHex;
|
|
46
140
|
}
|
|
47
141
|
/**
|
|
48
|
-
*
|
|
142
|
+
* Returns the GUID as a short hex string (without dashes).
|
|
143
|
+
* Result is cached for performance.
|
|
49
144
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
145
|
+
get asShortHexGuid() {
|
|
146
|
+
if (!this._cachedShortHex) {
|
|
147
|
+
this._cachedShortHex = this.toString('hex');
|
|
148
|
+
}
|
|
149
|
+
return this._cachedShortHex;
|
|
52
150
|
}
|
|
53
151
|
/**
|
|
54
|
-
*
|
|
152
|
+
* Returns the GUID as a base64 string.
|
|
153
|
+
* Result is cached for performance.
|
|
55
154
|
*/
|
|
56
|
-
|
|
155
|
+
get asBase64Guid() {
|
|
156
|
+
if (!this._cachedBase64) {
|
|
157
|
+
this._cachedBase64 = this.toString('base64');
|
|
158
|
+
}
|
|
159
|
+
return this._cachedBase64;
|
|
160
|
+
}
|
|
57
161
|
/**
|
|
58
|
-
*
|
|
162
|
+
* Returns the GUID as a bigint.
|
|
59
163
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
164
|
+
get asBigIntGuid() {
|
|
165
|
+
return BigInt('0x' + this.toString('hex'));
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Returns a URL-safe base64 representation.
|
|
169
|
+
*/
|
|
170
|
+
get asUrlSafeBase64() {
|
|
171
|
+
return this.toString('base64url');
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Serializes the GUID to a base64 string.
|
|
175
|
+
*/
|
|
176
|
+
serialize() {
|
|
177
|
+
return this.asBase64Guid;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Returns the GUID as a JSON string.
|
|
181
|
+
*/
|
|
182
|
+
toJson() {
|
|
183
|
+
return JSON.stringify(this.asBase64Guid);
|
|
184
|
+
}
|
|
185
|
+
toString(encoding) {
|
|
186
|
+
if (encoding) {
|
|
187
|
+
return super.toString(encoding);
|
|
188
|
+
}
|
|
189
|
+
return this.asBase64Guid;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Extracts the RFC 4122 version from the GUID.
|
|
193
|
+
*/
|
|
194
|
+
getVersion() {
|
|
195
|
+
// Version is in bits 48-51 (byte 6, high nibble)
|
|
196
|
+
const versionByte = this[6];
|
|
197
|
+
const version = (versionByte >> 4) & 0x0f;
|
|
198
|
+
return version >= 1 && version <= 7 ? version : undefined;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Extracts the variant from the GUID.
|
|
202
|
+
*/
|
|
203
|
+
getVariant() {
|
|
204
|
+
const variantByte = this[8];
|
|
205
|
+
if ((variantByte & 0x80) === 0)
|
|
206
|
+
return 0; // NCS
|
|
207
|
+
if ((variantByte & 0xc0) === 0x80)
|
|
208
|
+
return 1; // RFC 4122
|
|
209
|
+
if ((variantByte & 0xe0) === 0xc0)
|
|
210
|
+
return 2; // Microsoft
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Returns the timestamp from a v1 GUID.
|
|
215
|
+
*/
|
|
216
|
+
getTimestamp() {
|
|
217
|
+
if (this.getVersion() !== 1)
|
|
218
|
+
return undefined;
|
|
219
|
+
const timeLow = (this[0] << 24) | (this[1] << 16) | (this[2] << 8) | this[3];
|
|
220
|
+
const timeMid = (this[4] << 8) | this[5];
|
|
221
|
+
const timeHigh = ((this[6] & 0x0f) << 8) | this[7];
|
|
222
|
+
const timestamp = (BigInt(timeHigh) << 48n) |
|
|
223
|
+
(BigInt(timeMid) << 32n) |
|
|
224
|
+
BigInt(timeLow >>> 0);
|
|
225
|
+
const unixTimestamp = Number(timestamp - 122192928000000000n) / 10000;
|
|
226
|
+
return new Date(unixTimestamp);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Checks if this GUID is empty (all zeros).
|
|
230
|
+
*/
|
|
231
|
+
isEmpty() {
|
|
232
|
+
for (let i = 0; i < this.length; i++) {
|
|
233
|
+
if (this[i] !== 0)
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Validates that this GUID is a proper v1 GUID.
|
|
240
|
+
*/
|
|
241
|
+
isValidV1() {
|
|
242
|
+
return this.getVersion() === 1;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Validates that this GUID is a proper v3 GUID.
|
|
246
|
+
*/
|
|
247
|
+
isValidV3() {
|
|
248
|
+
return this.getVersion() === 3;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Validates that this GUID is a proper v4 GUID.
|
|
252
|
+
*/
|
|
253
|
+
isValidV4() {
|
|
254
|
+
const fullHex = this.asFullHexGuid;
|
|
255
|
+
// Boundary values are considered valid
|
|
256
|
+
if (fullHex === '00000000-0000-0000-0000-000000000000' ||
|
|
257
|
+
fullHex === 'ffffffff-ffff-ffff-ffff-ffffffffffff') {
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
return this.getVersion() === 4;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Validates that this GUID is a proper v5 GUID.
|
|
264
|
+
*/
|
|
265
|
+
isValidV5() {
|
|
266
|
+
return this.getVersion() === 5;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Validates that this GUID is a proper v6 GUID.
|
|
270
|
+
*/
|
|
271
|
+
isValidV6() {
|
|
272
|
+
return this.getVersion() === 6;
|
|
63
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Validates that this GUID is a proper v7 GUID.
|
|
276
|
+
*/
|
|
277
|
+
isValidV7() {
|
|
278
|
+
return this.getVersion() === 7;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Compare two Guid instances for equality (IGuid interface).
|
|
282
|
+
* Note: This is named guidEquals to avoid conflict with Buffer.equals()
|
|
283
|
+
*/
|
|
284
|
+
guidEquals(other, constantTime = false) {
|
|
285
|
+
if (!other)
|
|
286
|
+
return false;
|
|
287
|
+
const b = other.asRawGuidPlatformBuffer;
|
|
288
|
+
if (constantTime) {
|
|
289
|
+
let result = 0;
|
|
290
|
+
for (let i = 0; i < 16; i++) {
|
|
291
|
+
result |= this[i] ^ b[i];
|
|
292
|
+
}
|
|
293
|
+
return result === 0;
|
|
294
|
+
}
|
|
295
|
+
for (let i = 0; i < 16; i++) {
|
|
296
|
+
if (this[i] !== b[i])
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
equals(other, constantTime = false) {
|
|
302
|
+
if (!other)
|
|
303
|
+
return false;
|
|
304
|
+
// If it's a plain Uint8Array (Buffer.equals signature), use Buffer comparison
|
|
305
|
+
if (other instanceof Uint8Array && !('asRawGuidPlatformBuffer' in other)) {
|
|
306
|
+
return super.equals(other);
|
|
307
|
+
}
|
|
308
|
+
// Otherwise treat as IGuid
|
|
309
|
+
return this.guidEquals(other, constantTime);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Creates a clone of this GUID.
|
|
313
|
+
*/
|
|
314
|
+
clone() {
|
|
315
|
+
return GuidBuffer.attachVersion(GuidBuffer.createFromBytes(this));
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Returns a hash code for this GUID.
|
|
319
|
+
*/
|
|
320
|
+
hashCode() {
|
|
321
|
+
let hash = 0;
|
|
322
|
+
for (let i = 0; i < this.length; i++) {
|
|
323
|
+
hash = (hash << 5) - hash + this[i];
|
|
324
|
+
hash = hash & hash;
|
|
325
|
+
}
|
|
326
|
+
return hash;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Compares two GUIDs for ordering.
|
|
330
|
+
*/
|
|
331
|
+
compareTo(other) {
|
|
332
|
+
const b = other.asRawGuidPlatformBuffer;
|
|
333
|
+
for (let i = 0; i < 16; i++) {
|
|
334
|
+
if (this[i] < b[i])
|
|
335
|
+
return -1;
|
|
336
|
+
if (this[i] > b[i])
|
|
337
|
+
return 1;
|
|
338
|
+
}
|
|
339
|
+
return 0;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Returns a human-readable debug string.
|
|
343
|
+
*/
|
|
344
|
+
toDebugString() {
|
|
345
|
+
const version = this.getVersion();
|
|
346
|
+
const variant = this.getVariant();
|
|
347
|
+
return `GuidBuffer(${this.asFullHexGuid}, v${version ?? '?'}, variant=${variant ?? '?'})`;
|
|
348
|
+
}
|
|
349
|
+
// ============ Static Factory Methods ============
|
|
64
350
|
/**
|
|
65
351
|
* Attaches the RFC 4122 version to a GuidBuffer instance.
|
|
66
352
|
*/
|
|
67
353
|
static attachVersion(guid) {
|
|
68
|
-
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
70
|
-
guid.__version = version;
|
|
354
|
+
guid.__version = guid.getVersion();
|
|
71
355
|
return guid;
|
|
72
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Generates a new random v4 GUID.
|
|
359
|
+
*/
|
|
73
360
|
static v4() {
|
|
74
|
-
|
|
361
|
+
const uuidStr = uuid.v4();
|
|
362
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(uuidStr));
|
|
75
363
|
}
|
|
76
|
-
|
|
77
|
-
|
|
364
|
+
/**
|
|
365
|
+
* Alias for v4().
|
|
366
|
+
*/
|
|
367
|
+
static generate() {
|
|
368
|
+
return GuidBuffer.v4();
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Alias for v4() for backward compatibility.
|
|
372
|
+
* @deprecated Use generate() instead
|
|
373
|
+
*/
|
|
374
|
+
static new() {
|
|
375
|
+
return GuidBuffer.v4();
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Creates a v1 (time-based) GUID.
|
|
379
|
+
*/
|
|
380
|
+
static v1(options) {
|
|
381
|
+
const uuidStr = uuid.v1(options);
|
|
382
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(uuidStr));
|
|
78
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* Creates a v3 (MD5 namespace) GUID.
|
|
386
|
+
*/
|
|
79
387
|
static v3(name, namespace) {
|
|
80
|
-
|
|
388
|
+
const namespaceStr = typeof namespace === 'string'
|
|
389
|
+
? namespace
|
|
390
|
+
: ecies_lib_1.GuidUint8Array.toFullHexGuid(namespace);
|
|
391
|
+
const uuidStr = uuid.v3(name, namespaceStr);
|
|
392
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(uuidStr));
|
|
81
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Creates a v5 (SHA-1 namespace) GUID.
|
|
396
|
+
*/
|
|
397
|
+
static v5(name, namespace) {
|
|
398
|
+
const namespaceStr = typeof namespace === 'string'
|
|
399
|
+
? namespace
|
|
400
|
+
: ecies_lib_1.GuidUint8Array.toFullHexGuid(namespace);
|
|
401
|
+
const uuidStr = uuid.v5(name, namespaceStr);
|
|
402
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(uuidStr));
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Creates a v6 GUID.
|
|
406
|
+
*/
|
|
82
407
|
static v6(options) {
|
|
83
|
-
|
|
408
|
+
const uuidStr = uuid.v6(options);
|
|
409
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(uuidStr));
|
|
84
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* Creates a v7 GUID.
|
|
413
|
+
*/
|
|
85
414
|
static v7(options) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
static v1(options) {
|
|
89
|
-
return GuidBuffer.attachVersion(new GuidBuffer(ecies_lib_1.GuidUint8Array.v1(options).asFullHexGuid));
|
|
415
|
+
const uuidStr = uuid.v7(options);
|
|
416
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(uuidStr));
|
|
90
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Parses a GUID from any valid format.
|
|
420
|
+
*/
|
|
91
421
|
static parse(value) {
|
|
92
|
-
return GuidBuffer.attachVersion(
|
|
422
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(value));
|
|
93
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Attempts to parse a GUID, returning null on failure.
|
|
426
|
+
*/
|
|
94
427
|
static tryParse(value) {
|
|
95
428
|
try {
|
|
96
|
-
return GuidBuffer.attachVersion(
|
|
429
|
+
return GuidBuffer.attachVersion(GuidBuffer.create(value));
|
|
97
430
|
}
|
|
98
431
|
catch {
|
|
99
432
|
return null;
|
|
100
433
|
}
|
|
101
434
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
static
|
|
106
|
-
return GuidBuffer.
|
|
435
|
+
/**
|
|
436
|
+
* Hydrates a GuidBuffer from a serialized string.
|
|
437
|
+
*/
|
|
438
|
+
static hydrate(value) {
|
|
439
|
+
return GuidBuffer.parse(value);
|
|
107
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Factory method to create a GUID from a full hex string.
|
|
443
|
+
*/
|
|
108
444
|
static fromFullHex(fullHex) {
|
|
109
|
-
return GuidBuffer.
|
|
445
|
+
return GuidBuffer.parse(fullHex);
|
|
110
446
|
}
|
|
447
|
+
/**
|
|
448
|
+
* Factory method to create a GUID from a short hex string.
|
|
449
|
+
*/
|
|
111
450
|
static fromShortHex(shortHex) {
|
|
112
|
-
return GuidBuffer.
|
|
451
|
+
return GuidBuffer.parse(shortHex);
|
|
113
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Factory method to create a GUID from a base64 string.
|
|
455
|
+
*/
|
|
114
456
|
static fromBase64(base64) {
|
|
115
|
-
return GuidBuffer.
|
|
457
|
+
return GuidBuffer.parse(base64);
|
|
116
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* Factory method to create a GUID from a bigint.
|
|
461
|
+
*/
|
|
117
462
|
static fromBigInt(bigint) {
|
|
118
|
-
return GuidBuffer.
|
|
463
|
+
return GuidBuffer.parse(bigint);
|
|
119
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Factory method to create a GUID from a raw Buffer.
|
|
467
|
+
*/
|
|
468
|
+
static fromBuffer(buffer) {
|
|
469
|
+
return GuidBuffer.parse(buffer);
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Factory method to create a GUID from a raw Uint8Array.
|
|
473
|
+
*/
|
|
474
|
+
static fromUint8Array(bytes) {
|
|
475
|
+
return GuidBuffer.parse(bytes);
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Factory method to create a GUID from a platform buffer.
|
|
479
|
+
*/
|
|
120
480
|
static fromPlatformBuffer(bytes) {
|
|
121
|
-
return GuidBuffer.
|
|
481
|
+
return GuidBuffer.parse(bytes);
|
|
122
482
|
}
|
|
123
|
-
|
|
124
|
-
|
|
483
|
+
/**
|
|
484
|
+
* Creates a GUID from URL-safe base64.
|
|
485
|
+
*/
|
|
486
|
+
static fromUrlSafeBase64(urlSafe) {
|
|
487
|
+
const base64 = urlSafe
|
|
488
|
+
.replace(/-/g, '+')
|
|
489
|
+
.replace(/_/g, '/')
|
|
490
|
+
.padEnd(24, '=');
|
|
491
|
+
return GuidBuffer.parse(base64);
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Converts a GUID input to a raw Buffer.
|
|
495
|
+
*/
|
|
496
|
+
static toRawGuidBuffer(value) {
|
|
497
|
+
return GuidBuffer.create(value);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Validates a UUID string.
|
|
501
|
+
*/
|
|
502
|
+
static validateUuid(value) {
|
|
503
|
+
return uuid.validate(value);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Checks if a value is a valid raw GUID buffer.
|
|
507
|
+
*/
|
|
508
|
+
static isRawGuidBuffer(value) {
|
|
509
|
+
return ecies_lib_1.GuidUint8Array.isRawGuidUint8Array(value);
|
|
510
|
+
}
|
|
511
|
+
// ============ Static Methods Delegated to GuidUint8Array ============
|
|
512
|
+
/**
|
|
513
|
+
* Converts a GUID to full hex format.
|
|
514
|
+
*/
|
|
515
|
+
static toFullHexGuid = ecies_lib_1.GuidUint8Array.toFullHexGuid;
|
|
516
|
+
/**
|
|
517
|
+
* Converts a GUID to short hex format.
|
|
518
|
+
*/
|
|
519
|
+
static toShortHexGuid = ecies_lib_1.GuidUint8Array.toShortHexGuid;
|
|
520
|
+
/**
|
|
521
|
+
* Converts a bigint to full hex GUID format.
|
|
522
|
+
*/
|
|
523
|
+
static toFullHexFromBigInt = ecies_lib_1.GuidUint8Array.toFullHexFromBigInt;
|
|
524
|
+
/**
|
|
525
|
+
* Converts a GUID to raw platform buffer.
|
|
526
|
+
*/
|
|
527
|
+
static toRawGuidPlatformBuffer = ecies_lib_1.GuidUint8Array.toRawGuidPlatformBuffer;
|
|
528
|
+
/**
|
|
529
|
+
* Determines the brand/type of a GUID value.
|
|
530
|
+
*/
|
|
531
|
+
static whichBrand = ecies_lib_1.GuidUint8Array.whichBrand;
|
|
532
|
+
/**
|
|
533
|
+
* Verifies if a GUID is valid for a given brand.
|
|
534
|
+
*/
|
|
535
|
+
static verifyGuid = ecies_lib_1.GuidUint8Array.verifyGuid;
|
|
536
|
+
/**
|
|
537
|
+
* Returns the expected length for a GUID brand.
|
|
538
|
+
*/
|
|
539
|
+
static guidBrandToLength = ecies_lib_1.GuidUint8Array.guidBrandToLength;
|
|
540
|
+
/**
|
|
541
|
+
* Returns the GUID brand for a given length.
|
|
542
|
+
*/
|
|
543
|
+
static lengthToGuidBrand = ecies_lib_1.GuidUint8Array.lengthToGuidBrand;
|
|
544
|
+
/**
|
|
545
|
+
* Checks if a value is a valid full hex GUID.
|
|
546
|
+
*/
|
|
547
|
+
static isFullHexGuid = ecies_lib_1.GuidUint8Array.isFullHexGuid;
|
|
548
|
+
/**
|
|
549
|
+
* Checks if a value is a valid short hex GUID.
|
|
550
|
+
*/
|
|
551
|
+
static isShortHexGuid = ecies_lib_1.GuidUint8Array.isShortHexGuid;
|
|
552
|
+
/**
|
|
553
|
+
* Checks if a value is a valid base64 GUID.
|
|
554
|
+
*/
|
|
555
|
+
static isBase64Guid = ecies_lib_1.GuidUint8Array.isBase64Guid;
|
|
556
|
+
/**
|
|
557
|
+
* Checks if a value is a valid bigint GUID.
|
|
558
|
+
*/
|
|
559
|
+
static isBigIntGuid = ecies_lib_1.GuidUint8Array.isBigIntGuid;
|
|
560
|
+
/**
|
|
561
|
+
* Checks if a value is a valid raw GUID Uint8Array.
|
|
562
|
+
*/
|
|
563
|
+
static isRawGuidUint8Array = ecies_lib_1.GuidUint8Array.isRawGuidUint8Array;
|
|
564
|
+
/**
|
|
565
|
+
* Validates whether a value is a valid GUID.
|
|
566
|
+
*/
|
|
567
|
+
static isValid = ecies_lib_1.GuidUint8Array.isValid;
|
|
568
|
+
/**
|
|
569
|
+
* Static helper to check if a GUID is null, undefined, or empty.
|
|
570
|
+
*/
|
|
571
|
+
static isNilOrEmpty(guid) {
|
|
572
|
+
return !guid || (guid instanceof GuidBuffer && guid.isEmpty());
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Common namespace constants for use with v3/v5 GUIDs.
|
|
576
|
+
*/
|
|
577
|
+
static Namespaces = {
|
|
578
|
+
DNS: '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
|
|
579
|
+
URL: '6ba7b811-9dad-11d1-80b4-00c04fd430c8',
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Empty/nil GUID constant (all zeros).
|
|
583
|
+
*/
|
|
584
|
+
static _empty;
|
|
585
|
+
static get Empty() {
|
|
586
|
+
if (!GuidBuffer._empty) {
|
|
587
|
+
GuidBuffer._empty = GuidBuffer.create('00000000-0000-0000-0000-000000000000');
|
|
588
|
+
}
|
|
589
|
+
return GuidBuffer._empty;
|
|
125
590
|
}
|
|
126
591
|
}
|
|
127
592
|
exports.GuidBuffer = GuidBuffer;
|
package/src/lib/guid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guid.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/guid.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,6DAA6D;AAC7D,0DAA8E;AAmB9E;;;GAGG;AACH,MAAa,UAAW,SAAQ,0BAAc;IAC5C,YAAY,KAAgB;QAC1B,yCAAyC;QACzC,MAAM,WAAW,GACf,KAAK,YAAY,UAAU,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YACpD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;YACpB,CAAC,CAAC,KAAK,CAAC;QACZ,KAAK,CAAC,WAAW,CAAC,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;YACjC,CAAC,CAAC,IAAI,CAAC,MAAM;YACb,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,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AC;IAE3D;;OAEG;IACI,MAAM,CAAC,cAAc,GAAG,0BAAc,CAAC,cAAc,CAAC;IAE7D;;OAEG;IACI,MAAM,CAAC,YAAY,GAAG,0BAAc,CAAC,YAAY,CAAC;IAEzD;;OAEG;IACI,MAAM,CAAC,YAAY,GAAG,0BAAc,CAAC,YAAY,CAAC;IAEzD;;OAEG;IACI,MAAM,CAAC,mBAAmB,GAAG,0BAAc,CAAC,mBAAmB,CAAC;IAEvE;;OAEG;IACI,MAAM,CAAC,OAAO,GAAG,0BAAc,CAAC,OAAO,CAAC;IAE/C;;OAEG;IACI,MAAM,CAAC,YAAY,CAAC,IAA8B;QACvD,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,YAAY,UAAU,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACI,MAAM,CAAU,UAAU,GAAG;QAClC,GAAG,EAAE,sCAAsC;QAC3C,GAAG,EAAE,sCAAsC;KACnC,CAAC;IAEX;;OAEG;IACK,MAAM,CAAC,MAAM,CAAc;IAC5B,MAAM,KAAK,KAAK;QACrB,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvB,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CACnC,sCAAsC,CACvC,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC,MAAM,CAAC;IAC3B,CAAC;;AA5rBH,gCA6rBC"}
|
|
@@ -19,7 +19,7 @@ class GuidV4Provider extends ecies_lib_1.BaseIdProvider {
|
|
|
19
19
|
*/
|
|
20
20
|
generate() {
|
|
21
21
|
const guid = guid_1.GuidBuffer.v4();
|
|
22
|
-
return guid.
|
|
22
|
+
return guid.asRawBuffer;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Validate a GUID buffer.
|
|
@@ -61,7 +61,7 @@ class GuidV4Provider extends ecies_lib_1.BaseIdProvider {
|
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
63
|
const guid = guid_1.GuidBuffer.parse(str);
|
|
64
|
-
return guid.
|
|
64
|
+
return guid.asRawBuffer;
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
67
|
throw new ecies_lib_1.IdProviderError(ecies_lib_1.IdProviderErrorType.ParseFailed, { cause: error instanceof Error ? error : undefined }, undefined, {
|
|
@@ -76,7 +76,7 @@ class GuidV4Provider extends ecies_lib_1.BaseIdProvider {
|
|
|
76
76
|
*/
|
|
77
77
|
fromNamespace(namespace, name) {
|
|
78
78
|
const guid = guid_1.GuidBuffer.v5(name, namespace);
|
|
79
|
-
return guid.
|
|
79
|
+
return guid.asRawBuffer;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Get the GUID version from a buffer.
|
|
@@ -138,7 +138,7 @@ class GuidV4Provider extends ecies_lib_1.BaseIdProvider {
|
|
|
138
138
|
return guid;
|
|
139
139
|
}
|
|
140
140
|
toBytes(id) {
|
|
141
|
-
return id.
|
|
141
|
+
return id.asRawBuffer;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
exports.GuidV4Provider = GuidV4Provider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guidv4-provider.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/id-providers/guidv4-provider.ts"],"names":[],"mappings":";;;AAAA,0DAIoC;AAGpC,kCAAqC;AAErC;;;;;;;GAOG;AACH,MAAa,cAAe,SAAQ,0BAA4B;IACrD,UAAU,GAAG,EAAE,CAAC;IAChB,IAAI,GAAG,QAAQ,CAAC;IAEzB;;OAEG;IACH,QAAQ;QACN,MAAM,IAAI,GAAG,iBAAU,CAAC,EAAE,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"guidv4-provider.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-ecies-lib/src/lib/id-providers/guidv4-provider.ts"],"names":[],"mappings":";;;AAAA,0DAIoC;AAG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