tigertag 1.0.5 → 1.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.
- package/CHANGELOG.md +43 -0
- package/LICENSE +202 -0
- package/README.md +15 -5
- package/bin/tigertag.js +18 -5
- package/database/id_brand.json +887 -1
- package/database/id_material.json +2325 -1
- package/database/last_update.json +1 -1
- package/package.json +2 -2
- package/src/db.js +18 -5
- package/src/index.js +18 -5
- package/src/signature.js +18 -5
- package/src/tag.js +62 -19
- package/LICENSE.md +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"versions":1763073059935,"types":1777884684291,"brands":
|
|
1
|
+
{"versions":1763073059935,"types":1777884684291,"brands":1782652927786,"filament_diameters":1777895560487,"filament_materials":1781878743554,"aspects":1779219283884,"measure_units":1777896731691}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tigertag",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "JavaScript SDK for TigerTag RFID material identification",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"electron"
|
|
33
33
|
],
|
|
34
34
|
"author": "TigerTag <tigertag@tigertag.io> (https://tigertag.io)",
|
|
35
|
-
"license": "
|
|
35
|
+
"license": "Apache-2.0",
|
|
36
36
|
"homepage": "https://tigertag.io",
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
package/src/db.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
// Copyright (C) 2025 TigerTag
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
4
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// TigerTag SDK
|
|
6
|
+
// Copyright (c) 2025-2026 TigerTag Corp.
|
|
7
|
+
//
|
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
// you may not use this file except in compliance with the License.
|
|
10
|
+
// You may obtain a copy of the License at
|
|
11
|
+
//
|
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// See the License for the specific language governing permissions and
|
|
18
|
+
// limitations under the License.
|
|
19
|
+
//
|
|
20
|
+
// Implementing the TigerTag protocol requires no licence and no payment.
|
|
21
|
+
// https://github.com/TigerTag-Project/TigerTag-RFID-Guide/blob/main/LICENSING.md
|
|
9
22
|
|
|
10
23
|
/**
|
|
11
24
|
* TigerTag reference database loader and sync utilities.
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
// Copyright (C) 2025 TigerTag
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
4
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// TigerTag SDK
|
|
6
|
+
// Copyright (c) 2025-2026 TigerTag Corp.
|
|
7
|
+
//
|
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
// you may not use this file except in compliance with the License.
|
|
10
|
+
// You may obtain a copy of the License at
|
|
11
|
+
//
|
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// See the License for the specific language governing permissions and
|
|
18
|
+
// limitations under the License.
|
|
19
|
+
//
|
|
20
|
+
// Implementing the TigerTag protocol requires no licence and no payment.
|
|
21
|
+
// https://github.com/TigerTag-Project/TigerTag-RFID-Guide/blob/main/LICENSING.md
|
|
9
22
|
|
|
10
23
|
/**
|
|
11
24
|
* tigertag — JavaScript SDK for TigerTag RFID material identification.
|
package/src/signature.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
// Copyright (C) 2025 TigerTag
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
4
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// TigerTag SDK
|
|
6
|
+
// Copyright (c) 2025-2026 TigerTag Corp.
|
|
7
|
+
//
|
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
// you may not use this file except in compliance with the License.
|
|
10
|
+
// You may obtain a copy of the License at
|
|
11
|
+
//
|
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// See the License for the specific language governing permissions and
|
|
18
|
+
// limitations under the License.
|
|
19
|
+
//
|
|
20
|
+
// Implementing the TigerTag protocol requires no licence and no payment.
|
|
21
|
+
// https://github.com/TigerTag-Project/TigerTag-RFID-Guide/blob/main/LICENSING.md
|
|
9
22
|
|
|
10
23
|
/**
|
|
11
24
|
* ECDSA-P256 signature verification for TigerTag chips.
|
package/src/tag.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
// Copyright (C) 2025 TigerTag
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
4
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// TigerTag SDK
|
|
6
|
+
// Copyright (c) 2025-2026 TigerTag Corp.
|
|
7
|
+
//
|
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
// you may not use this file except in compliance with the License.
|
|
10
|
+
// You may obtain a copy of the License at
|
|
11
|
+
//
|
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// See the License for the specific language governing permissions and
|
|
18
|
+
// limitations under the License.
|
|
19
|
+
//
|
|
20
|
+
// Implementing the TigerTag protocol requires no licence and no payment.
|
|
21
|
+
// https://github.com/TigerTag-Project/TigerTag-RFID-Guide/blob/main/LICENSING.md
|
|
9
22
|
|
|
10
23
|
/**
|
|
11
24
|
* TigerTag class — binary parsing, serialization, CRUD, and cloud sync.
|
|
@@ -424,17 +437,17 @@ class TigerTag {
|
|
|
424
437
|
static create({
|
|
425
438
|
productId = MAKER_PRODUCT_ID,
|
|
426
439
|
uid = null,
|
|
427
|
-
idMaterial =
|
|
428
|
-
idAspect1 =
|
|
440
|
+
idMaterial = undefined, // required
|
|
441
|
+
idAspect1 = undefined, // required
|
|
429
442
|
idAspect2 = 0,
|
|
430
|
-
idType =
|
|
443
|
+
idType = undefined, // required
|
|
431
444
|
idDiameter = 0,
|
|
432
|
-
idBrand =
|
|
433
|
-
color1R =
|
|
445
|
+
idBrand = undefined, // required
|
|
446
|
+
color1R = undefined, color1G = undefined, color1B = undefined, color1A = undefined, // required
|
|
434
447
|
color2R = 0, color2G = 0, color2B = 0,
|
|
435
448
|
color3R = 0, color3G = 0, color3B = 0,
|
|
436
|
-
measure =
|
|
437
|
-
idUnit =
|
|
449
|
+
measure = undefined, // required
|
|
450
|
+
idUnit = undefined, // required
|
|
438
451
|
nozzleTempMin = 0,
|
|
439
452
|
nozzleTempMax = 0,
|
|
440
453
|
dryTemp = 0,
|
|
@@ -455,6 +468,24 @@ class TigerTag {
|
|
|
455
468
|
productId = MAKER_PRODUCT_ID;
|
|
456
469
|
}
|
|
457
470
|
|
|
471
|
+
// ── Required field validation ────────────────────────────────────────────
|
|
472
|
+
// Check presence only — any value (including 0) is accepted once provided.
|
|
473
|
+
const _missing = [];
|
|
474
|
+
if (idMaterial === undefined) _missing.push('idMaterial');
|
|
475
|
+
if (idAspect1 === undefined) _missing.push('idAspect1');
|
|
476
|
+
if (idType === undefined) _missing.push('idType');
|
|
477
|
+
if (idBrand === undefined) _missing.push('idBrand');
|
|
478
|
+
if (measure === undefined) _missing.push('measure');
|
|
479
|
+
if (idUnit === undefined) _missing.push('idUnit');
|
|
480
|
+
if (color1R === undefined) _missing.push('color1R');
|
|
481
|
+
if (color1G === undefined) _missing.push('color1G');
|
|
482
|
+
if (color1B === undefined) _missing.push('color1B');
|
|
483
|
+
if (color1A === undefined) _missing.push('color1A');
|
|
484
|
+
if (_missing.length > 0) {
|
|
485
|
+
throw new Error(
|
|
486
|
+
`TigerTag.create() — missing required field(s): ${_missing.join(', ')}`
|
|
487
|
+
);
|
|
488
|
+
}
|
|
458
489
|
if (timestamp == null) {
|
|
459
490
|
timestamp = Math.max(0, Math.floor((Date.now() - _TIGERTAG_EPOCH_MS) / 1000));
|
|
460
491
|
}
|
|
@@ -1007,7 +1038,9 @@ class TigerTag {
|
|
|
1007
1038
|
};
|
|
1008
1039
|
}
|
|
1009
1040
|
|
|
1010
|
-
return
|
|
1041
|
+
// Unknown unit — no conversion available; return zero base-unit fields so
|
|
1042
|
+
// consumers always get a defined, safe value instead of undefined/garbage.
|
|
1043
|
+
return { measure_gr: 0, measure_available_gr: 0 };
|
|
1011
1044
|
}
|
|
1012
1045
|
|
|
1013
1046
|
/**
|
|
@@ -1016,6 +1049,14 @@ class TigerTag {
|
|
|
1016
1049
|
* @returns {object}
|
|
1017
1050
|
*/
|
|
1018
1051
|
toRawDict() {
|
|
1052
|
+
// Active color count: aspect2 takes priority for multi-color modes
|
|
1053
|
+
// (Bicolor → 2, Tricolor/Rainbow → 3). Falls back to aspect1 (Basic → 1).
|
|
1054
|
+
const _db = this.db;
|
|
1055
|
+
const _a2cc = (_db.aspect(this.idAspect2) || {}).color_count || 0;
|
|
1056
|
+
const _a1cc = (_db.aspect(this.idAspect1) || {}).color_count || 1;
|
|
1057
|
+
const numColors = _a2cc > 0 ? _a2cc : _a1cc;
|
|
1058
|
+
const colorList = [this.color1Hex, this.color2Hex, this.color3Hex].slice(0, numColors);
|
|
1059
|
+
|
|
1019
1060
|
return {
|
|
1020
1061
|
id_tigertag: this.idTigertag,
|
|
1021
1062
|
id_product: this.idProduct,
|
|
@@ -1038,16 +1079,18 @@ class TigerTag {
|
|
|
1038
1079
|
bed_min: this.bedTempMin,
|
|
1039
1080
|
bed_max: this.bedTempMax,
|
|
1040
1081
|
timestamp: this.timestamp,
|
|
1041
|
-
color_r2: this.color2R,
|
|
1042
|
-
color_g2: this.color2G,
|
|
1043
|
-
color_b2: this.color2B,
|
|
1044
|
-
color_r3: this.color3R,
|
|
1045
|
-
color_g3: this.color3G,
|
|
1046
|
-
color_b3: this.color3B,
|
|
1082
|
+
color_r2: numColors >= 2 ? this.color2R : 0,
|
|
1083
|
+
color_g2: numColors >= 2 ? this.color2G : 0,
|
|
1084
|
+
color_b2: numColors >= 2 ? this.color2B : 0,
|
|
1085
|
+
color_r3: numColors >= 3 ? this.color3R : 0,
|
|
1086
|
+
color_g3: numColors >= 3 ? this.color3G : 0,
|
|
1087
|
+
color_b3: numColors >= 3 ? this.color3B : 0,
|
|
1047
1088
|
td_raw: this.tdRaw,
|
|
1048
1089
|
message: this.customMessage,
|
|
1049
1090
|
measure_available: this.measureAvailable,
|
|
1050
1091
|
...TigerTag._baseUnitFields(this.measure, this.measureAvailable, this.idUnit),
|
|
1092
|
+
num_colors: numColors,
|
|
1093
|
+
color_list: colorList,
|
|
1051
1094
|
uid: this.uidHex,
|
|
1052
1095
|
product_page_url: this.productPageUrl,
|
|
1053
1096
|
api_url: this.apiUrl,
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# GNU General Public License v3.0
|
|
2
|
-
|
|
3
|
-
TigerTag JavaScript SDK
|
|
4
|
-
Copyright (C) 2025 TigerTag
|
|
5
|
-
|
|
6
|
-
This program is free software: you can redistribute it and/or modify
|
|
7
|
-
it under the terms of the GNU General Public License as published by
|
|
8
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
(at your option) any later version.
|
|
10
|
-
|
|
11
|
-
This program is distributed in the hope that it will be useful,
|
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
GNU General Public License for more details.
|
|
15
|
-
|
|
16
|
-
You should have received a copy of the GNU General Public License
|
|
17
|
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
For commercial OEM licensing inquiries, contact: licensing@tigertag.io
|