Add SHA-256 lastModificationSignature to resource.json

Ignition requires this signature to validate resource integrity.
Without it, the Designer fails with "Error reading updated project".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
igurielidze 2026-03-30 23:32:00 +04:00
parent 99db2d5da8
commit 46cec1c12e

View File

@ -569,6 +569,12 @@ export async function deployToIgnition() {
}, },
}, null, 2); }, null, 2);
// Compute SHA-256 signature of view.json for Ignition resource integrity
const viewBytes = new TextEncoder().encode(viewJson);
const hashBuffer = await crypto.subtle.digest('SHA-256', viewBytes);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const signature = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
const resourceJson = JSON.stringify({ const resourceJson = JSON.stringify({
scope: 'G', scope: 'G',
version: 1, version: 1,
@ -576,8 +582,9 @@ export async function deployToIgnition() {
overridable: true, overridable: true,
files: ['view.json'], files: ['view.json'],
attributes: { attributes: {
lastModificationSignature: signature,
lastModification: { lastModification: {
actor: 'scada-layout-tool', actor: 'admin',
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}, },
}, },