@gfean/react-native-bundle-drop 0.5.1 → 0.7.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/BundleDrop.podspec +96 -0
- package/README.md +194 -5
- package/android/build.gradle +66 -0
- package/android/src/main/java/com/bundledrop/BundleDropBoundedDownloader.kt +86 -0
- package/android/src/main/java/com/bundledrop/BundleDropModule.kt +206 -13
- package/android/src/main/java/com/bundledrop/BundleDropNativePaths.kt +43 -13
- package/android/src/main/java/com/bundledrop/BundleDropOtaResolver.kt +35 -0
- package/android/src/main/java/com/bundledrop/BundleDropRuntimeCrypto.kt +81 -0
- package/android/src/main/java/com/bundledrop/BundleDropStartupRecovery.kt +1117 -0
- package/ios/BundleDropBridge.m +45 -0
- package/ios/BundleDropLocator.swift +66 -4
- package/ios/BundleDropModule.swift +181 -3
- package/ios/BundleDropOtaResolver.swift +137 -29
- package/ios/BundleDropRuntimeCrypto.swift +45 -0
- package/ios/BundleDropStartupRecovery.swift +1108 -0
- package/ios/BundleDropStartupRecoveryAdapter.swift +301 -0
- package/lib/CLI/cli.d.ts +1 -0
- package/lib/CLI/cli.js +57 -6
- package/lib/CLI/scripts/aipowered/apply-setup-plan.js +7 -17
- package/lib/CLI/scripts/aipowered/backend-client.js +29 -4
- package/lib/CLI/scripts/aipowered/code-push-residue.d.ts +5 -0
- package/lib/CLI/scripts/aipowered/code-push-residue.js +126 -0
- package/lib/CLI/scripts/aipowered/credential-safety.d.ts +1 -0
- package/lib/CLI/scripts/aipowered/credential-safety.js +14 -0
- package/lib/CLI/scripts/aipowered/diff-preview.js +12 -4
- package/lib/CLI/scripts/aipowered/init-project-config.d.ts +4 -0
- package/lib/CLI/scripts/aipowered/init-project-config.js +221 -45
- package/lib/CLI/scripts/aipowered/scanner.d.ts +1 -0
- package/lib/CLI/scripts/aipowered/scanner.js +164 -32
- package/lib/CLI/scripts/aipowered/terminal-safety.d.ts +4 -0
- package/lib/CLI/scripts/aipowered/terminal-safety.js +124 -0
- package/lib/CLI/scripts/aipowered/validate-plan.d.ts +3 -0
- package/lib/CLI/scripts/aipowered/validate-plan.js +1080 -19
- package/lib/CLI/scripts/bare-metro-config.d.ts +1 -1
- package/lib/CLI/scripts/bare-metro-config.js +24 -32
- package/lib/CLI/scripts/doctor.js +162 -22
- package/lib/CLI/scripts/expo/configure-expo.js +52 -60
- package/lib/CLI/scripts/expo/package-manager.d.ts +2 -0
- package/lib/CLI/scripts/expo/package-manager.js +63 -25
- package/lib/CLI/scripts/init-config.d.ts +7 -7
- package/lib/CLI/scripts/init-config.js +198 -14
- package/lib/CLI/scripts/login-cli.js +31 -7
- package/lib/CLI/scripts/metro-config-authority.d.ts +8 -0
- package/lib/CLI/scripts/metro-config-authority.js +303 -0
- package/lib/CLI/scripts/native/write-runtime-identity.d.ts +19 -0
- package/lib/CLI/scripts/native/write-runtime-identity.js +92 -0
- package/lib/CLI/scripts/native-entrypoint-authority.d.ts +2 -0
- package/lib/CLI/scripts/native-entrypoint-authority.js +378 -0
- package/lib/CLI/scripts/native-setup-contract.d.ts +2 -2
- package/lib/CLI/scripts/native-setup-contract.js +63 -33
- package/lib/CLI/scripts/native-startup-validator.d.ts +3 -0
- package/lib/CLI/scripts/native-startup-validator.js +964 -0
- package/lib/CLI/scripts/safe-file-transaction.d.ts +12 -0
- package/lib/CLI/scripts/safe-file-transaction.js +159 -0
- package/lib/CLI/scripts/upload-cli.d.ts +12 -2
- package/lib/CLI/scripts/upload-cli.js +74 -11
- package/lib/CLI/serverUrl.d.ts +3 -0
- package/lib/CLI/serverUrl.js +31 -0
- package/lib/api/clientApi.d.ts +3 -1
- package/lib/api/clientApi.js +14 -0
- package/lib/api/types.d.ts +39 -0
- package/lib/bundleInfo.d.ts +2 -0
- package/lib/bundleInfo.js +16 -1
- package/lib/context.d.ts +1 -1
- package/lib/context.js +12 -2
- package/lib/fs/bundlePointer.d.ts +1 -17
- package/lib/fs/bundlePointer.js +5 -93
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/install/bundleInstallShared.js +4 -4
- package/lib/install/installFromZip.d.ts +3 -0
- package/lib/install/installFromZip.js +10 -1
- package/lib/loadConfig.d.ts +17 -1
- package/lib/loadConfig.js +16 -0
- package/lib/manager/downloadAndInstall.d.ts +3 -2
- package/lib/manager/downloadAndInstall.js +134 -66
- package/lib/manager/reporting.d.ts +8 -1
- package/lib/manager/reporting.js +17 -22
- package/lib/manager/rollbackState.d.ts +18 -52
- package/lib/manager/rollbackState.js +115 -216
- package/lib/manager/updateCheck.d.ts +1 -0
- package/lib/manager/updateCheck.js +224 -78
- package/lib/manager/updateState.d.ts +2 -1
- package/lib/manager/updateState.js +59 -6
- package/lib/metro.d.ts +8 -1
- package/lib/metro.js +69 -19
- package/lib/native/bundleDropNative.d.ts +62 -0
- package/lib/native/bundleDropNative.js +268 -2
- package/lib/native/fs.d.ts +6 -0
- package/lib/native/fs.js +24 -0
- package/lib/patch-engine/installFromPatchSet.d.ts +2 -0
- package/lib/patch-engine/installFromPatchSet.js +16 -5
- package/lib/patch-engine/patchTransport.d.ts +2 -0
- package/lib/patch-engine/patchTransport.js +9 -0
- package/lib/runtime/initState.d.ts +5 -0
- package/lib/runtime/initState.js +4 -0
- package/lib/runtime/service.js +82 -67
- package/lib/runtime-delivery/artifactCapability.d.ts +1 -0
- package/lib/runtime-delivery/artifactCapability.js +32 -0
- package/lib/runtime-delivery/authorityLeaseVerifier.d.ts +3 -0
- package/lib/runtime-delivery/authorityLeaseVerifier.js +106 -0
- package/lib/runtime-delivery/bootstrapConfig.d.ts +68 -0
- package/lib/runtime-delivery/bootstrapConfig.js +278 -0
- package/lib/runtime-delivery/diagnostics.d.ts +17 -0
- package/lib/runtime-delivery/diagnostics.js +58 -0
- package/lib/runtime-delivery/encoding.d.ts +5 -0
- package/lib/runtime-delivery/encoding.js +132 -0
- package/lib/runtime-delivery/heartbeat.d.ts +3 -0
- package/lib/runtime-delivery/heartbeat.js +88 -0
- package/lib/runtime-delivery/localResolver.d.ts +23 -0
- package/lib/runtime-delivery/localResolver.js +81 -0
- package/lib/runtime-delivery/manifestState.d.ts +11 -0
- package/lib/runtime-delivery/manifestState.js +123 -0
- package/lib/runtime-delivery/manifestVerifier.d.ts +13 -0
- package/lib/runtime-delivery/manifestVerifier.js +335 -0
- package/lib/runtime-delivery/runtimeDelivery.d.ts +19 -0
- package/lib/runtime-delivery/runtimeDelivery.js +375 -0
- package/lib/runtime-delivery/types.d.ts +87 -0
- package/lib/runtime-delivery/types.js +6 -0
- package/lib/scripts/bundle.d.ts +9 -2
- package/lib/scripts/bundle.js +68 -18
- package/lib/scripts/download-bundle.d.ts +1 -0
- package/lib/scripts/download-bundle.js +2 -2
- package/lib/scripts/resolveModule.d.ts +2 -0
- package/lib/scripts/resolveModule.js +5 -0
- package/package.json +5 -2
- package/plugin/xcodeBuildPhase.js +2 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.rolloutBucket = rolloutBucket;
|
|
7
|
+
exports.resolveRuntimeDeliveryLane = resolveRuntimeDeliveryLane;
|
|
8
|
+
const fs_1 = __importDefault(require("../native/fs"));
|
|
9
|
+
function isUnexpired(expiresAt, now) {
|
|
10
|
+
return !expiresAt || Date.parse(expiresAt) > now;
|
|
11
|
+
}
|
|
12
|
+
async function rolloutBucket(installId) {
|
|
13
|
+
const digest = await fs_1.default.sha256String(installId);
|
|
14
|
+
if (!/^[a-f0-9]{64}$/.test(digest))
|
|
15
|
+
throw new Error('Native SHA-256 returned an invalid digest');
|
|
16
|
+
return Number.parseInt(digest.slice(0, 8), 16) % 100;
|
|
17
|
+
}
|
|
18
|
+
function selectPatchEdge(manifest, input, target, now) {
|
|
19
|
+
if (!manifest.patchPolicy.enabled || !input.currentHash)
|
|
20
|
+
return undefined;
|
|
21
|
+
if (input.rejectedHashes.includes(input.currentHash))
|
|
22
|
+
return undefined;
|
|
23
|
+
return manifest.patchEdges.find(edge => edge.baseHash === input.currentHash &&
|
|
24
|
+
edge.targetHash === target.bundleHash &&
|
|
25
|
+
input.patchAlgorithms.includes(edge.algorithm) &&
|
|
26
|
+
(!edge.missingAssetsHash || input.supportsContentAddressedAssets) &&
|
|
27
|
+
isUnexpired(edge.expiresAt, now) &&
|
|
28
|
+
edge.patchSizeBytes <= edge.fullBundleSizeBytes * manifest.patchPolicy.maxPatchToFullRatio);
|
|
29
|
+
}
|
|
30
|
+
async function resolveRuntimeDeliveryLane(manifest, input) {
|
|
31
|
+
if (manifest.resolutionMode !== 'local')
|
|
32
|
+
throw new Error('Dynamic lanes require server resolution');
|
|
33
|
+
if (!manifest.candidateSetComplete)
|
|
34
|
+
throw new Error('Incomplete candidate sets cannot resolve locally');
|
|
35
|
+
const now = input.now ?? Date.now();
|
|
36
|
+
const rejected = new Set(input.rejectedHashes);
|
|
37
|
+
const revoked = new Set(manifest.revokedHashes);
|
|
38
|
+
const currentRevoked = !!input.currentHash && revoked.has(input.currentHash);
|
|
39
|
+
const releasesByRef = new Map(manifest.releases.map(release => [release.releaseRef, release]));
|
|
40
|
+
const isSafe = (release) => release.available &&
|
|
41
|
+
!rejected.has(release.bundleHash) &&
|
|
42
|
+
!revoked.has(release.bundleHash) &&
|
|
43
|
+
isUnexpired(release.expiresAt, now);
|
|
44
|
+
let selected;
|
|
45
|
+
let noCandidateReason = 'NO_PUBLISHED_BUNDLE';
|
|
46
|
+
if (manifest.publishingMode === 'automatic') {
|
|
47
|
+
selected = manifest.releases.find(isSafe);
|
|
48
|
+
noCandidateReason = 'NO_COMPATIBLE_BUNDLE';
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const bucket = await rolloutBucket(input.installId);
|
|
52
|
+
for (const rollout of manifest.publishedRollouts) {
|
|
53
|
+
const release = releasesByRef.get(rollout.releaseRef);
|
|
54
|
+
if (!isSafe(release))
|
|
55
|
+
continue;
|
|
56
|
+
const eligible = rollout.rolloutPercentage >= 100 || bucket < rollout.rolloutPercentage;
|
|
57
|
+
if (eligible) {
|
|
58
|
+
selected = release;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
noCandidateReason = 'ROLLOUT_NOT_ELIGIBLE';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (!selected) {
|
|
65
|
+
return currentRevoked
|
|
66
|
+
? { action: 'ROLLBACK', reason: 'CURRENT_REVOKED_NO_COMPATIBLE_TARGET' }
|
|
67
|
+
: { action: 'NOOP', reason: noCandidateReason };
|
|
68
|
+
}
|
|
69
|
+
if (selected.bundleHash === input.currentHash) {
|
|
70
|
+
return currentRevoked
|
|
71
|
+
? { action: 'ROLLBACK', reason: 'CURRENT_REVOKED_NO_COMPATIBLE_TARGET' }
|
|
72
|
+
: { action: 'NOOP', reason: 'UP_TO_DATE' };
|
|
73
|
+
}
|
|
74
|
+
const patchEdge = currentRevoked ? undefined : selectPatchEdge(manifest, input, selected, now);
|
|
75
|
+
return {
|
|
76
|
+
action: 'INSTALL',
|
|
77
|
+
target: selected,
|
|
78
|
+
mode: patchEdge ? 'patch' : 'full',
|
|
79
|
+
patchEdge,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RuntimeDeliveryLaneIdentity, RuntimeDeliveryLaneManifest } from './types';
|
|
2
|
+
export type VerifiedLaneState = {
|
|
3
|
+
highestGeneration: number;
|
|
4
|
+
payloadSha256: string;
|
|
5
|
+
revokedHashes: string[];
|
|
6
|
+
verifiedAt: string;
|
|
7
|
+
};
|
|
8
|
+
export type PersistVerifiedRuntimeRevocations = (revokedHashes: string[]) => Promise<void>;
|
|
9
|
+
export declare function readVerifiedLaneState(identity: RuntimeDeliveryLaneIdentity): Promise<VerifiedLaneState | null>;
|
|
10
|
+
export declare function readVerifiedRuntimeRevokedHashes(identity: RuntimeDeliveryLaneIdentity): Promise<string[]>;
|
|
11
|
+
export declare function recordVerifiedLaneManifest(manifest: RuntimeDeliveryLaneManifest, payloadSha256: string, persistRuntimeRevocations?: PersistVerifiedRuntimeRevocations): Promise<void>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readVerifiedLaneState = readVerifiedLaneState;
|
|
7
|
+
exports.readVerifiedRuntimeRevokedHashes = readVerifiedRuntimeRevokedHashes;
|
|
8
|
+
exports.recordVerifiedLaneManifest = recordVerifiedLaneManifest;
|
|
9
|
+
const context_1 = require("../context");
|
|
10
|
+
const fsUtils_1 = require("../fs/fsUtils");
|
|
11
|
+
const fs_1 = __importDefault(require("../native/fs"));
|
|
12
|
+
const STATE_PATH = `${context_1.BUNDLE_DROP_ROOT}/runtime-delivery-state.json`;
|
|
13
|
+
let stateMutation = Promise.resolve();
|
|
14
|
+
const SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
15
|
+
function isRecord(value) {
|
|
16
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
17
|
+
}
|
|
18
|
+
function invalidState() {
|
|
19
|
+
throw new Error('Runtime delivery state is malformed or unsupported');
|
|
20
|
+
}
|
|
21
|
+
function parseState(raw) {
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = JSON.parse(raw);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return invalidState();
|
|
28
|
+
}
|
|
29
|
+
if (!isRecord(parsed) || Object.keys(parsed).sort().join(',') !== 'lanes,schemaVersion') {
|
|
30
|
+
return invalidState();
|
|
31
|
+
}
|
|
32
|
+
if (parsed.schemaVersion !== 1 || !isRecord(parsed.lanes))
|
|
33
|
+
return invalidState();
|
|
34
|
+
for (const [key, lane] of Object.entries(parsed.lanes)) {
|
|
35
|
+
if (!key || !isRecord(lane))
|
|
36
|
+
return invalidState();
|
|
37
|
+
if (Object.keys(lane).sort().join(',') !==
|
|
38
|
+
'highestGeneration,payloadSha256,revokedHashes,verifiedAt') {
|
|
39
|
+
return invalidState();
|
|
40
|
+
}
|
|
41
|
+
if (!Number.isSafeInteger(lane.highestGeneration) || lane.highestGeneration < 1) {
|
|
42
|
+
return invalidState();
|
|
43
|
+
}
|
|
44
|
+
if (typeof lane.payloadSha256 !== 'string' || !SHA256_PATTERN.test(lane.payloadSha256)) {
|
|
45
|
+
return invalidState();
|
|
46
|
+
}
|
|
47
|
+
if (!Array.isArray(lane.revokedHashes) ||
|
|
48
|
+
lane.revokedHashes.some(hash => typeof hash !== 'string' || !SHA256_PATTERN.test(hash)) ||
|
|
49
|
+
new Set(lane.revokedHashes).size !== lane.revokedHashes.length) {
|
|
50
|
+
return invalidState();
|
|
51
|
+
}
|
|
52
|
+
if (typeof lane.verifiedAt !== 'string' || !Number.isFinite(Date.parse(lane.verifiedAt))) {
|
|
53
|
+
return invalidState();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return parsed;
|
|
57
|
+
}
|
|
58
|
+
function laneStateKey(identity) {
|
|
59
|
+
return [identity.projectSlug, identity.channelName, identity.platform, identity.runtimeVersion]
|
|
60
|
+
.map(value => encodeURIComponent(value))
|
|
61
|
+
.join('/');
|
|
62
|
+
}
|
|
63
|
+
function belongsToRuntime(laneKey, identity) {
|
|
64
|
+
const parts = laneKey.split('/');
|
|
65
|
+
return parts.length === 4 &&
|
|
66
|
+
parts[0] === encodeURIComponent(identity.projectSlug) &&
|
|
67
|
+
parts[2] === encodeURIComponent(identity.platform) &&
|
|
68
|
+
parts[3] === encodeURIComponent(identity.runtimeVersion);
|
|
69
|
+
}
|
|
70
|
+
function verifiedRuntimeRevokedHashes(state, identity) {
|
|
71
|
+
const revokedHashes = Object.entries(state.lanes)
|
|
72
|
+
.filter(([key]) => belongsToRuntime(key, identity))
|
|
73
|
+
.flatMap(([, lane]) => lane.revokedHashes);
|
|
74
|
+
return Array.from(new Set(revokedHashes)).sort();
|
|
75
|
+
}
|
|
76
|
+
async function readState() {
|
|
77
|
+
if (!await fs_1.default.exists(STATE_PATH))
|
|
78
|
+
return { schemaVersion: 1, lanes: {} };
|
|
79
|
+
let raw;
|
|
80
|
+
try {
|
|
81
|
+
raw = await fs_1.default.readFile(STATE_PATH, 'utf8');
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
throw new Error('Unable to read existing runtime delivery state');
|
|
85
|
+
}
|
|
86
|
+
return parseState(raw);
|
|
87
|
+
}
|
|
88
|
+
async function readVerifiedLaneState(identity) {
|
|
89
|
+
const state = await readState();
|
|
90
|
+
return state.lanes[laneStateKey(identity)] || null;
|
|
91
|
+
}
|
|
92
|
+
async function readVerifiedRuntimeRevokedHashes(identity) {
|
|
93
|
+
const state = await readState();
|
|
94
|
+
return verifiedRuntimeRevokedHashes(state, identity);
|
|
95
|
+
}
|
|
96
|
+
async function recordVerifiedLaneManifest(manifest, payloadSha256, persistRuntimeRevocations) {
|
|
97
|
+
const mutation = stateMutation.then(async () => {
|
|
98
|
+
const identity = manifest;
|
|
99
|
+
const key = laneStateKey(identity);
|
|
100
|
+
const state = await readState();
|
|
101
|
+
const existing = state.lanes[key];
|
|
102
|
+
if (existing && existing.highestGeneration > manifest.generation) {
|
|
103
|
+
throw new Error('Manifest generation regressed while persisting verified state');
|
|
104
|
+
}
|
|
105
|
+
if (existing &&
|
|
106
|
+
existing.highestGeneration === manifest.generation &&
|
|
107
|
+
existing.payloadSha256 !== payloadSha256) {
|
|
108
|
+
throw new Error('Manifest generation equivocation detected');
|
|
109
|
+
}
|
|
110
|
+
state.lanes[key] = {
|
|
111
|
+
highestGeneration: manifest.generation,
|
|
112
|
+
payloadSha256,
|
|
113
|
+
revokedHashes: [...manifest.revokedHashes],
|
|
114
|
+
verifiedAt: new Date().toISOString(),
|
|
115
|
+
};
|
|
116
|
+
if (persistRuntimeRevocations) {
|
|
117
|
+
await persistRuntimeRevocations(verifiedRuntimeRevokedHashes(state, identity));
|
|
118
|
+
}
|
|
119
|
+
await (0, fsUtils_1.atomicWriteJson)(STATE_PATH, state);
|
|
120
|
+
});
|
|
121
|
+
stateMutation = mutation.then(() => undefined, () => undefined);
|
|
122
|
+
return mutation;
|
|
123
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type RuntimeDeliveryLaneIdentity, type RuntimeDeliveryLaneManifest, type RuntimeDeliveryPublicKey } from './types';
|
|
2
|
+
export declare const MAX_RUNTIME_MANIFEST_BYTES: number;
|
|
3
|
+
export type RuntimeDeliveryManifestFailureCode = 'body_too_large' | 'http_error' | 'network_error' | 'timeout' | 'stream_unavailable' | 'invalid_manifest' | 'invalid_signature' | 'unknown_key' | 'lane_mismatch' | 'generation_regression' | 'generation_equivocation' | 'authority_body_too_large' | 'authority_http_error' | 'authority_network_error' | 'authority_timeout' | 'authority_stream_unavailable' | 'authority_invalid' | 'authority_invalid_signature' | 'authority_unknown_key' | 'authority_expired' | 'authority_origin_mismatch' | 'authority_disabled';
|
|
4
|
+
export declare class RuntimeDeliveryManifestError extends Error {
|
|
5
|
+
readonly code: RuntimeDeliveryManifestFailureCode;
|
|
6
|
+
readonly status?: number;
|
|
7
|
+
constructor(code: RuntimeDeliveryManifestFailureCode, message: string, options?: {
|
|
8
|
+
cause?: unknown;
|
|
9
|
+
status?: number;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export declare function verifyRuntimeDeliveryManifest(serializedJws: string, expectedIdentity: RuntimeDeliveryLaneIdentity, publicKeys: Record<string, RuntimeDeliveryPublicKey>): Promise<RuntimeDeliveryLaneManifest>;
|
|
13
|
+
export declare function verifyRuntimeDeliverySignedPayload(serializedJws: string, expectedType: string, publicKeys: Record<string, RuntimeDeliveryPublicKey>): Promise<string>;
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RuntimeDeliveryManifestError = exports.MAX_RUNTIME_MANIFEST_BYTES = void 0;
|
|
7
|
+
exports.verifyRuntimeDeliveryManifest = verifyRuntimeDeliveryManifest;
|
|
8
|
+
exports.verifyRuntimeDeliverySignedPayload = verifyRuntimeDeliverySignedPayload;
|
|
9
|
+
const fs_1 = __importDefault(require("../native/fs"));
|
|
10
|
+
const rollbackState_1 = require("../manager/rollbackState");
|
|
11
|
+
const encoding_1 = require("./encoding");
|
|
12
|
+
const manifestState_1 = require("./manifestState");
|
|
13
|
+
const types_1 = require("./types");
|
|
14
|
+
exports.MAX_RUNTIME_MANIFEST_BYTES = 1024 * 1024;
|
|
15
|
+
const SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
16
|
+
class RuntimeDeliveryManifestError extends Error {
|
|
17
|
+
constructor(code, message, options) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.code = code;
|
|
20
|
+
this.name = 'RuntimeDeliveryManifestError';
|
|
21
|
+
this.status = options?.status;
|
|
22
|
+
if (options && 'cause' in options) {
|
|
23
|
+
this.cause = options.cause;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.RuntimeDeliveryManifestError = RuntimeDeliveryManifestError;
|
|
28
|
+
function requireRecord(value, name) {
|
|
29
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
30
|
+
throw new Error(`${name} must be an object`);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
function requireExactKeys(value, allowedKeys, name) {
|
|
35
|
+
const allowed = new Set(allowedKeys);
|
|
36
|
+
const unsupported = Object.keys(value).find(key => !allowed.has(key));
|
|
37
|
+
if (unsupported)
|
|
38
|
+
throw new Error(`${name} contains unsupported field ${unsupported}`);
|
|
39
|
+
}
|
|
40
|
+
function requireString(value, name) {
|
|
41
|
+
if (typeof value !== 'string' || !value)
|
|
42
|
+
throw new Error(`${name} must be a non-empty string`);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
function requireHash(value, name) {
|
|
46
|
+
const hash = requireString(value, name);
|
|
47
|
+
if (!SHA256_PATTERN.test(hash))
|
|
48
|
+
throw new Error(`${name} must be a lowercase SHA-256 hash`);
|
|
49
|
+
return hash;
|
|
50
|
+
}
|
|
51
|
+
function requireInteger(value, name) {
|
|
52
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
53
|
+
throw new Error(`${name} must be a non-negative safe integer`);
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
function requirePositiveInteger(value, name) {
|
|
58
|
+
const integer = requireInteger(value, name);
|
|
59
|
+
if (integer < 1)
|
|
60
|
+
throw new Error(`${name} must be at least 1`);
|
|
61
|
+
return integer;
|
|
62
|
+
}
|
|
63
|
+
function requireFiniteNumber(value, name) {
|
|
64
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
|
|
65
|
+
throw new Error(`${name} must be a non-negative finite number`);
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
function requireTimestamp(value, name) {
|
|
70
|
+
const timestamp = requireString(value, name);
|
|
71
|
+
if (!Number.isFinite(Date.parse(timestamp)))
|
|
72
|
+
throw new Error(`${name} must be an ISO timestamp`);
|
|
73
|
+
return timestamp;
|
|
74
|
+
}
|
|
75
|
+
function optionalTimestamp(value, name) {
|
|
76
|
+
if (value === null)
|
|
77
|
+
return null;
|
|
78
|
+
if (value === undefined)
|
|
79
|
+
return undefined;
|
|
80
|
+
return requireTimestamp(value, name);
|
|
81
|
+
}
|
|
82
|
+
function parseLaneManifest(payload) {
|
|
83
|
+
const lane = requireRecord(payload, 'Manifest payload');
|
|
84
|
+
requireExactKeys(lane, [
|
|
85
|
+
'schemaVersion', 'type', 'projectSlug', 'channelName', 'platform', 'runtimeVersion',
|
|
86
|
+
'generation', 'generatedAt', 'resolutionMode', 'dynamicReason',
|
|
87
|
+
'publishingMode', 'rolloutAlgorithm', 'revokedHashes', 'releases',
|
|
88
|
+
'publishedRollouts', 'patchPolicy', 'patchEdges', 'candidateSetComplete',
|
|
89
|
+
], 'Manifest payload');
|
|
90
|
+
if (lane.schemaVersion !== 3 || lane.type !== 'lane') {
|
|
91
|
+
throw new Error('Unsupported runtime manifest schema or type');
|
|
92
|
+
}
|
|
93
|
+
const resolutionMode = lane.resolutionMode;
|
|
94
|
+
if (resolutionMode !== 'local' && resolutionMode !== 'dynamic') {
|
|
95
|
+
throw new Error('resolutionMode must be local or dynamic');
|
|
96
|
+
}
|
|
97
|
+
const publishingMode = lane.publishingMode;
|
|
98
|
+
if (publishingMode !== 'automatic' && publishingMode !== 'managed') {
|
|
99
|
+
throw new Error('publishingMode must be automatic or managed');
|
|
100
|
+
}
|
|
101
|
+
if (lane.rolloutAlgorithm !== types_1.RUNTIME_DELIVERY_ROLLOUT_ALGORITHM) {
|
|
102
|
+
throw new Error('Unsupported rollout algorithm');
|
|
103
|
+
}
|
|
104
|
+
if (typeof lane.candidateSetComplete !== 'boolean') {
|
|
105
|
+
throw new Error('candidateSetComplete must be boolean');
|
|
106
|
+
}
|
|
107
|
+
const releaseValues = Array.isArray(lane.releases) ? lane.releases : null;
|
|
108
|
+
const rolloutValues = Array.isArray(lane.publishedRollouts) ? lane.publishedRollouts : null;
|
|
109
|
+
const patchValues = Array.isArray(lane.patchEdges) ? lane.patchEdges : null;
|
|
110
|
+
const revokedValues = Array.isArray(lane.revokedHashes) ? lane.revokedHashes : null;
|
|
111
|
+
if (!releaseValues || !rolloutValues || !patchValues || !revokedValues) {
|
|
112
|
+
throw new Error('Manifest candidate arrays are required');
|
|
113
|
+
}
|
|
114
|
+
if (releaseValues.length > 21) {
|
|
115
|
+
throw new Error('Runtime manifest may contain at most 21 releases');
|
|
116
|
+
}
|
|
117
|
+
const releases = releaseValues.map((value, index) => {
|
|
118
|
+
const release = requireRecord(value, `releases[${index}]`);
|
|
119
|
+
requireExactKeys(release, [
|
|
120
|
+
'releaseRef', 'bundleHash', 'bundleVersion', 'version', 'runtimeVersion',
|
|
121
|
+
'manifestHash', 'jsBundleHash', 'fullBundleHash', 'fullBundleSizeBytes',
|
|
122
|
+
'available', 'expiresAt',
|
|
123
|
+
], `releases[${index}]`);
|
|
124
|
+
if (typeof release.available !== 'boolean') {
|
|
125
|
+
throw new Error(`releases[${index}].available must be boolean`);
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
releaseRef: requireString(release.releaseRef, `releases[${index}].releaseRef`),
|
|
129
|
+
bundleHash: requireHash(release.bundleHash, `releases[${index}].bundleHash`),
|
|
130
|
+
bundleVersion: requireInteger(release.bundleVersion, `releases[${index}].bundleVersion`),
|
|
131
|
+
version: release.version === undefined
|
|
132
|
+
? undefined
|
|
133
|
+
: requireString(release.version, `releases[${index}].version`),
|
|
134
|
+
runtimeVersion: requireString(release.runtimeVersion, `releases[${index}].runtimeVersion`),
|
|
135
|
+
manifestHash: requireHash(release.manifestHash, `releases[${index}].manifestHash`),
|
|
136
|
+
jsBundleHash: requireHash(release.jsBundleHash, `releases[${index}].jsBundleHash`),
|
|
137
|
+
fullBundleHash: requireHash(release.fullBundleHash, `releases[${index}].fullBundleHash`),
|
|
138
|
+
fullBundleSizeBytes: requirePositiveInteger(release.fullBundleSizeBytes, `releases[${index}].fullBundleSizeBytes`),
|
|
139
|
+
available: release.available,
|
|
140
|
+
expiresAt: optionalTimestamp(release.expiresAt, `releases[${index}].expiresAt`),
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
const publishedRollouts = rolloutValues.map((value, index) => {
|
|
144
|
+
const rollout = requireRecord(value, `publishedRollouts[${index}]`);
|
|
145
|
+
requireExactKeys(rollout, ['releaseRef', 'rolloutPercentage', 'status'], `publishedRollouts[${index}]`);
|
|
146
|
+
const percentage = requireFiniteNumber(rollout.rolloutPercentage, `publishedRollouts[${index}].rolloutPercentage`);
|
|
147
|
+
if (percentage > 100)
|
|
148
|
+
throw new Error('rolloutPercentage must be at most 100');
|
|
149
|
+
if (rollout.status !== 'active' && rollout.status !== 'completed') {
|
|
150
|
+
throw new Error(`publishedRollouts[${index}].status is invalid`);
|
|
151
|
+
}
|
|
152
|
+
const status = rollout.status;
|
|
153
|
+
return {
|
|
154
|
+
releaseRef: requireString(rollout.releaseRef, `publishedRollouts[${index}].releaseRef`),
|
|
155
|
+
rolloutPercentage: percentage,
|
|
156
|
+
status,
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
const patchPolicy = requireRecord(lane.patchPolicy, 'patchPolicy');
|
|
160
|
+
requireExactKeys(patchPolicy, ['enabled', 'maxPatchToFullRatio'], 'patchPolicy');
|
|
161
|
+
if (typeof patchPolicy.enabled !== 'boolean')
|
|
162
|
+
throw new Error('patchPolicy.enabled must be boolean');
|
|
163
|
+
const maxPatchToFullRatio = requireFiniteNumber(patchPolicy.maxPatchToFullRatio, 'patchPolicy.maxPatchToFullRatio');
|
|
164
|
+
if (maxPatchToFullRatio > 1)
|
|
165
|
+
throw new Error('maxPatchToFullRatio must be at most 1');
|
|
166
|
+
const patchEdges = patchValues.map((value, index) => {
|
|
167
|
+
const edge = requireRecord(value, `patchEdges[${index}]`);
|
|
168
|
+
requireExactKeys(edge, [
|
|
169
|
+
'baseHash', 'targetHash', 'algorithm', 'patchSetHash', 'patchArtifactRef',
|
|
170
|
+
'patchSizeBytes', 'fullBundleSizeBytes', 'missingAssetsHash', 'expiresAt',
|
|
171
|
+
], `patchEdges[${index}]`);
|
|
172
|
+
const missingAssetsHash = edge.missingAssetsHash === null
|
|
173
|
+
? null
|
|
174
|
+
: edge.missingAssetsHash === undefined
|
|
175
|
+
? undefined
|
|
176
|
+
: requireHash(edge.missingAssetsHash, `patchEdges[${index}].missingAssetsHash`);
|
|
177
|
+
return {
|
|
178
|
+
baseHash: requireHash(edge.baseHash, `patchEdges[${index}].baseHash`),
|
|
179
|
+
targetHash: requireHash(edge.targetHash, `patchEdges[${index}].targetHash`),
|
|
180
|
+
algorithm: requireString(edge.algorithm, `patchEdges[${index}].algorithm`),
|
|
181
|
+
patchSetHash: requireHash(edge.patchSetHash, `patchEdges[${index}].patchSetHash`),
|
|
182
|
+
patchArtifactRef: requireString(edge.patchArtifactRef, `patchEdges[${index}].patchArtifactRef`),
|
|
183
|
+
patchSizeBytes: requirePositiveInteger(edge.patchSizeBytes, `patchEdges[${index}].patchSizeBytes`),
|
|
184
|
+
fullBundleSizeBytes: requirePositiveInteger(edge.fullBundleSizeBytes, `patchEdges[${index}].fullBundleSizeBytes`),
|
|
185
|
+
missingAssetsHash,
|
|
186
|
+
expiresAt: optionalTimestamp(edge.expiresAt, `patchEdges[${index}].expiresAt`),
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
const generation = requireInteger(lane.generation, 'generation');
|
|
190
|
+
if (generation < 1)
|
|
191
|
+
throw new Error('generation must be at least 1');
|
|
192
|
+
const manifest = {
|
|
193
|
+
schemaVersion: 3,
|
|
194
|
+
type: 'lane',
|
|
195
|
+
projectSlug: requireString(lane.projectSlug, 'projectSlug'),
|
|
196
|
+
channelName: requireString(lane.channelName, 'channelName'),
|
|
197
|
+
platform: requireString(lane.platform, 'platform'),
|
|
198
|
+
runtimeVersion: requireString(lane.runtimeVersion, 'runtimeVersion'),
|
|
199
|
+
generation,
|
|
200
|
+
generatedAt: requireTimestamp(lane.generatedAt, 'generatedAt'),
|
|
201
|
+
resolutionMode,
|
|
202
|
+
dynamicReason: lane.dynamicReason === undefined
|
|
203
|
+
? undefined
|
|
204
|
+
: requireString(lane.dynamicReason, 'dynamicReason'),
|
|
205
|
+
publishingMode,
|
|
206
|
+
rolloutAlgorithm: types_1.RUNTIME_DELIVERY_ROLLOUT_ALGORITHM,
|
|
207
|
+
revokedHashes: revokedValues.map((hash, index) => requireHash(hash, `revokedHashes[${index}]`)),
|
|
208
|
+
releases,
|
|
209
|
+
publishedRollouts,
|
|
210
|
+
patchPolicy: { enabled: patchPolicy.enabled, maxPatchToFullRatio },
|
|
211
|
+
patchEdges,
|
|
212
|
+
candidateSetComplete: lane.candidateSetComplete,
|
|
213
|
+
};
|
|
214
|
+
if (new Set(manifest.revokedHashes).size !== manifest.revokedHashes.length) {
|
|
215
|
+
throw new Error('revokedHashes must contain unique values');
|
|
216
|
+
}
|
|
217
|
+
if (manifest.resolutionMode === 'local') {
|
|
218
|
+
if (!manifest.candidateSetComplete) {
|
|
219
|
+
throw new Error('Local runtime manifests require a complete candidate set');
|
|
220
|
+
}
|
|
221
|
+
if (manifest.releases.some(release => !release.available)) {
|
|
222
|
+
throw new Error('Local runtime manifests require available releases');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else if (!manifest.dynamicReason ||
|
|
226
|
+
manifest.candidateSetComplete ||
|
|
227
|
+
manifest.releases.length ||
|
|
228
|
+
manifest.publishedRollouts.length ||
|
|
229
|
+
manifest.patchEdges.length) {
|
|
230
|
+
throw new Error('Dynamic runtime manifests require a reason and the safe empty candidate shape');
|
|
231
|
+
}
|
|
232
|
+
validateCandidateConsistency(manifest);
|
|
233
|
+
return manifest;
|
|
234
|
+
}
|
|
235
|
+
function validateCandidateConsistency(manifest) {
|
|
236
|
+
const releaseRefs = new Set();
|
|
237
|
+
const releaseHashes = new Set();
|
|
238
|
+
const releaseByHash = new Map(manifest.releases.map(release => [release.bundleHash, release]));
|
|
239
|
+
for (const release of manifest.releases) {
|
|
240
|
+
if (release.runtimeVersion !== manifest.runtimeVersion)
|
|
241
|
+
throw new Error('Release runtime identity mismatch');
|
|
242
|
+
if (releaseRefs.has(release.releaseRef) || releaseHashes.has(release.bundleHash)) {
|
|
243
|
+
throw new Error('Manifest contains duplicate release identity');
|
|
244
|
+
}
|
|
245
|
+
releaseRefs.add(release.releaseRef);
|
|
246
|
+
releaseHashes.add(release.bundleHash);
|
|
247
|
+
}
|
|
248
|
+
const rolloutRefs = new Set();
|
|
249
|
+
for (const rollout of manifest.publishedRollouts) {
|
|
250
|
+
if (!releaseRefs.has(rollout.releaseRef) || rolloutRefs.has(rollout.releaseRef)) {
|
|
251
|
+
throw new Error('Published rollout references an unknown or duplicate release');
|
|
252
|
+
}
|
|
253
|
+
rolloutRefs.add(rollout.releaseRef);
|
|
254
|
+
}
|
|
255
|
+
const patchEdgeIdentities = new Set();
|
|
256
|
+
for (const edge of manifest.patchEdges) {
|
|
257
|
+
const target = releaseByHash.get(edge.targetHash);
|
|
258
|
+
if (!target || edge.fullBundleSizeBytes !== target.fullBundleSizeBytes) {
|
|
259
|
+
throw new Error('Patch edge is inconsistent with its target release');
|
|
260
|
+
}
|
|
261
|
+
const identity = `${edge.baseHash}\0${edge.targetHash}\0${edge.algorithm}`;
|
|
262
|
+
if (patchEdgeIdentities.has(identity)) {
|
|
263
|
+
throw new Error('Manifest contains duplicate patch edge identity');
|
|
264
|
+
}
|
|
265
|
+
patchEdgeIdentities.add(identity);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function assertLaneIdentity(manifest, expected) {
|
|
269
|
+
for (const field of ['projectSlug', 'channelName', 'platform', 'runtimeVersion']) {
|
|
270
|
+
if (manifest[field] !== expected[field]) {
|
|
271
|
+
throw new RuntimeDeliveryManifestError('lane_mismatch', `Manifest ${field} identity mismatch`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function assertPublicKey(key) {
|
|
276
|
+
if (!key || key.kty !== 'EC' || key.crv !== 'P-256') {
|
|
277
|
+
throw new RuntimeDeliveryManifestError('unknown_key', 'Unknown or invalid manifest signing key');
|
|
278
|
+
}
|
|
279
|
+
if ((0, encoding_1.decodeBase64UrlBytes)(key.x).length !== 32 || (0, encoding_1.decodeBase64UrlBytes)(key.y).length !== 32) {
|
|
280
|
+
throw new RuntimeDeliveryManifestError('unknown_key', 'Manifest signing key coordinates must be 32 bytes');
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async function verifyRuntimeDeliveryManifest(serializedJws, expectedIdentity, publicKeys) {
|
|
284
|
+
const payloadValue = await verifyRuntimeDeliverySignedPayload(serializedJws, types_1.RUNTIME_DELIVERY_MANIFEST_JWS_TYPE, publicKeys);
|
|
285
|
+
const manifest = parseLaneManifest(JSON.parse((0, encoding_1.decodeBase64UrlUtf8)(payloadValue)));
|
|
286
|
+
assertLaneIdentity(manifest, expectedIdentity);
|
|
287
|
+
const payloadSha256 = await fs_1.default.sha256String(payloadValue);
|
|
288
|
+
const previousState = await (0, manifestState_1.readVerifiedLaneState)(expectedIdentity);
|
|
289
|
+
if (previousState && manifest.generation < previousState.highestGeneration) {
|
|
290
|
+
throw new RuntimeDeliveryManifestError('generation_regression', 'Runtime manifest generation regressed');
|
|
291
|
+
}
|
|
292
|
+
if (previousState &&
|
|
293
|
+
manifest.generation === previousState.highestGeneration &&
|
|
294
|
+
previousState.payloadSha256 !== payloadSha256) {
|
|
295
|
+
throw new RuntimeDeliveryManifestError('generation_equivocation', 'Runtime manifest generation equivocation detected');
|
|
296
|
+
}
|
|
297
|
+
await (0, manifestState_1.recordVerifiedLaneManifest)(manifest, payloadSha256, async (runtimeRevokedHashes) => {
|
|
298
|
+
const persisted = await (0, rollbackState_1.syncVerifiedRevokedHashes)(runtimeRevokedHashes);
|
|
299
|
+
if (!persisted) {
|
|
300
|
+
throw new Error('Native startup recovery rejected the verified revocation set');
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
return manifest;
|
|
304
|
+
}
|
|
305
|
+
async function verifyRuntimeDeliverySignedPayload(serializedJws, expectedType, publicKeys) {
|
|
306
|
+
if ((0, encoding_1.utf8ByteLength)(serializedJws) > exports.MAX_RUNTIME_MANIFEST_BYTES) {
|
|
307
|
+
throw new RuntimeDeliveryManifestError('body_too_large', 'Runtime manifest exceeds the 1 MB safety limit');
|
|
308
|
+
}
|
|
309
|
+
const envelope = requireRecord(JSON.parse(serializedJws), 'JWS envelope');
|
|
310
|
+
if (Object.keys(envelope).sort().join(',') !== 'payload,protected,signature') {
|
|
311
|
+
throw new Error('JWS envelope contains unsupported fields');
|
|
312
|
+
}
|
|
313
|
+
const protectedValue = requireString(envelope.protected, 'JWS protected');
|
|
314
|
+
const payloadValue = requireString(envelope.payload, 'JWS payload');
|
|
315
|
+
const signatureValue = requireString(envelope.signature, 'JWS signature');
|
|
316
|
+
if ((0, encoding_1.decodeBase64UrlBytes)(signatureValue).length !== 64) {
|
|
317
|
+
throw new RuntimeDeliveryManifestError('invalid_signature', 'ES256 JWS signature must be 64-byte JOSE R||S');
|
|
318
|
+
}
|
|
319
|
+
const protectedHeader = requireRecord(JSON.parse((0, encoding_1.decodeBase64UrlUtf8)(protectedValue)), 'JWS protected header');
|
|
320
|
+
if (Object.keys(protectedHeader).sort().join(',') !== 'alg,kid,typ') {
|
|
321
|
+
throw new Error('JWS protected header contains unsupported fields');
|
|
322
|
+
}
|
|
323
|
+
if (protectedHeader.alg !== 'ES256' ||
|
|
324
|
+
protectedHeader.typ !== expectedType ||
|
|
325
|
+
typeof protectedHeader.kid !== 'string' || !protectedHeader.kid) {
|
|
326
|
+
throw new Error('Unsupported JWS protected header');
|
|
327
|
+
}
|
|
328
|
+
const publicKey = publicKeys[protectedHeader.kid];
|
|
329
|
+
assertPublicKey(publicKey);
|
|
330
|
+
const verified = await fs_1.default.verifyEs256Signature(`${protectedValue}.${payloadValue}`, signatureValue, publicKey.x, publicKey.y);
|
|
331
|
+
if (!verified) {
|
|
332
|
+
throw new RuntimeDeliveryManifestError('invalid_signature', 'Runtime manifest signature verification failed');
|
|
333
|
+
}
|
|
334
|
+
return payloadValue;
|
|
335
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UpdateCheckResponse } from '../api/types';
|
|
2
|
+
import type { UserProperties } from '../fs/userProperties';
|
|
3
|
+
import type { RuntimeDeliveryLaneIdentity, RuntimeDeliveryLaneManifest } from './types';
|
|
4
|
+
export type RuntimeDeliveryResolveContext = {
|
|
5
|
+
channelName: string;
|
|
6
|
+
currentHash: string | null;
|
|
7
|
+
rejectedHashes: string[];
|
|
8
|
+
installId: string;
|
|
9
|
+
patchAlgorithms: string[];
|
|
10
|
+
supportsContentAddressedAssets: boolean;
|
|
11
|
+
environment: string | null;
|
|
12
|
+
userProperties: UserProperties;
|
|
13
|
+
};
|
|
14
|
+
export declare function runtimeDeliveryManifestUrl(identity: RuntimeDeliveryLaneIdentity): string;
|
|
15
|
+
export declare function runtimeDeliveryAuthorityLeaseUrl(): string;
|
|
16
|
+
export declare function fetchRuntimeDeliveryManifest(channelName: string): Promise<RuntimeDeliveryLaneManifest>;
|
|
17
|
+
export declare function resolveFromRuntimeDeliveryManifest(manifest: RuntimeDeliveryLaneManifest, context: RuntimeDeliveryResolveContext): Promise<UpdateCheckResponse>;
|
|
18
|
+
export declare function reportActiveInstall(context: RuntimeDeliveryResolveContext): void;
|
|
19
|
+
export declare function shouldRollbackFromLastKnownRevocations(channelName: string, currentHash: string | null): Promise<boolean>;
|