@scalebun/cli 1.13.0 → 2.0.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/lib/commands/doctor.d.ts.map +1 -1
- package/lib/commands/doctor.js +48 -9
- package/lib/commands/doctor.js.map +1 -1
- package/lib/commands/ota-bundle.d.ts.map +1 -1
- package/lib/commands/ota-bundle.js +8 -14
- package/lib/commands/ota-bundle.js.map +1 -1
- package/lib/commands/ota-keys.d.ts +29 -30
- package/lib/commands/ota-keys.d.ts.map +1 -1
- package/lib/commands/ota-keys.js +372 -267
- package/lib/commands/ota-keys.js.map +1 -1
- package/lib/commands/ota-publish.d.ts.map +1 -1
- package/lib/commands/ota-publish.js +67 -10
- package/lib/commands/ota-publish.js.map +1 -1
- package/lib/commands/quickstart.d.ts.map +1 -1
- package/lib/commands/quickstart.js +20 -17
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/utils/signing.d.ts +70 -0
- package/lib/utils/signing.d.ts.map +1 -0
- package/lib/utils/signing.js +171 -0
- package/lib/utils/signing.js.map +1 -0
- package/lib/vendor/ota-protocol/base64.d.ts +11 -0
- package/lib/vendor/ota-protocol/base64.d.ts.map +1 -0
- package/lib/vendor/ota-protocol/base64.js +39 -0
- package/lib/vendor/ota-protocol/base64.js.map +1 -0
- package/lib/vendor/ota-protocol/codec.d.ts +26 -0
- package/lib/vendor/ota-protocol/codec.d.ts.map +1 -0
- package/lib/vendor/ota-protocol/codec.js +349 -0
- package/lib/vendor/ota-protocol/codec.js.map +1 -0
- package/lib/vendor/ota-protocol/hex.d.ts +8 -0
- package/lib/vendor/ota-protocol/hex.d.ts.map +1 -0
- package/lib/vendor/ota-protocol/hex.js +31 -0
- package/lib/vendor/ota-protocol/hex.js.map +1 -0
- package/lib/vendor/ota-protocol/index.d.ts +17 -0
- package/lib/vendor/ota-protocol/index.d.ts.map +1 -0
- package/lib/vendor/ota-protocol/index.js +41 -0
- package/lib/vendor/ota-protocol/index.js.map +1 -0
- package/lib/vendor/ota-protocol/limits.d.ts +39 -0
- package/lib/vendor/ota-protocol/limits.d.ts.map +1 -0
- package/lib/vendor/ota-protocol/limits.js +42 -0
- package/lib/vendor/ota-protocol/limits.js.map +1 -0
- package/lib/vendor/ota-protocol/types.d.ts +73 -0
- package/lib/vendor/ota-protocol/types.d.ts.map +1 -0
- package/lib/vendor/ota-protocol/types.js +24 -0
- package/lib/vendor/ota-protocol/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Strict lowercase-hex helpers (no `0x`, even length, exact alphabet). */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.bytesToHex = bytesToHex;
|
|
5
|
+
exports.hexToBytes = hexToBytes;
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
function bytesToHex(bytes) {
|
|
8
|
+
let out = '';
|
|
9
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
10
|
+
out += bytes[i].toString(16).padStart(2, '0');
|
|
11
|
+
}
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse hex to bytes, rejecting anything that is not canonical lowercase-or-mixed
|
|
16
|
+
* hex of even length. `expectedLen`, when given, pins the output byte count.
|
|
17
|
+
*/
|
|
18
|
+
function hexToBytes(hex, expectedLen) {
|
|
19
|
+
if (typeof hex !== 'string' || hex.length % 2 !== 0 || !/^[0-9a-fA-F]*$/.test(hex)) {
|
|
20
|
+
throw new types_1.OtaProtocolError('INVALID_SIGNED_PAYLOAD', 'malformed hex string');
|
|
21
|
+
}
|
|
22
|
+
const out = new Uint8Array(hex.length / 2);
|
|
23
|
+
for (let i = 0; i < out.length; i++) {
|
|
24
|
+
out[i] = parseInt(hex.substr(i * 2, 2), 16);
|
|
25
|
+
}
|
|
26
|
+
if (expectedLen !== undefined && out.length !== expectedLen) {
|
|
27
|
+
throw new types_1.OtaProtocolError('INVALID_SIGNED_PAYLOAD', `expected ${expectedLen} bytes of hex, got ${out.length}`);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=hex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.js","sourceRoot":"","sources":["../../../src/vendor/ota-protocol/hex.ts"],"names":[],"mappings":";AAAA,2EAA2E;;AAI3E,gCAMC;AAMD,gCAeC;AA7BD,mCAA2C;AAE3C,SAAgB,UAAU,CAAC,KAAiB;IAC1C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,GAAW,EAAE,WAAoB;IAC1D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnF,MAAM,IAAI,wBAAgB,CAAC,wBAAwB,EAAE,sBAAsB,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,WAAW,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QAC5D,MAAM,IAAI,wBAAgB,CACxB,wBAAwB,EACxB,YAAY,WAAW,sBAAsB,GAAG,CAAC,MAAM,EAAE,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/ota-protocol — the SB-OTA-RSA-SHA256-V1 signed-release codec.
|
|
3
|
+
*
|
|
4
|
+
* Dependency-free reference implementation of the binary payload format, its
|
|
5
|
+
* limits, the transport-envelope + failure-code types, and strict hex/base64
|
|
6
|
+
* helpers. The Android (Kotlin) and iOS (Swift) verifiers and the backend
|
|
7
|
+
* signer/verifier mirror this module byte-for-byte; the fixtures under
|
|
8
|
+
* `fixtures/` are the shared conformance oracle.
|
|
9
|
+
*
|
|
10
|
+
* See docs/ota/SB-OTA-RSA-SHA256-V1.md.
|
|
11
|
+
*/
|
|
12
|
+
export * from './limits';
|
|
13
|
+
export * from './types';
|
|
14
|
+
export { serializeSignedRelease, parseSignedRelease, peekKeyId } from './codec';
|
|
15
|
+
export { bytesToHex, hexToBytes } from './hex';
|
|
16
|
+
export { encodeBase64, decodeBase64Strict } from './base64';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vendor/ota-protocol/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @scalebun/ota-protocol — the SB-OTA-RSA-SHA256-V1 signed-release codec.
|
|
4
|
+
*
|
|
5
|
+
* Dependency-free reference implementation of the binary payload format, its
|
|
6
|
+
* limits, the transport-envelope + failure-code types, and strict hex/base64
|
|
7
|
+
* helpers. The Android (Kotlin) and iOS (Swift) verifiers and the backend
|
|
8
|
+
* signer/verifier mirror this module byte-for-byte; the fixtures under
|
|
9
|
+
* `fixtures/` are the shared conformance oracle.
|
|
10
|
+
*
|
|
11
|
+
* See docs/ota/SB-OTA-RSA-SHA256-V1.md.
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.decodeBase64Strict = exports.encodeBase64 = exports.hexToBytes = exports.bytesToHex = exports.peekKeyId = exports.parseSignedRelease = exports.serializeSignedRelease = void 0;
|
|
29
|
+
__exportStar(require("./limits"), exports);
|
|
30
|
+
__exportStar(require("./types"), exports);
|
|
31
|
+
var codec_1 = require("./codec");
|
|
32
|
+
Object.defineProperty(exports, "serializeSignedRelease", { enumerable: true, get: function () { return codec_1.serializeSignedRelease; } });
|
|
33
|
+
Object.defineProperty(exports, "parseSignedRelease", { enumerable: true, get: function () { return codec_1.parseSignedRelease; } });
|
|
34
|
+
Object.defineProperty(exports, "peekKeyId", { enumerable: true, get: function () { return codec_1.peekKeyId; } });
|
|
35
|
+
var hex_1 = require("./hex");
|
|
36
|
+
Object.defineProperty(exports, "bytesToHex", { enumerable: true, get: function () { return hex_1.bytesToHex; } });
|
|
37
|
+
Object.defineProperty(exports, "hexToBytes", { enumerable: true, get: function () { return hex_1.hexToBytes; } });
|
|
38
|
+
var base64_1 = require("./base64");
|
|
39
|
+
Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return base64_1.encodeBase64; } });
|
|
40
|
+
Object.defineProperty(exports, "decodeBase64Strict", { enumerable: true, get: function () { return base64_1.decodeBase64Strict; } });
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/vendor/ota-protocol/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,0CAAwB;AACxB,iCAAgF;AAAvE,+GAAA,sBAAsB,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,kGAAA,SAAS,OAAA;AAC9D,6BAA+C;AAAtC,iGAAA,UAAU,OAAA;AAAE,iGAAA,UAAU,OAAA;AAC/B,mCAA4D;AAAnD,sGAAA,YAAY,OAAA;AAAE,4GAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explicit protocol limits for SB-OTA-RSA-SHA256-V1.
|
|
3
|
+
*
|
|
4
|
+
* These are part of the wire contract: the Kotlin and Swift verifiers and the
|
|
5
|
+
* backend signer/verifier MUST use the identical values. Changing any of them is
|
|
6
|
+
* a protocol change. See docs/ota/SB-OTA-RSA-SHA256-V1.md §3.4.
|
|
7
|
+
*/
|
|
8
|
+
/** 8-byte ASCII magic that opens every signed payload. */
|
|
9
|
+
export declare const MAGIC = "SBOTA001";
|
|
10
|
+
/** Raw bytes of {@link MAGIC}. */
|
|
11
|
+
export declare const MAGIC_BYTES: Uint8Array<ArrayBuffer>;
|
|
12
|
+
/** The only schema version this codec accepts. */
|
|
13
|
+
export declare const SCHEMA_VERSION = 1;
|
|
14
|
+
/** Canonical algorithm identifiers (also the values carried in the payload). */
|
|
15
|
+
export declare const SIGNATURE_ALGORITHM = "SB-OTA-RSA-SHA256-V1";
|
|
16
|
+
export declare const HASH_ALGORITHM = "SHA-256";
|
|
17
|
+
/** Whole binary payload must fit in this many bytes (before/after base64). */
|
|
18
|
+
export declare const MAX_SIGNED_PAYLOAD_BYTES = 8192;
|
|
19
|
+
/** RSA signature bytes (RSA-3072 = 384 bytes; headroom for larger moduli). */
|
|
20
|
+
export declare const MAX_SIGNATURE_BYTES = 1024;
|
|
21
|
+
/** Transport envelope JSON size cap, enforced before decoding. */
|
|
22
|
+
export declare const MAX_ENVELOPE_JSON_BYTES = 65536;
|
|
23
|
+
/** Each individual length-prefixed UTF-8 string field. */
|
|
24
|
+
export declare const MAX_STRING_FIELD_BYTES = 256;
|
|
25
|
+
/** SHA-256 digest length. */
|
|
26
|
+
export declare const SHA256_LEN = 32;
|
|
27
|
+
/** RSA modulus policy. */
|
|
28
|
+
export declare const MIN_RSA_MODULUS_BITS = 2048;
|
|
29
|
+
export declare const RECOMMENDED_RSA_MODULUS_BITS = 3072;
|
|
30
|
+
/**
|
|
31
|
+
* uint64 values above this are rejected — JavaScript cannot represent them
|
|
32
|
+
* losslessly as a Number, and the native mirrors treat the same ceiling as the
|
|
33
|
+
* safe range so a payload that parses in one place parses everywhere.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MAX_SAFE_UINT64: number;
|
|
36
|
+
/** Allowed enum values. */
|
|
37
|
+
export declare const PLATFORMS: readonly ["android", "ios"];
|
|
38
|
+
export declare const ARTIFACT_TYPES: readonly ["full", "patch"];
|
|
39
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/vendor/ota-protocol/limits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,KAAK,aAAa,CAAC;AAChC,kCAAkC;AAClC,eAAO,MAAM,WAAW,yBAEvB,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAC1D,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,kEAAkE;AAClE,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAC7C,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,6BAA6B;AAC7B,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,0BAA0B;AAC1B,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAA0B,CAAC;AAEvD,2BAA2B;AAC3B,eAAO,MAAM,SAAS,6BAA8B,CAAC;AACrD,eAAO,MAAM,cAAc,4BAA6B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Explicit protocol limits for SB-OTA-RSA-SHA256-V1.
|
|
4
|
+
*
|
|
5
|
+
* These are part of the wire contract: the Kotlin and Swift verifiers and the
|
|
6
|
+
* backend signer/verifier MUST use the identical values. Changing any of them is
|
|
7
|
+
* a protocol change. See docs/ota/SB-OTA-RSA-SHA256-V1.md §3.4.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ARTIFACT_TYPES = exports.PLATFORMS = exports.MAX_SAFE_UINT64 = exports.RECOMMENDED_RSA_MODULUS_BITS = exports.MIN_RSA_MODULUS_BITS = exports.SHA256_LEN = exports.MAX_STRING_FIELD_BYTES = exports.MAX_ENVELOPE_JSON_BYTES = exports.MAX_SIGNATURE_BYTES = exports.MAX_SIGNED_PAYLOAD_BYTES = exports.HASH_ALGORITHM = exports.SIGNATURE_ALGORITHM = exports.SCHEMA_VERSION = exports.MAGIC_BYTES = exports.MAGIC = void 0;
|
|
11
|
+
/** 8-byte ASCII magic that opens every signed payload. */
|
|
12
|
+
exports.MAGIC = 'SBOTA001';
|
|
13
|
+
/** Raw bytes of {@link MAGIC}. */
|
|
14
|
+
exports.MAGIC_BYTES = Uint8Array.from(Array.from(exports.MAGIC, (c) => c.charCodeAt(0)));
|
|
15
|
+
/** The only schema version this codec accepts. */
|
|
16
|
+
exports.SCHEMA_VERSION = 1;
|
|
17
|
+
/** Canonical algorithm identifiers (also the values carried in the payload). */
|
|
18
|
+
exports.SIGNATURE_ALGORITHM = 'SB-OTA-RSA-SHA256-V1';
|
|
19
|
+
exports.HASH_ALGORITHM = 'SHA-256';
|
|
20
|
+
/** Whole binary payload must fit in this many bytes (before/after base64). */
|
|
21
|
+
exports.MAX_SIGNED_PAYLOAD_BYTES = 8192;
|
|
22
|
+
/** RSA signature bytes (RSA-3072 = 384 bytes; headroom for larger moduli). */
|
|
23
|
+
exports.MAX_SIGNATURE_BYTES = 1024;
|
|
24
|
+
/** Transport envelope JSON size cap, enforced before decoding. */
|
|
25
|
+
exports.MAX_ENVELOPE_JSON_BYTES = 65536;
|
|
26
|
+
/** Each individual length-prefixed UTF-8 string field. */
|
|
27
|
+
exports.MAX_STRING_FIELD_BYTES = 256;
|
|
28
|
+
/** SHA-256 digest length. */
|
|
29
|
+
exports.SHA256_LEN = 32;
|
|
30
|
+
/** RSA modulus policy. */
|
|
31
|
+
exports.MIN_RSA_MODULUS_BITS = 2048;
|
|
32
|
+
exports.RECOMMENDED_RSA_MODULUS_BITS = 3072;
|
|
33
|
+
/**
|
|
34
|
+
* uint64 values above this are rejected — JavaScript cannot represent them
|
|
35
|
+
* losslessly as a Number, and the native mirrors treat the same ceiling as the
|
|
36
|
+
* safe range so a payload that parses in one place parses everywhere.
|
|
37
|
+
*/
|
|
38
|
+
exports.MAX_SAFE_UINT64 = Number.MAX_SAFE_INTEGER; // 2^53 - 1
|
|
39
|
+
/** Allowed enum values. */
|
|
40
|
+
exports.PLATFORMS = ['android', 'ios'];
|
|
41
|
+
exports.ARTIFACT_TYPES = ['full', 'patch'];
|
|
42
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../../src/vendor/ota-protocol/limits.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,0DAA0D;AAC7C,QAAA,KAAK,GAAG,UAAU,CAAC;AAChC,kCAAkC;AACrB,QAAA,WAAW,GAAG,UAAU,CAAC,IAAI,CACxC,KAAK,CAAC,IAAI,CAAC,aAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAC1C,CAAC;AAEF,kDAAkD;AACrC,QAAA,cAAc,GAAG,CAAC,CAAC;AAEhC,gFAAgF;AACnE,QAAA,mBAAmB,GAAG,sBAAsB,CAAC;AAC7C,QAAA,cAAc,GAAG,SAAS,CAAC;AAExC,8EAA8E;AACjE,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAC7C,8EAA8E;AACjE,QAAA,mBAAmB,GAAG,IAAI,CAAC;AACxC,kEAAkE;AACrD,QAAA,uBAAuB,GAAG,KAAK,CAAC;AAC7C,0DAA0D;AAC7C,QAAA,sBAAsB,GAAG,GAAG,CAAC;AAC1C,6BAA6B;AAChB,QAAA,UAAU,GAAG,EAAE,CAAC;AAE7B,0BAA0B;AACb,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAC5B,QAAA,4BAA4B,GAAG,IAAI,CAAC;AAEjD;;;;GAIG;AACU,QAAA,eAAe,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,WAAW;AAEnE,2BAA2B;AACd,QAAA,SAAS,GAAG,CAAC,SAAS,EAAE,KAAK,CAAU,CAAC;AACxC,QAAA,cAAc,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for SB-OTA-RSA-SHA256-V1.
|
|
3
|
+
*
|
|
4
|
+
* The decoded `ScaleBunSignedReleaseV1` structure, the platform/artifact enums,
|
|
5
|
+
* and the stable verification failure codes. Kept dependency-free so this module
|
|
6
|
+
* imports cleanly into the CLI, the React Native SDK (Metro), and Node tests.
|
|
7
|
+
*/
|
|
8
|
+
import { PLATFORMS, ARTIFACT_TYPES } from './limits';
|
|
9
|
+
export type OtaPlatform = (typeof PLATFORMS)[number];
|
|
10
|
+
export type OtaArtifactType = (typeof ARTIFACT_TYPES)[number];
|
|
11
|
+
/**
|
|
12
|
+
* The decoded signed release. Field names and order mirror the wire format in
|
|
13
|
+
* docs/ota/SB-OTA-RSA-SHA256-V1.md §3.2.
|
|
14
|
+
*
|
|
15
|
+
* Hash fields are exposed as lowercase-hex strings for ergonomics; the codec
|
|
16
|
+
* converts to/from the raw 32-byte on-wire representation. uint64 fields are
|
|
17
|
+
* JavaScript numbers, guaranteed ≤ MAX_SAFE_UINT64 by the parser.
|
|
18
|
+
*/
|
|
19
|
+
export interface ScaleBunSignedReleaseV1 {
|
|
20
|
+
/** Always {@link SIGNATURE_ALGORITHM}. */
|
|
21
|
+
readonly signatureAlgorithm: string;
|
|
22
|
+
/** Always {@link HASH_ALGORITHM}. */
|
|
23
|
+
readonly hashAlgorithm: string;
|
|
24
|
+
readonly keyId: string;
|
|
25
|
+
readonly projectId: string;
|
|
26
|
+
/** Android applicationId / iOS bundle identifier. */
|
|
27
|
+
readonly applicationId: string;
|
|
28
|
+
readonly releaseId: string;
|
|
29
|
+
readonly bundleId: string;
|
|
30
|
+
readonly platform: OtaPlatform;
|
|
31
|
+
readonly artifactType: OtaArtifactType;
|
|
32
|
+
readonly targetAppVersion: string;
|
|
33
|
+
readonly targetRuntimeVersion: string;
|
|
34
|
+
readonly minimumSdkVersion: string;
|
|
35
|
+
readonly releaseSequence: number;
|
|
36
|
+
readonly issuedAtEpochSeconds: number;
|
|
37
|
+
/** 0 = never expires. */
|
|
38
|
+
readonly expiresAtEpochSeconds: number;
|
|
39
|
+
readonly artifactSize: number;
|
|
40
|
+
/** SHA-256 of the exact downloaded artifact, lowercase hex (64 chars). */
|
|
41
|
+
readonly artifactSha256: string;
|
|
42
|
+
/** Empty string for `full`; the base bundle id for `patch`. */
|
|
43
|
+
readonly baseBundleId: string;
|
|
44
|
+
/** Empty string for `full`; base bundle SHA-256 (lowercase hex) for `patch`. */
|
|
45
|
+
readonly baseArtifactSha256: string;
|
|
46
|
+
/** SHA-256 of the final normalized bundle, lowercase hex (64 chars). */
|
|
47
|
+
readonly resultArtifactSha256: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The transport envelope carried over JSON. `signedPayload` and `signature` are
|
|
51
|
+
* standard Base64. `signedPayload` is the sole security authority; every field in
|
|
52
|
+
* `displayMetadata` is informational only.
|
|
53
|
+
*/
|
|
54
|
+
export interface OtaReleaseEnvelope {
|
|
55
|
+
readonly protocol: string;
|
|
56
|
+
readonly keyId: string;
|
|
57
|
+
readonly signedPayload: string;
|
|
58
|
+
readonly signature: string;
|
|
59
|
+
readonly downloadUrl?: string;
|
|
60
|
+
readonly displayMetadata?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
/** Stable verification failure codes (docs §6). */
|
|
63
|
+
export type OtaVerificationFailureCode = 'INVALID_ENVELOPE' | 'INVALID_BASE64' | 'UNSUPPORTED_PROTOCOL' | 'UNSUPPORTED_SCHEMA' | 'UNSUPPORTED_SIGNATURE_ALGORITHM' | 'UNSUPPORTED_HASH_ALGORITHM' | 'UNKNOWN_KEY_ID' | 'INVALID_PUBLIC_KEY' | 'INVALID_SIGNATURE' | 'INVALID_SIGNED_PAYLOAD' | 'PROJECT_MISMATCH' | 'APPLICATION_MISMATCH' | 'PLATFORM_MISMATCH' | 'APP_VERSION_MISMATCH' | 'RUNTIME_VERSION_MISMATCH' | 'RELEASE_DOWNGRADE_REJECTED' | 'RELEASE_EXPIRED' | 'DOWNLOAD_FAILED' | 'DOWNLOAD_TOO_LARGE' | 'ARTIFACT_SIZE_MISMATCH' | 'ARTIFACT_HASH_MISMATCH' | 'PATCH_BASE_MISMATCH' | 'PATCH_RESULT_MISMATCH' | 'UNSAFE_ARCHIVE' | 'STAGING_FAILED' | 'ACTIVATION_FAILED' | 'INTERNAL_VERIFICATION_ERROR';
|
|
64
|
+
/**
|
|
65
|
+
* Error thrown by the parser. `code` is one of the payload-related failure codes
|
|
66
|
+
* (INVALID_SIGNED_PAYLOAD / UNSUPPORTED_*), so callers can map parse failures to
|
|
67
|
+
* the same stable vocabulary the native verifiers use.
|
|
68
|
+
*/
|
|
69
|
+
export declare class OtaProtocolError extends Error {
|
|
70
|
+
readonly code: OtaVerificationFailureCode;
|
|
71
|
+
constructor(code: OtaVerificationFailureCode, message: string);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/vendor/ota-protocol/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,0CAA0C;IAC1C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,qCAAqC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IAEvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAEnC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,yBAAyB;IACzB,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAEpC,wEAAwE;IACxE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpD;AAED,mDAAmD;AACnD,MAAM,MAAM,0BAA0B,GAClC,kBAAkB,GAClB,gBAAgB,GAChB,sBAAsB,GACtB,oBAAoB,GACpB,iCAAiC,GACjC,4BAA4B,GAC5B,gBAAgB,GAChB,oBAAoB,GACpB,mBAAmB,GACnB,wBAAwB,GACxB,kBAAkB,GAClB,sBAAsB,GACtB,mBAAmB,GACnB,sBAAsB,GACtB,0BAA0B,GAC1B,4BAA4B,GAC5B,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,wBAAwB,GACxB,wBAAwB,GACxB,qBAAqB,GACrB,uBAAuB,GACvB,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,6BAA6B,CAAC;AAElC;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAC;gBAC9B,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM;CAK9D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared types for SB-OTA-RSA-SHA256-V1.
|
|
4
|
+
*
|
|
5
|
+
* The decoded `ScaleBunSignedReleaseV1` structure, the platform/artifact enums,
|
|
6
|
+
* and the stable verification failure codes. Kept dependency-free so this module
|
|
7
|
+
* imports cleanly into the CLI, the React Native SDK (Metro), and Node tests.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.OtaProtocolError = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Error thrown by the parser. `code` is one of the payload-related failure codes
|
|
13
|
+
* (INVALID_SIGNED_PAYLOAD / UNSUPPORTED_*), so callers can map parse failures to
|
|
14
|
+
* the same stable vocabulary the native verifiers use.
|
|
15
|
+
*/
|
|
16
|
+
class OtaProtocolError extends Error {
|
|
17
|
+
constructor(code, message) {
|
|
18
|
+
super(`${code}: ${message}`);
|
|
19
|
+
this.name = 'OtaProtocolError';
|
|
20
|
+
this.code = code;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.OtaProtocolError = OtaProtocolError;
|
|
24
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/vendor/ota-protocol/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAgGH;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IAEzC,YAAY,IAAgC,EAAE,OAAe;QAC3D,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAPD,4CAOC"}
|