Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): hash without crypto.subtle in insecure contexts
Lincoln Stein4985dc419419
diff --git a/invokeai/frontend/webv2/performance/architecture-baseline.json b/invokeai/frontend/webv2/performance/architecture-baseline.jsonindex a2b7b886d3..bc32888a85 100644--- a/invokeai/frontend/webv2/performance/architecture-baseline.json+++ b/invokeai/frontend/webv2/performance/architecture-baseline.json@@ -2,17 +2,17 @@"build": {"launchpad": {"baseline": {- "brotliBytes": 848736,+ "brotliBytes": 849939,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 847916,+ "gzipBytes": 849088,"imageRawBytes": 156376,- "initialRawBytes": 1982717,+ "initialRawBytes": 1984807,"largestAssetRawBytes": 746121,"otherAssetRawBytes": 0,- "ownedRawBytes": 73898,- "requestCount": 43,- "scriptRequestCount": 27,+ "ownedRawBytes": 73933,+ "requestCount": 44,+ "scriptRequestCount": 28,"sourceOwners": ["package:@ark-ui/react","package:@chakra-ui/react",@@ -174,6 +174,7 @@"source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts","source:src/platform/browser/randomUuid.ts",+ "source:src/platform/browser/sha256.ts","source:src/platform/core/concurrency.ts","source:src/platform/i18n/client.ts","source:src/platform/i18n/languages.ts",@@ -297,17 +298,17 @@]},"limits": {- "brotliBytes": 857224,+ "brotliBytes": 858439,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 856396,+ "gzipBytes": 857579,"imageRawBytes": 157940,- "initialRawBytes": 2002545,+ "initialRawBytes": 2004656,"largestAssetRawBytes": 753583,"otherAssetRawBytes": 0,- "ownedRawBytes": 73898,- "requestCount": 43,- "scriptRequestCount": 27+ "ownedRawBytes": 73933,+ "requestCount": 44,+ "scriptRequestCount": 28},"owner": "app","remediationTicket": "set-performance-budgets",@@ -315,17 +316,17 @@},"editor": {"baseline": {- "brotliBytes": 1146936,+ "brotliBytes": 1148325,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 1141728,+ "gzipBytes": 1142958,"imageRawBytes": 156376,- "initialRawBytes": 2888767,+ "initialRawBytes": 2891084,"largestAssetRawBytes": 746121,"otherAssetRawBytes": 0,- "ownedRawBytes": 132886,- "requestCount": 104,- "scriptRequestCount": 88,+ "ownedRawBytes": 132954,+ "requestCount": 105,+ "scriptRequestCount": 89,"sourceOwners": ["package:@ark-ui/react","package:@chakra-ui/react",@@ -641,6 +642,7 @@"source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts","source:src/platform/browser/randomUuid.ts",+ "source:src/platform/browser/sha256.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",@@ -969,17 +971,17 @@]},"limits": {- "brotliBytes": 1158406,+ "brotliBytes": 1159809,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 1153146,+ "gzipBytes": 1154388,"imageRawBytes": 157940,- "initialRawBytes": 2917655,+ "initialRawBytes": 2919995,"largestAssetRawBytes": 753583,"otherAssetRawBytes": 0,- "ownedRawBytes": 132886,- "requestCount": 104,- "scriptRequestCount": 88+ "ownedRawBytes": 132954,+ "requestCount": 105,+ "scriptRequestCount": 89},"owner": "workbench","remediationTicket": "deepen-widget-registry-loading",diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.jsonindex e6de7fbeba..6e45b11291 100644--- a/invokeai/frontend/webv2/performance/browser-baseline.json+++ b/invokeai/frontend/webv2/performance/browser-baseline.json@@ -25,13 +25,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 94.10000002384186,+ "domContentLoadedMedianMs": 96.39999997615814,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 94.20000004768372,- "longestTaskMaxMs": 55,+ "loadMedianMs": 96.5,+ "longestTaskMaxMs": 57,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -41,24 +41,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 38,- "scriptRawBytes": 1662847,- "scriptRequestCount": 34,- "totalRawBytes": 1858279+ "otherRawBytes": 169687,+ "requestCount": 39,+ "scriptRawBytes": 1664937,+ "scriptRequestCount": 35,+ "totalRawBytes": 1860447},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 38,- "scriptRawBytes": 1679476,- "scriptRequestCount": 34,- "totalRawBytes": 1876862+ "otherRawBytes": 171384,+ "requestCount": 39,+ "scriptRawBytes": 1681587,+ "scriptRequestCount": 35,+ "totalRawBytes": 1879052},- "routeReadyMedianMs": 214.89999997615814,+ "routeReadyMedianMs": 219.10000002384186,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "empty"},@@ -85,12 +85,12 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 96,+ "domContentLoadedMedianMs": 95.40000009536743,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 96.10000002384186,+ "loadMedianMs": 95.60000002384186,"longestTaskMaxMs": 56,"owner": "app","projectSwitchMedianMs": 0,@@ -101,24 +101,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 38,- "scriptRawBytes": 1662847,- "scriptRequestCount": 34,- "totalRawBytes": 1858279+ "otherRawBytes": 169687,+ "requestCount": 39,+ "scriptRawBytes": 1664937,+ "scriptRequestCount": 35,+ "totalRawBytes": 1860447},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 38,- "scriptRawBytes": 1679476,- "scriptRequestCount": 34,- "totalRawBytes": 1876862+ "otherRawBytes": 171384,+ "requestCount": 39,+ "scriptRawBytes": 1681587,+ "scriptRequestCount": 35,+ "totalRawBytes": 1879052},- "routeReadyMedianMs": 229,+ "routeReadyMedianMs": 225.70000004768372,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "representative"},@@ -145,15 +145,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 93.30000007152557,+ "domContentLoadedMedianMs": 94.10000002384186,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 93.39999997615814,+ "loadMedianMs": 94.20000004768372,"longestTaskMaxMs": 105,"owner": "workbench",- "projectSwitchMedianMs": 29.799999952316284,+ "projectSwitchMedianMs": 30.40000009536743,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -161,24 +161,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 122,- "scriptRawBytes": 3437481,- "scriptRequestCount": 117,- "totalRawBytes": 3789289+ "otherRawBytes": 169687,+ "requestCount": 123,+ "scriptRawBytes": 3439620,+ "scriptRequestCount": 118,+ "totalRawBytes": 3791506},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 122,- "scriptRawBytes": 3471856,- "scriptRequestCount": 117,- "totalRawBytes": 3827182+ "otherRawBytes": 171384,+ "requestCount": 123,+ "scriptRawBytes": 3474017,+ "scriptRequestCount": 118,+ "totalRawBytes": 3829422},- "routeReadyMedianMs": 352.10000002384186,+ "routeReadyMedianMs": 356.39999997615814,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -205,15 +205,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 95.20000004768372,+ "domContentLoadedMedianMs": 95.40000009536743,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 95.30000007152557,- "longestTaskMaxMs": 106,+ "loadMedianMs": 95.5,+ "longestTaskMaxMs": 102,"owner": "workbench",- "projectSwitchMedianMs": 35,+ "projectSwitchMedianMs": 35.299999952316284,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -221,24 +221,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 122,- "scriptRawBytes": 3437481,- "scriptRequestCount": 117,- "totalRawBytes": 3789289+ "otherRawBytes": 169687,+ "requestCount": 123,+ "scriptRawBytes": 3439620,+ "scriptRequestCount": 118,+ "totalRawBytes": 3791506},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 122,- "scriptRawBytes": 3471856,- "scriptRequestCount": 117,- "totalRawBytes": 3827182+ "otherRawBytes": 171384,+ "requestCount": 123,+ "scriptRawBytes": 3474017,+ "scriptRequestCount": 118,+ "totalRawBytes": 3829422},- "routeReadyMedianMs": 354.60000002384186,+ "routeReadyMedianMs": 357.6999999284744,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -265,13 +265,13 @@"scriptRequestCount": 7,"totalRawBytes": 486770},- "domContentLoadedMedianMs": 95.5,+ "domContentLoadedMedianMs": 96.90000009536743,"id": "editor-canvas",- "layoutAckMedianMs": 2.100000023841858,- "layoutReturnSwitchMedianMs": 48.60000002384186,- "layoutSwitchMedianMs": 77.80000007152557,- "loadMedianMs": 95.70000004768372,- "longestTaskMaxMs": 113,+ "layoutAckMedianMs": 2.0999999046325684,+ "layoutReturnSwitchMedianMs": 48,+ "layoutSwitchMedianMs": 76.89999997615814,+ "loadMedianMs": 97.10000002384186,+ "longestTaskMaxMs": 114,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -281,24 +281,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 129,- "scriptRawBytes": 3919431,- "scriptRequestCount": 124,- "totalRawBytes": 4271239+ "otherRawBytes": 169687,+ "requestCount": 130,+ "scriptRawBytes": 3921570,+ "scriptRequestCount": 125,+ "totalRawBytes": 4273456},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 129,- "scriptRawBytes": 3958626,- "scriptRequestCount": 124,- "totalRawBytes": 4313952+ "otherRawBytes": 171384,+ "requestCount": 130,+ "scriptRawBytes": 3960786,+ "scriptRequestCount": 125,+ "totalRawBytes": 4316191},- "routeReadyMedianMs": 1025,+ "routeReadyMedianMs": 1025.9000000953674,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "empty"},@@ -325,13 +325,13 @@"scriptRequestCount": 7,"totalRawBytes": 486770},- "domContentLoadedMedianMs": 96.29999995231628,+ "domContentLoadedMedianMs": 96.09999990463257,"id": "editor-canvas",- "layoutAckMedianMs": 3.399999976158142,- "layoutReturnSwitchMedianMs": 45.700000047683716,- "layoutSwitchMedianMs": 77.39999997615814,- "loadMedianMs": 96.5,- "longestTaskMaxMs": 152,+ "layoutAckMedianMs": 3.100000023841858,+ "layoutReturnSwitchMedianMs": 45.200000047683716,+ "layoutSwitchMedianMs": 77.70000004768372,+ "loadMedianMs": 96.19999992847443,+ "longestTaskMaxMs": 151,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -341,24 +341,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 129,- "scriptRawBytes": 3919431,- "scriptRequestCount": 124,- "totalRawBytes": 4271239+ "otherRawBytes": 169687,+ "requestCount": 130,+ "scriptRawBytes": 3921570,+ "scriptRequestCount": 125,+ "totalRawBytes": 4273456},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 129,- "scriptRawBytes": 3958626,- "scriptRequestCount": 124,- "totalRawBytes": 4313952+ "otherRawBytes": 171384,+ "requestCount": 130,+ "scriptRawBytes": 3960786,+ "scriptRequestCount": 125,+ "totalRawBytes": 4316191},- "routeReadyMedianMs": 1048.5,+ "routeReadyMedianMs": 1047.2999999523163,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "representative"},@@ -370,9 +370,9 @@"largestAssetRawBytes": 173980,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 364400,+ "scriptRawBytes": 364426,"scriptRequestCount": 6,- "totalRawBytes": 379813+ "totalRawBytes": 379839},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -381,17 +381,17 @@"largestAssetRawBytes": 175720,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 368044,+ "scriptRawBytes": 368071,"scriptRequestCount": 6,- "totalRawBytes": 383612+ "totalRawBytes": 383638},- "domContentLoadedMedianMs": 93.60000002384186,+ "domContentLoadedMedianMs": 94.79999995231628,"id": "editor-workflow",- "layoutAckMedianMs": 2.100000023841858,- "layoutReturnSwitchMedianMs": 29.299999952316284,+ "layoutAckMedianMs": 1.9000000953674316,+ "layoutReturnSwitchMedianMs": 29.300000071525574,"layoutSwitchMedianMs": 75.5,- "loadMedianMs": 93.70000004768372,- "longestTaskMaxMs": 104,+ "loadMedianMs": 94.79999995231628,+ "longestTaskMaxMs": 103,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -401,24 +401,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 129,- "scriptRawBytes": 3801881,- "scriptRequestCount": 123,- "totalRawBytes": 4169102+ "otherRawBytes": 169687,+ "requestCount": 130,+ "scriptRawBytes": 3804046,+ "scriptRequestCount": 124,+ "totalRawBytes": 4171345},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 129,- "scriptRawBytes": 3839900,- "scriptRequestCount": 123,- "totalRawBytes": 4210794+ "otherRawBytes": 171384,+ "requestCount": 130,+ "scriptRawBytes": 3842087,+ "scriptRequestCount": 124,+ "totalRawBytes": 4213059},- "routeReadyMedianMs": 1032.8999999761581,+ "routeReadyMedianMs": 1047.6999999284744,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "empty"},@@ -430,9 +430,9 @@"largestAssetRawBytes": 173980,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 364400,+ "scriptRawBytes": 364426,"scriptRequestCount": 6,- "totalRawBytes": 379813+ "totalRawBytes": 379839},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -441,17 +441,17 @@"largestAssetRawBytes": 175720,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 368044,+ "scriptRawBytes": 368071,"scriptRequestCount": 6,- "totalRawBytes": 383612+ "totalRawBytes": 383638},- "domContentLoadedMedianMs": 96,+ "domContentLoadedMedianMs": 93.39999997615814,"id": "editor-workflow",- "layoutAckMedianMs": 3.299999952316284,- "layoutReturnSwitchMedianMs": 35.299999952316284,- "layoutSwitchMedianMs": 110.10000002384186,- "loadMedianMs": 96.09999990463257,- "longestTaskMaxMs": 277,+ "layoutAckMedianMs": 2.6999999284744263,+ "layoutReturnSwitchMedianMs": 34.60000002384186,+ "layoutSwitchMedianMs": 108.5,+ "loadMedianMs": 93.39999997615814,+ "longestTaskMaxMs": 288,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -461,24 +461,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 129,- "scriptRawBytes": 3801881,- "scriptRequestCount": 123,- "totalRawBytes": 4169102+ "otherRawBytes": 169687,+ "requestCount": 130,+ "scriptRawBytes": 3804046,+ "scriptRequestCount": 124,+ "totalRawBytes": 4171345},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 129,- "scriptRawBytes": 3839900,- "scriptRequestCount": 123,- "totalRawBytes": 4210794+ "otherRawBytes": 171384,+ "requestCount": 130,+ "scriptRawBytes": 3842087,+ "scriptRequestCount": 124,+ "totalRawBytes": 4213059},- "routeReadyMedianMs": 1084.5,+ "routeReadyMedianMs": 1069.5,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "representative"},@@ -505,13 +505,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 93,+ "domContentLoadedMedianMs": 98.09999990463257,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 20.700000047683716,- "loadMedianMs": 93.10000002384186,- "longestTaskMaxMs": 105,+ "layoutSwitchMedianMs": 20.300000071525574,+ "loadMedianMs": 98.29999995231628,+ "longestTaskMaxMs": 103,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -521,24 +521,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 122,- "scriptRawBytes": 3437481,- "scriptRequestCount": 117,- "totalRawBytes": 3789289+ "otherRawBytes": 169687,+ "requestCount": 123,+ "scriptRawBytes": 3439620,+ "scriptRequestCount": 118,+ "totalRawBytes": 3791506},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 122,- "scriptRawBytes": 3471856,- "scriptRequestCount": 117,- "totalRawBytes": 3827182+ "otherRawBytes": 171384,+ "requestCount": 123,+ "scriptRawBytes": 3474017,+ "scriptRequestCount": 118,+ "totalRawBytes": 3829422},- "routeReadyMedianMs": 1232.6000000238419,+ "routeReadyMedianMs": 1236.4000000953674,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -565,13 +565,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 98.70000004768372,+ "domContentLoadedMedianMs": 94.90000009536743,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 26.700000047683716,- "loadMedianMs": 98.80000007152557,- "longestTaskMaxMs": 101,+ "layoutSwitchMedianMs": 27.200000047683716,+ "loadMedianMs": 95,+ "longestTaskMaxMs": 99,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -581,24 +581,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169609,- "requestCount": 122,- "scriptRawBytes": 3437481,- "scriptRequestCount": 117,- "totalRawBytes": 3789289+ "otherRawBytes": 169687,+ "requestCount": 123,+ "scriptRawBytes": 3439620,+ "scriptRequestCount": 118,+ "totalRawBytes": 3791506},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171306,- "requestCount": 122,- "scriptRawBytes": 3471856,- "scriptRequestCount": 117,- "totalRawBytes": 3827182+ "otherRawBytes": 171384,+ "requestCount": 123,+ "scriptRawBytes": 3474017,+ "scriptRequestCount": 118,+ "totalRawBytes": 3829422},- "routeReadyMedianMs": 1265.8000000715256,+ "routeReadyMedianMs": 1245.8000000715256,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"}@@ -804,6 +804,7 @@"source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts","source:src/platform/browser/randomUuid.ts",+ "source:src/platform/browser/sha256.ts","source:src/platform/core/concurrency.ts","source:src/platform/i18n/client.ts","source:src/platform/i18n/languages.ts",@@ -1386,6 +1387,7 @@"source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts","source:src/platform/browser/randomUuid.ts",+ "source:src/platform/browser/sha256.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",@@ -2374,6 +2376,7 @@"source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts","source:src/platform/browser/randomUuid.ts",+ "source:src/platform/browser/sha256.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",@@ -3574,6 +3577,7 @@"source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts","source:src/platform/browser/randomUuid.ts",+ "source:src/platform/browser/sha256.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",diff --git a/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts b/invokeai/frontend/webv2/src/architecture/secureContextApis.test.tsindex e9c2470f03..a96779b902 100644--- a/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts+++ b/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts@@ -1,11 +1,12 @@import { describe, expect, it } from 'vitest';/**- * `crypto.randomUUID` is undefined outside secure contexts, and the app is- * routinely opened over plain HTTP from another device on the LAN. Every id- * mint goes through `@platform/browser/randomUuid`, which falls back to- * `getRandomValues`; a direct call anywhere else reintroduces a startup crash- * that only shows up on a phone or tablet.+ * `crypto.randomUUID` and `crypto.subtle` are undefined outside secure contexts,+ * and the app is routinely opened over plain HTTP from another device on the+ * LAN. Every id mint goes through `@platform/browser/randomUuid` and every+ * digest through `@platform/browser/sha256`, which carry fallbacks; a direct+ * call anywhere else reintroduces a crash that only shows up on a phone or+ * tablet.*/const sources = import.meta.glob('../**/*.{ts,tsx}', {eager: true,@@ -13,14 +14,15 @@ const sources = import.meta.glob('../**/*.{ts,tsx}', {query: '?raw',}) as Record<string, string>;-const HELPER_PATH = '../platform/browser/randomUuid.ts';+const HELPER_PATHS = new Set(['../platform/browser/randomUuid.ts', '../platform/browser/sha256.ts']);+const SECURE_CONTEXT_ONLY = /\brandomUUID\b|\bcrypto\s*\.\s*subtle\b|\bsubtle\s*\.\s*digest\b/;const isTestFile = (path: string): boolean => /\.(test|spec|stories)\.tsx?$/.test(path);describe('secure-context web APIs', () => {- it('routes every production UUID mint through the randomUuid helper', () => {+ it('routes every production UUID mint and SHA-256 digest through the platform helpers', () => {const offenders = Object.entries(sources)- .filter(([path]) => path !== HELPER_PATH && !isTestFile(path))- .filter(([, text]) => /\brandomUUID\b/.test(text))+ .filter(([path]) => !HELPER_PATHS.has(path) && !isTestFile(path))+ .filter(([, text]) => SECURE_CONTEXT_ONLY.test(text)).map(([path]) => path.replace(/^\.\.\//, ''));expect(offenders).toEqual([]);diff --git a/invokeai/frontend/webv2/src/platform/browser/sha256.test.ts b/invokeai/frontend/webv2/src/platform/browser/sha256.test.tsnew file mode 100644index 0000000000..1e119f8499--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/sha256.test.ts@@ -0,0 +1,64 @@+import { sha256, sha256Fallback, sha256Hex } from '@platform/browser/sha256';+import { describe, expect, it, vi } from 'vitest';++const encode = (text: string): Uint8Array => new TextEncoder().encode(text);+const hex = (bytes: Uint8Array): string => Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');++const nativeHex = async (bytes: Uint8Array): Promise<string> =>+ hex(new Uint8Array(await crypto.subtle.digest('SHA-256', bytes as Uint8Array<ArrayBuffer>)));++describe('sha256Fallback', () => {+ it('matches the published test vectors', () => {+ expect(hex(sha256Fallback(encode('')))).toBe('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');+ expect(hex(sha256Fallback(encode('abc')))).toBe('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad');+ expect(hex(sha256Fallback(encode('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq')))).toBe(+ '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1'+ );+ });++ it('agrees with Web Crypto across the padding boundaries', async () => {+ for (const length of [0, 1, 55, 56, 57, 63, 64, 65, 119, 120, 128, 1000, 70_000]) {+ const bytes = new Uint8Array(length);+ for (let index = 0; index < length; index += 1) {+ bytes[index] = (index * 31 + length) & 0xff;+ }+ expect(hex(sha256Fallback(bytes)), `length ${length}`).toBe(await nativeHex(bytes));+ }+ });++ it('hashes a subarray by its own bytes, not the whole backing buffer', async () => {+ const backing = new Uint8Array(64).fill(0xab);+ const window = backing.subarray(8, 24);++ expect(hex(sha256Fallback(window))).toBe(await nativeHex(new Uint8Array(window)));+ });+});++describe('sha256 / sha256Hex', () => {+ it('uses the native digest when the context exposes one', async () => {+ const digest = vi.fn(crypto.subtle.digest.bind(crypto.subtle));+ const subtle = { digest } as unknown as SubtleCrypto;++ expect(await sha256Hex(encode('abc'), subtle)).toBe(+ 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'+ );+ expect(digest).toHaveBeenCalledOnce();+ });++ it('falls back to the JavaScript digest without one, with identical output', async () => {+ const bytes = encode('The quick brown fox jumps over the lazy dog');++ expect(await sha256Hex(bytes, undefined)).toBe(await nativeHex(bytes));+ expect(hex(await sha256(bytes.buffer as ArrayBuffer, undefined))).toBe(await nativeHex(bytes));+ });++ it('survives an ambient crypto object that lacks subtle', async () => {+ const original = globalThis.crypto;+ vi.stubGlobal('crypto', { getRandomValues: original.getRandomValues.bind(original) });+ try {+ expect(await sha256Hex(encode('abc'))).toBe('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad');+ } finally {+ vi.unstubAllGlobals();+ }+ });+});diff --git a/invokeai/frontend/webv2/src/platform/browser/sha256.ts b/invokeai/frontend/webv2/src/platform/browser/sha256.tsnew file mode 100644index 0000000000..2db33f7367--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/sha256.ts@@ -0,0 +1,137 @@+/**+ * SHA-256, with a pure-JavaScript fallback for insecure contexts.+ *+ * `crypto.subtle` is exposed only in secure contexts, exactly like+ * `crypto.randomUUID` (see `randomUuid.ts`). Opened over plain HTTP from another+ * device on the LAN, `crypto.subtle` is undefined and every content hash — paint+ * cache flushes, composites for generation, deterministic project ids — throws.+ * The fallback produces byte-identical digests, so ids derived from a hash stay+ * stable regardless of which path computed them.+ *+ * The fallback is slower than the native digest by a wide margin, so it is only+ * taken when the native API is absent. All hashing goes through here;+ * `crypto.subtle` must not be called directly elsewhere.+ */++const ROUND_CONSTANTS = new Uint32Array([+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98,+ 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,+ 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8,+ 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,+ 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,+ 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7,+ 0xc67178f2,+]);++const INITIAL_STATE = new Uint32Array([+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,+]);++const rotateRight = (value: number, bits: number): number => (value >>> bits) | (value << (32 - bits));++/** Pure-JavaScript SHA-256 over `message`, returning the 32-byte digest. */+export const sha256Fallback = (message: Uint8Array): Uint8Array => {+ const length = message.byteLength;+ // One 0x80 byte and an 8-byte big-endian bit length, padded to a 64-byte block.+ const paddedLength = Math.ceil((length + 9) / 64) * 64;+ const padded = new Uint8Array(paddedLength);+ padded.set(message);+ padded[length] = 0x80;+ const view = new DataView(padded.buffer);+ // The bit length as two 32-bit words; `length / 2^29` is the high word of `length * 8`.+ view.setUint32(paddedLength - 8, Math.floor(length / 0x20000000), false);+ view.setUint32(paddedLength - 4, (length << 3) >>> 0, false);++ const state = new Uint32Array(INITIAL_STATE);+ const schedule = new Uint32Array(64);++ for (let offset = 0; offset < paddedLength; offset += 64) {+ for (let index = 0; index < 16; index += 1) {+ schedule[index] = view.getUint32(offset + index * 4, false);+ }+ for (let index = 16; index < 64; index += 1) {+ const w15 = schedule[index - 15]!;+ const w2 = schedule[index - 2]!;+ const s0 = rotateRight(w15, 7) ^ rotateRight(w15, 18) ^ (w15 >>> 3);+ const s1 = rotateRight(w2, 17) ^ rotateRight(w2, 19) ^ (w2 >>> 10);+ schedule[index] = (schedule[index - 16]! + s0 + schedule[index - 7]! + s1) >>> 0;+ }++ let a = state[0]!;+ let b = state[1]!;+ let c = state[2]!;+ let d = state[3]!;+ let e = state[4]!;+ let f = state[5]!;+ let g = state[6]!;+ let h = state[7]!;++ for (let index = 0; index < 64; index += 1) {+ const bigSigma1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);+ const choose = (e & f) ^ (~e & g);+ const t1 = (h + bigSigma1 + choose + ROUND_CONSTANTS[index]! + schedule[index]!) >>> 0;+ const bigSigma0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);+ const majority = (a & b) ^ (a & c) ^ (b & c);+ const t2 = (bigSigma0 + majority) >>> 0;++ h = g;+ g = f;+ f = e;+ e = (d + t1) >>> 0;+ d = c;+ c = b;+ b = a;+ a = (t1 + t2) >>> 0;+ }++ state[0] = (state[0]! + a) >>> 0;+ state[1] = (state[1]! + b) >>> 0;+ state[2] = (state[2]! + c) >>> 0;+ state[3] = (state[3]! + d) >>> 0;+ state[4] = (state[4]! + e) >>> 0;+ state[5] = (state[5]! + f) >>> 0;+ state[6] = (state[6]! + g) >>> 0;+ state[7] = (state[7]! + h) >>> 0;+ }++ const digest = new Uint8Array(32);+ const digestView = new DataView(digest.buffer);+ for (let index = 0; index < 8; index += 1) {+ digestView.setUint32(index * 4, state[index]!, false);+ }+ return digest;+};++const toBytes = (data: ArrayBuffer | Uint8Array): Uint8Array =>+ data instanceof Uint8Array ? data : new Uint8Array(data);++const getSubtleCrypto = (): SubtleCrypto | undefined => {+ try {+ return globalThis.crypto?.subtle;+ } catch {+ return undefined;+ }+};++/** SHA-256 digest bytes of `data`, via Web Crypto when the context exposes it. */+export const sha256 = async (+ data: ArrayBuffer | Uint8Array,+ subtle: SubtleCrypto | undefined = getSubtleCrypto()+): Promise<Uint8Array> => {+ const bytes = toBytes(data);+ if (subtle) {+ return new Uint8Array(await subtle.digest('SHA-256', bytes as Uint8Array<ArrayBuffer>));+ }+ return sha256Fallback(bytes);+};++/** Lower-case hex SHA-256 of `data`. */+export const sha256Hex = async (data: ArrayBuffer | Uint8Array, subtle?: SubtleCrypto | undefined): Promise<string> => {+ const digest = await sha256(data, subtle);+ let hex = '';+ for (const byte of digest) {+ hex += byte.toString(16).padStart(2, '0');+ }+ return hex;+};diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.tsindex 2730dd56bb..bf35661b3b 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/document/bitmapStore.ts@@ -39,6 +39,8 @@ import type { CanvasProjectMutation } from '@workbench/canvas-engine/mutationConimport type { PaintCacheTrim } from '@workbench/canvas-engine/render/paintCacheTrim';import type { RasterSurface } from '@workbench/canvas-engine/render/raster';+import { sha256Hex } from '@platform/browser/sha256';+/** Default idle window before a dirty layer is flushed. */export const DEFAULT_DEBOUNCE_MS = 1500;/** Default upload attempts per flush (initial try + retries). */@@ -126,7 +128,7 @@ export interface BitmapStoreDeps {* mask must clear `mask.bitmap` while preserving its `fill`.*/clearBitmap?(layerId: string): boolean;- /** Content-hashes a blob (defaults to SHA-256 hex via `crypto.subtle`). */+ /** Content-hashes a blob (defaults to SHA-256 hex via `@platform/browser/sha256`). */hashBlob?(blob: Blob): Promise<string>;/** Idle debounce window in ms (default {@link DEFAULT_DEBOUNCE_MS}). */debounceMs?: number;@@ -200,17 +202,8 @@ const defaultTimers: BitmapStoreTimers = {setTimeout: (handler, ms) => globalThis.setTimeout(handler, ms),};-/** SHA-256 hex of a blob's bytes, via the Web Crypto API (Node ≥ 20 exposes `crypto.subtle`). */-const defaultHashBlob = async (blob: Blob): Promise<string> => {- const buffer = await blob.arrayBuffer();- const digest = await crypto.subtle.digest('SHA-256', buffer);- const bytes = new Uint8Array(digest);- let hex = '';- for (const byte of bytes) {- hex += byte.toString(16).padStart(2, '0');- }- return hex;-};+/** SHA-256 hex of a blob's bytes, via `@platform/browser/sha256`. */+const defaultHashBlob = async (blob: Blob): Promise<string> => sha256Hex(await blob.arrayBuffer());/** Creates a bitmap store wired to the given seams. */export const createBitmapStore = (deps: BitmapStoreDeps): BitmapStore => {diff --git a/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.ts b/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.tsindex ffe2c4f755..c3ecea8510 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.ts@@ -34,23 +34,15 @@ import type {CompositePlan,} from '@workbench/canvas-operations/generationContracts';+import { sha256Hex } from '@platform/browser/sha256';import { fromTRS, multiply } from '@workbench/canvas-engine/math/mat2d';import { renderRasterComposite } from '@workbench/canvas-engine/render/rasterComposite';import { getCompositeLayerBounds } from '@workbench/canvas-operations/generationCompositePlan';type Ctx = RasterSurface['ctx'];-/** SHA-256 hex of a blob's bytes, via the Web Crypto API (matches `bitmapStore`). */-const defaultHashBlob = async (blob: Blob): Promise<string> => {- const buffer = await blob.arrayBuffer();- const digest = await crypto.subtle.digest('SHA-256', buffer);- const bytes = new Uint8Array(digest);- let hex = '';- for (const byte of bytes) {- hex += byte.toString(16).padStart(2, '0');- }- return hex;-};+/** SHA-256 hex of a blob's bytes, via `@platform/browser/sha256` (matches `bitmapStore`). */+const defaultHashBlob = async (blob: Blob): Promise<string> => sha256Hex(await blob.arrayBuffer());/** Reads a surface's pixels via its 2D context (real DOM path; injectable for tests). */const defaultReadImageData = (surface: RasterSurface, rect: Rect): ImageData =>@@ -129,7 +121,7 @@ export interface ExecuteCompositePlanDeps {uploadImage(blob: Blob): Promise<CanvasImageUploadResult>;/** Persistent dedupe state (see {@link CompositeDedupeCache}). */dedupe: CompositeDedupeCache;- /** Content-hashes a blob (default SHA-256 hex via `crypto.subtle`). */+ /** Content-hashes a blob (default SHA-256 hex via `@platform/browser/sha256`). */hashBlob?(blob: Blob): Promise<string>;/** Reads a surface region's pixels for the coverage scan (default `getImageData`). */readImageData?(surface: RasterSurface, rect: Rect): ImageData;diff --git a/invokeai/frontend/webv2/src/workbench/projects/ids.ts b/invokeai/frontend/webv2/src/workbench/projects/ids.tsindex 0fb44f0844..f9740a6eb5 100644--- a/invokeai/frontend/webv2/src/workbench/projects/ids.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/ids.ts@@ -1,9 +1,10 @@import { createUuid } from '@platform/browser/randomUuid';+import { sha256 } from '@platform/browser/sha256';export const createProjectId = (): string => `project-${createUuid()}`;export const createDeterministicProjectId = async (scope: string): Promise<string> => {- const digest = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(scope)));+ const digest = await sha256(new TextEncoder().encode(scope));const bytes = digest.slice(0, 16);bytes[6] = (bytes[6]! & 0x0f) | 0x80;bytes[8] = (bytes[8]! & 0x3f) | 0x80;