@altronix/webtobin 0.7.0 → 0.8.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/package.json +1 -1
- package/webtobin.d.ts +6 -0
- package/webtobin.mjs +10 -3
package/package.json
CHANGED
package/webtobin.d.ts
CHANGED
|
@@ -22,7 +22,10 @@ export interface McubootTlv {
|
|
|
22
22
|
|
|
23
23
|
export interface McubootImage {
|
|
24
24
|
header: McubootHeader;
|
|
25
|
+
/** Inner firmware data only */
|
|
25
26
|
image: Uint8Array;
|
|
27
|
+
/** Full MCUboot signed image (header + data + TLVs) */
|
|
28
|
+
signedImage: Uint8Array;
|
|
26
29
|
protectedTlvs: McubootTlv[];
|
|
27
30
|
tlvs: McubootTlv[];
|
|
28
31
|
}
|
|
@@ -36,7 +39,10 @@ export class AltronixImage {
|
|
|
36
39
|
static fromMcubootImage(img: McubootImage): AltronixImage;
|
|
37
40
|
readTlv(type: number): Uint8Array | null;
|
|
38
41
|
get header(): McubootHeader;
|
|
42
|
+
/** Inner firmware data only */
|
|
39
43
|
get image(): Uint8Array;
|
|
44
|
+
/** Full MCUboot signed image (header + data + TLVs) */
|
|
45
|
+
get signedImage(): Uint8Array;
|
|
40
46
|
get version(): McubootVersion;
|
|
41
47
|
}
|
|
42
48
|
|
package/webtobin.mjs
CHANGED
|
@@ -32,7 +32,8 @@ const TLV_PROT_INFO_MAGIC = 0x6908;
|
|
|
32
32
|
/**
|
|
33
33
|
* @typedef {Object} McubootImage
|
|
34
34
|
* @property {McubootHeader} header
|
|
35
|
-
* @property {Uint8Array} image
|
|
35
|
+
* @property {Uint8Array} image - Inner firmware data only
|
|
36
|
+
* @property {Uint8Array} signedImage - Full MCUboot signed image (header + data + TLVs)
|
|
36
37
|
* @property {McubootTlv[]} protectedTlvs
|
|
37
38
|
* @property {McubootTlv[]} tlvs
|
|
38
39
|
*/
|
|
@@ -80,7 +81,8 @@ export function parseMcubootImages(bin) {
|
|
|
80
81
|
tlvOffset += tlvSize;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
const signedImage = new Uint8Array(buf.slice(offset, tlvOffset));
|
|
85
|
+
images.push({ header, image, signedImage, protectedTlvs, tlvs });
|
|
84
86
|
offset = tlvOffset;
|
|
85
87
|
}
|
|
86
88
|
|
|
@@ -198,11 +200,16 @@ export class AltronixImage {
|
|
|
198
200
|
return this.#mcuboot.header;
|
|
199
201
|
}
|
|
200
202
|
|
|
201
|
-
/** @returns {Uint8Array} */
|
|
203
|
+
/** @returns {Uint8Array} Inner firmware data only */
|
|
202
204
|
get image() {
|
|
203
205
|
return this.#mcuboot.image;
|
|
204
206
|
}
|
|
205
207
|
|
|
208
|
+
/** @returns {Uint8Array} Full MCUboot signed image (header + data + TLVs) */
|
|
209
|
+
get signedImage() {
|
|
210
|
+
return this.#mcuboot.signedImage;
|
|
211
|
+
}
|
|
212
|
+
|
|
206
213
|
/** @returns {McubootVersion} */
|
|
207
214
|
get version() {
|
|
208
215
|
return this.#mcuboot.header.version;
|