oc_context_import
Import a browser context envelope by verifying its integrity hash, clearing existing cookies and storage for the target origin, and installing the new payload. Rejects on hash mismatch without state changes.
Instructions
Strict-replace import of a ContextEnvelope produced by oc_context_export. Verifies the SHA-256 integrity hash first — on mismatch returns { ok: false, integrityError } WITHOUT applying any state. On success, existing cookies for the envelope origin and the active-origin web storage are CLEARED, then the envelope payload is installed. Merge semantics are intentionally not supported. SECURITY: the envelope is plaintext — the host MUST treat it as a secret.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | Yes | REQUIRED Tab ID to apply the envelope to. | |
| envelope | Yes | REQUIRED A `ContextEnvelope` produced by `oc_context_export`. | |
| strictOrigin | No | When true, reject the import if the active tab origin does not match `envelope.origin`. Default: false (caller is responsible for navigating). |