Skip to content

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.

docs(frontend): reduce verbosity of inline crypt.* function comments

Lincoln Steinf382fe2bee20
diff --git a/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts b/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts
index a96779b902..1d82dd22f3 100644
--- a/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts
+++ b/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts
@@ -2,11 +2,7 @@ import { describe, expect, it } from 'vitest';
/**
* `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.
+ * so filter these calls out when running over plain HTTP.
*/
const sources = import.meta.glob('../**/*.{ts,tsx}', {
eager: true,
diff --git a/invokeai/frontend/webv2/src/platform/browser/randomUuid.ts b/invokeai/frontend/webv2/src/platform/browser/randomUuid.ts
index c2433111ea..2a0d4d2c6d 100644
--- a/invokeai/frontend/webv2/src/platform/browser/randomUuid.ts
+++ b/invokeai/frontend/webv2/src/platform/browser/randomUuid.ts
@@ -1,17 +1,8 @@
/**
* Generate an RFC 4122 version 4 UUID.
*
- * `crypto.randomUUID` is exposed only in secure contexts — HTTPS, or `localhost`
- * over plain HTTP. The app is routinely opened from another device on the LAN
- * (an iPad pointed at a workstation, say), and there the property is simply
- * undefined, so a bare `crypto.randomUUID()` throws. The durable persistence
- * layer mints a writer token during startup, which turned that into a crash
- * before first paint.
- *
- * `crypto.getRandomValues` carries no secure-context restriction, so when the
- * native generator is missing the UUID is assembled from sixteen random bytes
- * with the version and variant bits set by hand. Every call site that needs a
- * fresh id goes through here; `crypto.randomUUID` must not be called directly.
+ * `crypto.randomUUID` is applied in secure contexts (HTTPS or `localhost`).
+ * `crypto.getRandomValues` is applied in non-secure contexts.
*/
/** The subset of `Crypto` the generator relies on, so tests can swap it. */
diff --git a/invokeai/frontend/webv2/src/platform/browser/sha256.ts b/invokeai/frontend/webv2/src/platform/browser/sha256.ts
index 2db33f7367..c390d1237b 100644
--- a/invokeai/frontend/webv2/src/platform/browser/sha256.ts
+++ b/invokeai/frontend/webv2/src/platform/browser/sha256.ts
@@ -1,16 +1,8 @@
/**
* 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.
+ * `crypto.subtle` is exposed only in secure contexts, otherwise a slower fallback
+ * that produces identical digests is applied.
*/
const ROUND_CONSTANTS = new Uint32Array([