@nextera.one/tps-standard 0.5.0 → 0.5.1

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/LICENSE ADDED
@@ -0,0 +1,192 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ Copyright 2026 TPS Standards Working Group
181
+
182
+ Licensed under the Apache License, Version 2.0 (the "License");
183
+ you may not use this file except in compliance with the License.
184
+ You may obtain a copy of the License at
185
+
186
+ http://www.apache.org/licenses/LICENSE-2.0
187
+
188
+ Unless required by applicable law or agreed to in writing, software
189
+ distributed under the License is distributed on an "AS IS" BASIS,
190
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
191
+ See the License for the specific language governing permissions and
192
+ limitations under the License.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # TPS — Temporal Positioning Standard
2
2
 
3
+ ![TPS — Temporal Positioning Standard](assets/tps-banner.svg)
4
+
3
5
  > **A universal coordinate system for Space, Time, and Context.**
4
6
 
5
7
  TPS defines a deterministic way to represent **when** something happened, **where** it happened, and **under which calendar**, using a single, machine-readable identifier.
@@ -15,7 +17,7 @@ npm i @nextera.one/tps-standard
15
17
  ### Basic Example
16
18
 
17
19
  ```ts
18
- import { TPS } from "tps-standard";
20
+ import { TPS } from "@nextera.one/tps-standard";
19
21
 
20
22
  // Create a TPS time string from current date
21
23
  const nowTime = TPS.fromDate(new Date(), "greg");
@@ -23,7 +25,7 @@ console.log(nowTime);
23
25
  // Output: "T:greg.m3.c1.y26.M01.d07.h13.n20.s45"
24
26
 
25
27
  // Parse a full TPS URI with location and extensions
26
- const uri = "tps://31.95,35.91,800@T:greg.m3.c1.y26.M01.d07.h13.n20;f4;r7";
28
+ const uri = "tps://31.95,35.91,800m@T:greg.m3.c1.y26.M01.d07.h13.n20;f4.r7";
27
29
  const parsed = TPS.parse(uri);
28
30
  console.log(parsed);
29
31
  // { latitude: 31.95, longitude: 35.91, altitude: 800, calendar: 'greg', year: 26, ... }
@@ -80,7 +82,9 @@ tps://[SPACE]@[TIME][;EXTENSIONS]
80
82
  | ------------ | --------------------------------------------------------- |
81
83
  | `SPACE` | `lat,lon[,alt]m` (WGS84) or `unknown`/`hidden`/`redacted` |
82
84
  | `TIME` | TPS Time format (`T:calendar.hierarchy`) |
83
- | `EXTENSIONS` | Optional context (key-value pairs separated by dots) |
85
+ | `EXTENSIONS` | Optional context after `;`, pairs separated by `.` |
86
+
87
+ Extensions are encoded as compact pairs with no `=` (e.g. `;f4.r7` means `{ f: "4", r: "7" }`).
84
88
 
85
89
  #### Location Privacy
86
90
 
@@ -262,7 +266,7 @@ Parses a TPS string into components. Returns `null` if invalid.
262
266
 
263
267
  ```ts
264
268
  const parsed = TPS.parse(
265
- "tps://31.95,35.91,800@T:greg.m3.c1.y26.M01.d07.h13.n20;f4;r7"
269
+ "tps://31.95,35.91,800m@T:greg.m3.c1.y26.M01.d07.h13.n20;f4.r7"
266
270
  );
267
271
  // {
268
272
  // latitude: 31.95,
@@ -525,4 +529,4 @@ CREATE TABLE events (
525
529
 
526
530
  ## 📄 License
527
531
 
528
- MIT © 2026 TPS Standards Working Group
532
+ Apache-2.0 see [LICENSE](LICENSE).
package/dist/index.d.ts CHANGED
@@ -2,9 +2,15 @@
2
2
  * TPS: Temporal Positioning System
3
3
  * The Universal Protocol for Space-Time Coordinates.
4
4
  * @packageDocumentation
5
- * @version 0.4.2
6
- * @license MIT
5
+ * @version 0.5.0
6
+ * @license Apache-2.0
7
7
  * @copyright 2026 TPS Standards Working Group
8
+ *
9
+ * v0.5.0 Changes:
10
+ * - Added Actor anchor (A:) for provenance tracking
11
+ * - Added Signature (!) for cryptographic verification
12
+ * - Added structural anchors (bldg, floor, room, zone)
13
+ * - Added geospatial cell systems (S2, H3, Plus Code, what3words)
8
14
  */
9
15
  export type CalendarCode = 'greg' | 'hij' | 'jul' | 'holo' | 'unix';
10
16
  export interface TPSComponents {
@@ -21,12 +27,32 @@ export interface TPSComponents {
21
27
  latitude?: number;
22
28
  longitude?: number;
23
29
  altitude?: number;
30
+ /** Google S2 cell ID (hierarchical, prefix-searchable) */
31
+ s2Cell?: string;
32
+ /** Uber H3 cell ID (hexagonal grid) */
33
+ h3Cell?: string;
34
+ /** Open Location Code / Plus Code */
35
+ plusCode?: string;
36
+ /** what3words address (e.g. "filled.count.soap") */
37
+ what3words?: string;
38
+ /** Physical building identifier */
39
+ building?: string;
40
+ /** Vertical division (level) */
41
+ floor?: string;
42
+ /** Enclosed space identifier */
43
+ room?: string;
44
+ /** Logical area within building */
45
+ zone?: string;
24
46
  /** Technical missing data (e.g. server log without GPS) */
25
47
  isUnknownLocation?: boolean;
26
48
  /** Removed for legal/security reasons (e.g. GDPR) */
27
49
  isRedactedLocation?: boolean;
28
50
  /** Masked by user preference (e.g. "Don't show my location") */
29
51
  isHiddenLocation?: boolean;
52
+ /** Actor anchor - identifies observer/witness (e.g. "did:web:sensor.example.com", "node:gateway-01") */
53
+ actor?: string;
54
+ /** Verification hash appended to time (e.g. "sha256:8f3e2a...") */
55
+ signature?: string;
30
56
  extensions?: Record<string, string>;
31
57
  }
32
58
  /**
package/dist/index.js CHANGED
@@ -3,9 +3,15 @@
3
3
  * TPS: Temporal Positioning System
4
4
  * The Universal Protocol for Space-Time Coordinates.
5
5
  * @packageDocumentation
6
- * @version 0.4.2
7
- * @license MIT
6
+ * @version 0.5.0
7
+ * @license Apache-2.0
8
8
  * @copyright 2026 TPS Standards Working Group
9
+ *
10
+ * v0.5.0 Changes:
11
+ * - Added Actor anchor (A:) for provenance tracking
12
+ * - Added Signature (!) for cryptographic verification
13
+ * - Added structural anchors (bldg, floor, room, zone)
14
+ * - Added geospatial cell systems (S2, H3, Plus Code, what3words)
9
15
  */
10
16
  Object.defineProperty(exports, "__esModule", { value: true });
11
17
  exports.TPSUID7RB = exports.TPS = void 0;
@@ -49,24 +55,50 @@ class TPS {
49
55
  * @returns Full URI string (e.g. "tps://...").
50
56
  */
51
57
  static toURI(comp) {
52
- // 1. Build Space Part
53
- let spacePart = 'unknown'; // Default safe fallback
58
+ // 1. Build Space Part (L: anchor)
59
+ let spacePart = 'L:-'; // Default: unknown
54
60
  if (comp.isHiddenLocation) {
55
- spacePart = 'hidden';
61
+ spacePart = 'L:~';
56
62
  }
57
63
  else if (comp.isRedactedLocation) {
58
- spacePart = 'redacted';
64
+ spacePart = 'L:redacted';
59
65
  }
60
66
  else if (comp.isUnknownLocation) {
61
- spacePart = 'unknown';
67
+ spacePart = 'L:-';
68
+ }
69
+ else if (comp.s2Cell) {
70
+ spacePart = `L:s2=${comp.s2Cell}`;
71
+ }
72
+ else if (comp.h3Cell) {
73
+ spacePart = `L:h3=${comp.h3Cell}`;
74
+ }
75
+ else if (comp.plusCode) {
76
+ spacePart = `L:plus=${comp.plusCode}`;
77
+ }
78
+ else if (comp.what3words) {
79
+ spacePart = `L:w3w=${comp.what3words}`;
80
+ }
81
+ else if (comp.building) {
82
+ spacePart = `L:bldg=${comp.building}`;
83
+ if (comp.floor)
84
+ spacePart += `.floor=${comp.floor}`;
85
+ if (comp.room)
86
+ spacePart += `.room=${comp.room}`;
87
+ if (comp.zone)
88
+ spacePart += `.zone=${comp.zone}`;
62
89
  }
63
90
  else if (comp.latitude !== undefined && comp.longitude !== undefined) {
64
- spacePart = `${comp.latitude},${comp.longitude}`;
91
+ spacePart = `L:${comp.latitude},${comp.longitude}`;
65
92
  if (comp.altitude !== undefined) {
66
93
  spacePart += `,${comp.altitude}m`;
67
94
  }
68
95
  }
69
- // 2. Build Time Part
96
+ // 2. Build Actor Part (A: anchor) - optional
97
+ let actorPart = '';
98
+ if (comp.actor) {
99
+ actorPart = `/A:${comp.actor}`;
100
+ }
101
+ // 3. Build Time Part
70
102
  let timePart = `T:${comp.calendar}`;
71
103
  if (comp.calendar === 'unix' && comp.unixSeconds !== undefined) {
72
104
  timePart += `.s${comp.unixSeconds}`;
@@ -89,13 +121,17 @@ class TPS {
89
121
  if (comp.second !== undefined)
90
122
  timePart += `.s${this.pad(comp.second)}`;
91
123
  }
92
- // 3. Build Extensions
124
+ // 4. Add Signature (!) - optional
125
+ if (comp.signature) {
126
+ timePart += `!${comp.signature}`;
127
+ }
128
+ // 5. Build Extensions
93
129
  let extPart = '';
94
130
  if (comp.extensions && Object.keys(comp.extensions).length > 0) {
95
- const extStrings = Object.entries(comp.extensions).map(([k, v]) => `${k}${v}`);
131
+ const extStrings = Object.entries(comp.extensions).map(([k, v]) => `${k}=${v}`);
96
132
  extPart = `;${extStrings.join('.')}`;
97
133
  }
98
- return `tps://${spacePart}@${timePart}${extPart}`;
134
+ return `tps://${spacePart}${actorPart}/${timePart}${extPart}`;
99
135
  }
100
136
  /**
101
137
  * CONVERTER: Creates a TPS Time Object string from a JavaScript Date.
@@ -290,14 +326,50 @@ class TPS {
290
326
  if (g.second)
291
327
  components.second = parseFloat(g.second);
292
328
  }
329
+ // Signature Mapping
330
+ if (g.signature) {
331
+ components.signature = g.signature;
332
+ }
333
+ // Actor Mapping
334
+ if (g.actor) {
335
+ components.actor = g.actor;
336
+ }
293
337
  // Space Mapping
294
338
  if (g.space) {
295
- if (g.space === 'unknown')
339
+ // Privacy markers
340
+ if (g.space === 'unknown' || g.space === '-') {
296
341
  components.isUnknownLocation = true;
297
- else if (g.space === 'redacted')
342
+ }
343
+ else if (g.space === 'redacted') {
298
344
  components.isRedactedLocation = true;
299
- else if (g.space === 'hidden')
345
+ }
346
+ else if (g.space === 'hidden' || g.space === '~') {
300
347
  components.isHiddenLocation = true;
348
+ }
349
+ // Geospatial cells
350
+ else if (g.s2) {
351
+ components.s2Cell = g.s2;
352
+ }
353
+ else if (g.h3) {
354
+ components.h3Cell = g.h3;
355
+ }
356
+ else if (g.plus) {
357
+ components.plusCode = g.plus;
358
+ }
359
+ else if (g.w3w) {
360
+ components.what3words = g.w3w;
361
+ }
362
+ // Structural anchors
363
+ else if (g.bldg) {
364
+ components.building = g.bldg;
365
+ if (g.floor)
366
+ components.floor = g.floor;
367
+ if (g.room)
368
+ components.room = g.room;
369
+ if (g.zone)
370
+ components.zone = g.zone;
371
+ }
372
+ // GPS coordinates
301
373
  else {
302
374
  if (g.lat)
303
375
  components.latitude = parseFloat(g.lat);
@@ -312,10 +384,20 @@ class TPS {
312
384
  const extObj = {};
313
385
  const parts = g.extensions.split('.');
314
386
  parts.forEach((p) => {
315
- const key = p.charAt(0);
316
- const val = p.substring(1);
317
- if (key && val)
318
- extObj[key] = val;
387
+ const eqIdx = p.indexOf('=');
388
+ if (eqIdx > 0) {
389
+ const key = p.substring(0, eqIdx);
390
+ const val = p.substring(eqIdx + 1);
391
+ if (key && val)
392
+ extObj[key] = val;
393
+ }
394
+ else {
395
+ // Legacy format: first char is key
396
+ const key = p.charAt(0);
397
+ const val = p.substring(1);
398
+ if (key && val)
399
+ extObj[key] = val;
400
+ }
319
401
  });
320
402
  components.extensions = extObj;
321
403
  }
@@ -330,8 +412,36 @@ exports.TPS = TPS;
330
412
  // --- PLUGIN REGISTRY ---
331
413
  TPS.drivers = new Map();
332
414
  // --- REGEX ---
333
- TPS.REGEX_URI = new RegExp('^tps://(?<space>unknown|redacted|hidden|(?<lat>-?\\d+(?:\\.\\d+)?),(?<lon>-?\\d+(?:\\.\\d+)?)(?:,(?<alt>-?\\d+(?:\\.\\d+)?)m?)?)@T:(?<calendar>[a-z]{3,4})\\.(?:(?<unix>s\\d+(?:\\.\\d+)?)|m(?<millennium>-?\\d+)(?:\\.c(?<century>\\d+)(?:\\.y(?<year>\\d+)(?:\\.M(?<month>\\d{1,2})(?:\\.d(?<day>\\d{1,2})(?:\\.h(?<hour>\\d{1,2})(?:\\.n(?<minute>\\d{1,2})(?:\\.s(?<second>\\d{1,2}(?:\\.\\d+)?))?)?)?)?)?)?)?)?(?:;(?<extensions>[a-z0-9\\.\\-\\_]+))?$');
334
- TPS.REGEX_TIME = new RegExp('^T:(?<calendar>[a-z]{3,4})\\.(?:(?<unix>s\\d+(?:\\.\\d+)?)|m(?<millennium>-?\\d+)(?:\\.c(?<century>\\d+)(?:\\.y(?<year>\\d+)(?:\\.M(?<month>\\d{1,2})(?:\\.d(?<day>\\d{1,2})(?:\\.h(?<hour>\\d{1,2})(?:\\.n(?<minute>\\d{1,2})(?:\\.s(?<second>\\d{1,2}(?:\\.\\d+)?))?)?)?)?)?)?)?)?$');
415
+ // Updated for v0.5.0: supports L: anchors, A: actor, ! signature, structural & geospatial anchors
416
+ // Note: Complex regex - carefully balanced parentheses
417
+ TPS.REGEX_URI = new RegExp('^tps://' +
418
+ // Location part (L: prefix optional for backward compat)
419
+ '(?:L:)?(?<space>' +
420
+ '~|-|unknown|redacted|hidden|' + // Privacy markers
421
+ 's2=(?<s2>[a-fA-F0-9]+)|' + // S2 cell
422
+ 'h3=(?<h3>[a-fA-F0-9]+)|' + // H3 cell
423
+ 'plus=(?<plus>[A-Z0-9+]+)|' + // Plus Code
424
+ 'w3w=(?<w3w>[a-z]+\\.[a-z]+\\.[a-z]+)|' + // what3words
425
+ 'bldg=(?<bldg>[\\w-]+)(?:\\.floor=(?<floor>[\\w-]+))?(?:\\.room=(?<room>[\\w-]+))?(?:\\.zone=(?<zone>[\\w-]+))?|' + // Structural
426
+ '(?<lat>-?\\d+(?:\\.\\d+)?),(?<lon>-?\\d+(?:\\.\\d+)?)(?:,(?<alt>-?\\d+(?:\\.\\d+)?)m?)?' + // GPS
427
+ ')' +
428
+ // Optional Actor anchor
429
+ '(?:/A:(?<actor>[^/@]+))?' +
430
+ // Time part separator
431
+ '[/@]T:(?<calendar>[a-z]{3,4})\\.' +
432
+ // Time components
433
+ '(?:(?<unix>s\\d+(?:\\.\\d+)?)|m(?<millennium>-?\\d+)(?:\\.c(?<century>\\d+)(?:\\.y(?<year>\\d+)(?:\\.M(?<month>\\d{1,2})(?:\\.d(?<day>\\d{1,2})(?:\\.h(?<hour>\\d{1,2})(?:\\.n(?<minute>\\d{1,2})(?:\\.s(?<second>\\d{1,2}(?:\\.\\d+)?))?)?)?)?)?)?)?)' +
434
+ // Optional signature
435
+ '(?:!(?<signature>[^;?#]+))?' +
436
+ // Optional extensions
437
+ '(?:;(?<extensions>[a-z0-9.\\-_=]+))?' +
438
+ // Optional query params
439
+ '(?:\\?(?<params>[^#]+))?' +
440
+ // Optional context
441
+ '(?:#(?<context>.+))?$');
442
+ TPS.REGEX_TIME = new RegExp('^T:(?<calendar>[a-z]{3,4})\\.' +
443
+ '(?:(?<unix>s\\d+(?:\\.\\d+)?)|m(?<millennium>-?\\d+)(?:\\.c(?<century>\\d+)(?:\\.y(?<year>\\d+)(?:\\.M(?<month>\\d{1,2})(?:\\.d(?<day>\\d{1,2})(?:\\.h(?<hour>\\d{1,2})(?:\\.n(?<minute>\\d{1,2})(?:\\.s(?<second>\\d{1,2}(?:\\.\\d+)?))?)?)?)?)?)?)?)' +
444
+ '(?:!(?<signature>[^;?#]+))?$');
335
445
  /**
336
446
  * TPS-UID v1 — Temporal Positioning System Identifier (Binary Reversible)
337
447
  *
@@ -891,7 +1001,7 @@ class TPSUID7RB {
891
1001
  keyObj = crypto.createPrivateKey({
892
1002
  key: Buffer.from(privateKey),
893
1003
  format: 'der', // or 'pem' - strict.
894
- type: 'pkcs8'
1004
+ type: 'pkcs8',
895
1005
  });
896
1006
  // Actually, simpler: construct key object from raw bytes if possible?
897
1007
  // Node's crypto is strict. Let's try the simplest:
@@ -903,7 +1013,11 @@ class TPSUID7RB {
903
1013
  // and assume the user provides a VALID key object or compatible format (PEM/DER).
904
1014
  // Handling RAW Ed25519 keys in Node requires specific 'crypto.createPrivateKey' with 'raw' format (Node 11.6+).
905
1015
  const key = typeof privateKey === 'string' && !privateKey.includes('PRIVATE KEY')
906
- ? crypto.createPrivateKey({ key: Buffer.from(privateKey, 'hex'), format: 'pem', type: 'pkcs8' }) // Fallback guess
1016
+ ? crypto.createPrivateKey({
1017
+ key: Buffer.from(privateKey, 'hex'),
1018
+ format: 'pem',
1019
+ type: 'pkcs8',
1020
+ }) // Fallback guess
907
1021
  : privateKey;
908
1022
  // Note: Raw Ed25519 key support in Node.js 'crypto' acts via 'generateKeyPair' or KeyObject.
909
1023
  // Direct raw signing is via crypto.sign(null, data, key).