# IDOP Format Specification 1.0

| | |
| --- | --- |
| **Status** | Recommendation (Stable). Later 1.x versions only add (§15) |
| **Date** | 2026-10-13 (Recommendation 2026-10-07; corrections listed in Annex D) |
| **This version** | `https://idoplabs.com/spec/idop/1.0/2026-10-13/` |
| **Latest version of 1.0** | `https://idoplabs.com/spec/idop/1.0/` |
| **Media type** | `application/vnd.idop+zip` (package). The bundle transport (§14) uses `application/vnd.idop.bundle+zip`, which is not registered (§20). |
| **File extensions** | `.idop`, `.idopbundle` |
| **Editor** | IDOP LABS |
| **Feedback** | `spec@idoplabs.com` — see *Governance* (`https://idoplabs.com/spec/idop/governance/`) |
| **Conformance suite** | `https://idoplabs.com/spec/idop/1.0/conformance/` |
| **Error registry** | `https://idoplabs.com/spec/idop/1.0/errors/` |
| **License** | Text: CC BY 4.0. Schemas and conformance files: MIT OR Apache-2.0 |

## Abstract

IDOP is a file format for **interactive documents**. One `.idop` file carries a
document's user interface (HTML, CSS, JavaScript), its passive resources, and
its portable state. A conforming Reader validates the whole file before any of
its code runs, executes that code in an isolated sandbox with no network access
unless the user grants it, and writes changed state back into the file as a new
revision. Secrets never enter the file.

This specification defines the package container, the manifest, the executable
boundary, the storage and revision model, the Runtime API available to document
code, the permission model for network access, the `.idopbundle` transport, and
the requirements a Reader must meet.

## Table of contents

1. Conformance
2. Terminology
3. Overview
4. Package container
5. Paths
6. Limits
7. Manifest
8. Executable boundary
9. Reader processing model
10. Storage, Save and revisions
11. Runtime API
12. Capabilities, credentials and permissions
13. Portable Items (extension)
14. Bundles and containers
15. Versioning and compatibility
16. Error codes
17. Security considerations
18. Privacy considerations
19. Accessibility considerations
20. IANA considerations
21. References
Annex A — JSON Schemas · Annex B — Conformance suite · Annex C — Example · Annex D — History · Annex E — Roadmap

---

## 1. Conformance

The key words **MUST**, **MUST NOT**, **REQUIRED**, **SHALL**, **SHALL NOT**,
**SHOULD**, **SHOULD NOT**, **RECOMMENDED**, **MAY** and **OPTIONAL** are to be
interpreted as described in BCP 14 [RFC 2119] [RFC 8174] when, and only when,
they appear in all capitals.

This specification defines three conformance classes:

- **Package** — a file that satisfies sections 4–8 and, where it uses them,
  sections 10–14.
- **Producer** — software that writes packages (an editor, a generator, an AI
  tool, the `idop pack` command). A Producer MUST write only conforming
  packages, SHOULD write them deterministically (§4.4), and MUST NOT write a
  secret into a package.
- **Reader** — software that opens packages and runs them. A Reader MUST
  implement section 9 in full. A Reader that runs document code MUST implement
  sections 10–12 and 17.1. A Reader MAY refuse any package it cannot process
  fully; it MUST NOT process a package partially.

Sections marked *(informative)*, examples and notes are not normative.

## 2. Terminology

- **Package** — a ZIP archive conforming to this specification, normally with
  the extension `.idop`.
- **Document** — what a person sees when a package is opened: the running
  application together with its state.
- **Manifest** — the JSON file `idop.json` at the package root.
- **Entry point** — the HTML file under `code/` that the Reader loads first.
- **Document code** — every entry under `code/`.
- **State** — the entries under `storage/`, the last saved portable state.
- **Overlay** — the Reader's in-memory copy of state during a session (§10).
- **Revision** — one saved version of a document, identified by a UUID.
- **Capability** — a permission the document declares and the user may grant,
  in 1.0 always network access to exact origins (§12).
- **Credential binding** — a declared need for a secret the Reader holds and the
  document never sees.
- **Origin** — scheme, host and port, as defined by [RFC 6454]; in this
  specification always `https`.
- **Session** — one opening of one document by a Reader.

## 3. Overview *(informative)*

```text
my-board.idop                     (ZIP)
├── mimetype                      application/vnd.idop+zip   first entry, Stored
├── idop.json                     manifest
├── code/                         document code: HTML, JS, CSS, JSON
│   ├── index.html                entry point
│   └── app.js
├── resources/                    passive files: images, fonts, data
├── storage/                      saved state, written by the Reader on Save
└── _idop/                        reserved for this specification
```

The design follows two established formats: the container identification of
OpenDocument and EPUB (a Stored `mimetype` first entry), and the web platform's
origin model for isolation. What IDOP adds is the contract between the two: the
file says what it wants, the Reader decides what it gets, and the user is asked
before anything leaves the device.

## 4. Package container

### 4.1 ZIP profile

A package MUST be a ZIP archive [APPNOTE] with these restrictions:

1. No bytes MAY precede the first local file header (`IDOP-ZIP-018`) or follow
   the end of central directory record (`IDOP-ZIP-011`). The record MAY carry a
   comment, which is part of it; nothing may follow the comment.
   (Self-extracting and polyglot files are refused.)
2. ZIP64, multi-volume and spanned archives MUST NOT be used (`IDOP-ZIP-010`,
   `IDOP-ZIP-012`). ZIP64 is recognised by its structures — a `0xFFFF` or
   `0xFFFFFFFF` value in a count, size or offset field of the end of central
   directory record or of a central directory record, or a ZIP64 extended
   information extra field (header ID `0x0001`). A Reader MUST NOT refuse a
   package because the data of an entry happens to contain the bytes of a
   ZIP64 signature.
3. Encryption MUST NOT be used (general purpose bit 0, `IDOP-ZIP-015`).
4. Every entry MUST use compression method 0 (Store) or 8 (Deflate)
   (`IDOP-ZIP-016`).
5. Entry names that contain non-ASCII characters MUST set the UTF-8 flag
   (general purpose bit 11), and every name MUST be valid UTF-8 (`IDOP-ZIP-014`).
6. The local header and central directory record of each entry MUST agree on
   name, general purpose flags and method, and on CRC-32 and sizes
   (`IDOP-ZIP-021`). When general purpose bit 3 is set, the local header MAY
   instead carry zeros for the CRC-32 and both sizes; a data descriptor —
   with or without its signature `50 4B 07 08` — MUST then follow the entry's
   data and MUST carry the central directory's CRC-32 and sizes
   (`IDOP-ZIP-024`).
7. No two central directory records MAY reference the same local header
   (`IDOP-ZIP-017`).
8. Directory entries, symbolic links, devices and other special entries MUST NOT
   appear (`IDOP-ZIP-032`, `IDOP-ZIP-034`). Directories exist only as prefixes of
   file names.
9. The central directory MUST be contiguous and immediately precede the end of
   central directory record (`IDOP-ZIP-013`).
10. The local records — each local header, its entry's data and, when present,
    its data descriptor — MUST appear in central directory order and MUST cover
    the bytes from offset 0 to the start of the central directory exactly: no
    gap, no overlap (`IDOP-ZIP-023`). Every byte of a package is therefore
    accounted for by the central directory, and a reader that walks the local
    headers sees the same entries as one that reads the central directory.

### 4.2 The `mimetype` entry

The first local file header MUST start at offset 0 and MUST describe an entry
named exactly `mimetype`, stored with method 0 (`IDOP-PROFILE-001`), without an
extra field (`IDOP-ZIP-019`), whose content is exactly the ASCII string:

```text
application/vnd.idop+zip
```

with no byte order mark, no trailing whitespace and no line terminator
(`IDOP-PROFILE-002`). Because the entry has no extra field and its name is eight
bytes long, the media type sits at byte offset 38 of every IDOP 1.0 package —
which is what lets software identify the file without decompressing it (§20).
The ZIP signature alone (`PK`) identifies only a ZIP archive, not an IDOP
package.

### 4.3 Roots

Every entry name MUST begin with one of these roots:

| Root | Role | Executable |
| --- | --- | --- |
| `mimetype` | container identification | no |
| `idop.json` | manifest | no |
| `code/**` | document code: `.html`, `.js`, `.mjs`, `.css`, `.json`, `.wasm` | **yes** |
| `resources/**` | passive resources | no |
| `storage/**` | last saved portable state | no |
| `_idop/**` | reserved for this specification | no |
| `extensions/<namespace>/**` | data of extensions | no |

Any other root MUST cause the package to be refused (`IDOP-PATH-010`).
`<namespace>` MUST be a lowercase reverse-domain identifier
(`com.example.feature`) followed by at least one child path segment
(`IDOP-PATH-012`).

Every name under `_idop/` is reserved for this specification. A 1.0 Reader MUST
ignore every entry under `_idop/` — it never serves, executes or exposes one to
document code — and a 1.0 Producer MUST NOT write any. Later versions define
these, among others:

| Reserved | Intended use |
| --- | --- |
| `_idop/signatures/` | publisher signatures over the package (planned for 1.1) |
| `_idop/thumbnail.png` | a preview image for file managers and galleries |
| `_idop/encryption/` | encryption metadata |

### 4.4 Deterministic writing

A Producer SHOULD write packages deterministically: `mimetype` first, `idop.json`
second, remaining entries in byte-wise lexicographic order of their names, a
fixed modification time, and fixed permissions. Packing the same inputs twice
SHOULD produce byte-identical files. *(The reference `idop pack` does.)*

## 5. Paths

Every entry name, and every path used by the Runtime API, MUST satisfy:

1. relative, `/`-separated, encoded as UTF-8 and normalised to Unicode NFC
   (`IDOP-PATH-004`);
2. at most 240 bytes and at most 16 segments (`IDOP-PATH-001`, `IDOP-PATH-005`);
3. no leading `/`, no `\`, no UNC or drive prefix such as `C:`
   (`IDOP-PATH-002`, `IDOP-PATH-009`);
4. no empty, `.` or `..` segment (`IDOP-PATH-006`);
5. no NUL or other control character (`IDOP-PATH-003`), no `:` and no segment
   ending in `.` or a space (`IDOP-PATH-007`);
6. no segment that is a Windows device name (`CON`, `PRN`, `AUX`, `NUL`,
   `COM1`–`COM9`, `LPT1`–`LPT9`, with or without an extension) (`IDOP-PATH-008`);
7. no two entries whose names are equal after Unicode full case folding
   (`CaseFolding.txt`, statuses C and F, of Unicode 17.0.0 [UCD]) followed by
   normalisation to NFC (`IDOP-PATH-030`). Full folding is what makes
   `straße` and `STRASSE`, or `σας` and `σασ`, the same name; lowercasing is
   not a case folding and does not.

These rules make every package extractable on every common file system without
any entry escaping, colliding with or replacing another.

## 6. Limits

A Reader MUST NOT refuse a package for its size if it is within these limits,
and MUST refuse a package that exceeds any of them with the listed code:

| Limit | Value | Error |
| --- | ---: | --- |
| compressed package size | 64 MiB | `IDOP-LIMIT-001` |
| number of entries | 4 096 | `IDOP-LIMIT-002` |
| uncompressed size of one entry | 16 MiB | `IDOP-LIMIT-003` |
| compression ratio of one entry | 100 : 1 | `IDOP-LIMIT-004` |
| total uncompressed size | 128 MiB | `IDOP-LIMIT-005` |
| `idop.json` size | 256 KiB | `IDOP-LIMIT-010` |
| manifest JSON depth / node count | 32 / 4 096 | `IDOP-LIMIT-011` |
| state (`storage/**`) during a session | 32 MiB, 4 096 files, 16 MiB per file | `IDOP-STORAGE-QUOTA` |

The last row bounds what document code may write during a session (§10) and is
enforced by the Runtime API, not at opening. For the manifest limits, every JSON
value — object, array, string, number, `true`, `false`, `null` — is one node
(member names are not), the top-level value has depth 1, and a value inside an
array or object has the depth of that container plus one.

A Producer MUST NOT write a package that exceeds them. Future versions MAY raise
these limits; they will not lower them.

## 7. Manifest

### 7.1 Syntax

`idop.json` MUST be a UTF-8 JSON object [RFC 8259] that validates against the
schema in Annex A (`https://idoplabs.com/spec/idop/1.0/schemas/manifest.json`).
Text that is not JSON, and duplicate object keys, MUST cause refusal
(`IDOP-MANIFEST-001`). A manifest the schema refuses — including one with a
member the schema does not define — MUST be refused (`IDOP-MANIFEST-003`): the
place for anything else is `extensions`.

The schema expresses structure. The rules of §7.2–§7.5 and §12 that it cannot
express apply in addition and are checked after it: UUIDs, timestamps and
Semantic Versioning values (the schema's `format` keywords are annotations in
JSON Schema 2020-12 and are not relied upon), uniqueness of identifiers, the
existence of named entries, and the agreement of capabilities with bindings.

### 7.2 Members

| Member | Required | Value |
| --- | --- | --- |
| `format` | yes | exactly `"https://idoplabs.com/ns/idop/package"` |
| `formatVersion` | yes | exactly `"1.0"` |
| `runtimeApiVersion` | yes | exactly `"1.0"` |
| `entryPoint` | yes | path of an existing `.html` entry under `code/` |
| `application` | yes | object, §7.3 |
| `document` | yes | object, §7.4 |
| `state` | yes | `{ "schemaVersion": <SemVer> }` — version of the document's own state format |
| `requiredFeatures` | yes | array of unique strings, possibly empty; 1.0 defines only `idop.core-storage-v1` |
| `optionalFeatures` | yes | array of unique strings |
| `requiredCapabilities` | yes | array of capabilities, §12.1 |
| `optionalCapabilities` | yes | array of capabilities, §12.1 |
| `environmentBindings` | yes | array, §12.3 |
| `credentialBindings` | yes | array, §12.2 |
| `extensions` | yes | object; every key is a lowercase reverse-domain namespace (`^[a-z0-9-]+(\.[a-z0-9-]+)+$`) |

A Reader MUST refuse a package whose `requiredFeatures` contains a value it does
not implement (`IDOP-UNSUPPORTED-002`) and MUST ignore unknown
`optionalFeatures`.

### 7.3 `application`

| Member | Required | Value |
| --- | --- | --- |
| `id` | yes | lowercase reverse-domain identifier, ≤ 160 bytes (`com.example.board`) |
| `version` | yes | Semantic Versioning 2.0.0 |
| `title` | yes | 1–120 characters |
| `description` | no | ≤ 1 000 characters |
| `author` | no | ≤ 160 characters |
| `icon` | no | path of an entry under `resources/` |

**All `application` values are self-declared.** Nothing in 1.0 proves who wrote
a package. A Reader MUST NOT present them as verified and SHOULD label them as
supplied by the document.

### 7.4 `document`

| Member | Required | Value |
| --- | --- | --- |
| `id` | yes | UUID identifying the document across revisions |
| `revisionId` | yes | UUID of this revision |
| `parentRevisionId` | yes | UUID of the previous revision, or `null` for the first |
| `createdAt` | yes | RFC 3339 timestamp in UTC, written with `Z` |
| `modifiedAt` | yes | RFC 3339 timestamp in UTC, written with `Z`, not earlier than `createdAt` |

A timestamp that is not an RFC 3339 `date-time` ending in `Z` — including one
written with the equivalent offset `+00:00` — MUST cause refusal
(`IDOP-MANIFEST-015`). `parentRevisionId` MUST NOT equal `revisionId`, and
`modifiedAt` MUST NOT be earlier than `createdAt` (`IDOP-MANIFEST-014`). A document
identity grants nothing: it is not a security principal.

### 7.5 Container agreement

The `mimetype` entry and the manifest MUST agree: a manifest with
`formatVersion` `"1.0"` MUST be in a container whose `mimetype` is
`application/vnd.idop+zip` (`IDOP-PROFILE-005`).

## 8. Executable boundary

1. Only entries under `code/` are executable. An entry under `resources/` or
   `storage/` with the extension `.html`, `.htm`, `.js`, `.mjs`, `.css` or
   `.wasm` (ASCII case-insensitive) MUST cause refusal (`IDOP-POLICY-001`).
2. Entries under `code/` MUST have the extension `.html`, `.js`, `.mjs`,
   `.css`, `.json` or `.wasm` (`IDOP-POLICY-002`). All but `.wasm` MUST be
   UTF-8 text (`IDOP-POLICY-003`); a `.wasm` entry MUST be a WebAssembly binary
   module, beginning with the bytes `00 61 73 6D 01 00 00 00`
   (`IDOP-POLICY-004`).

The remaining rules are lexical, so that every validator reaches the same
verdict on the same bytes. They are applied to the text of each entry under
`code/` after ASCII lowercasing ("contains" below is therefore ASCII
case-insensitive). For a script (`.js`, `.mjs`), the *code* of the entry is
its text with comments removed and with the contents of string literals,
template literal text and regular expression literals disregarded, as the
ECMAScript lexical grammar [ECMA-262] delimits them; for HTML, it is the whole
text. A *call* of a name is the name, not preceded by an identifier character
(`A`–`Z`, `a`–`z`, `0`–`9`, `_`, `$`), followed by optional white space and
`(`.

3. HTML under `code/`:
   - MUST NOT contain inline script: every `<script` up to the next `>` contains
     `src=`, and nothing but white space lies between that `>` and the next
     `</script>` (`IDOP-POLICY-014`); a `<script` without such a `>` or
     `</script>` is refused as unterminated (`IDOP-POLICY-013`);
   - MUST NOT contain `<iframe`, `<object`, `<embed`, `<form` or `<base`, nor
     the sequences `http://`, `https://`, `src="//` or `src='//` anywhere,
     text content included (`IDOP-POLICY-011`). A remote address a document
     shows as text belongs in a script or in JSON data. An XML namespace name
     written as a whole attribute value — `http://www.w3.org/2000/svg`,
     `http://www.w3.org/1999/xlink`, `http://www.w3.org/1999/xhtml`,
     `http://www.w3.org/1998/Math/MathML` or
     `http://www.w3.org/XML/1998/namespace` immediately followed by the
     attribute's closing quote — is an identifier, not a remote URL, and is
     disregarded.
4. CSS under `code/` MUST NOT contain `http://`, `https://` or `@import`
   (`IDOP-POLICY-012`).
5. Every text entry under `code/` MUST NOT contain `javascript:`, nor
   `__tauri__`, `__tauri_internals__` or `ipc.localhost`, which name the native
   bridge of desktop Readers. The code of every script and HTML entry MUST NOT
   contain a call of `eval`, `new function`, `new sharedworker` or
   `window.open`, nor the identifier `serviceworker` (`IDOP-POLICY-010`). The
   same words in a comment or a string literal of a script, inside another
   identifier (`retrieval(`), or in a `.json` entry are not a use. WebAssembly
   and dedicated workers are permitted: they run inside the document's own
   isolated context (§9.3) and are subject to the same absence of network
   access.

These checks are static and therefore **defence in depth, not the boundary**:
code can reach any of these constructs indirectly. The boundary is the
Reader's sandbox (§9.3, §17.1): a Reader MUST enforce isolation whether or not
the static checks would have caught a construct.

## 9. Reader processing model

### 9.1 Validation before execution

A Reader MUST perform these steps, in order, and MUST NOT expose any entry to
document code, or run any document code, until all of them succeed:

1. Check the file size against §6.
2. Parse the ZIP structure — end of central directory record, central
   directory, local records — and enforce §4.1. A Reader SHOULD parse these
   structures itself rather than trust a general-purpose ZIP library, whose
   tolerance of malformed archives is what the profile exists to rule out.
3. Check the first entry and its content against §4.2.
4. Validate every entry name against §4.3 and §5.
5. Decompress every entry into a bounded buffer, enforcing per-entry, aggregate
   and ratio limits and verifying every CRC-32 and size.
6. Parse and validate `idop.json` against §7, including §7.5.
7. Enforce the executable boundary, §8.
8. Resolve required features, configuration and capabilities (§12.4).

A failure at any step MUST cause the whole package to be refused with a stable
error code (§16). There is no "best effort" mode: a Reader MUST NOT run a
package that failed validation, and MUST NOT run part of one.

Which code is reported is fixed for a package with a single fault, which is
what each refusal case of the conformance suite (Annex B) contains. Where one
fault breaks several rules, the code is the one the rule names that comes
first in this order: the steps above; within step 6, schema validation
(§7.1) before every other manifest rule; within §4.1, the items in their
numbered order (so bytes before the first local header are `IDOP-ZIP-018`,
not a coverage fault of item 10). For a package
with several faults, which of them is reported is not specified; any of their
codes is conforming.

### 9.2 Loading

The Reader loads `entryPoint` and serves the other entries under `code/` and
`resources/` to the document by path. It MUST NOT serve `storage/` as files:
state is reached only through the Runtime API (§11). Entries are served with a
media type derived from their extension (`.wasm` as `application/wasm`);
unknown extensions MUST be served as `application/octet-stream`.

Document code addresses package entries exactly as a web page addresses files
next to it. A Reader MUST resolve the following, relative to the referring
file — or, for a reference that begins with `/`, from the package root
(`/code/lib.js` names the entry `code/lib.js`) — and never outside the package;
a reference that would leave the package resolves to nothing:

- references in HTML and CSS (`src`, `href`, `url()`);
- `fetch()` with the method `GET` or `HEAD` of a relative URL, answered with
  the entry's bytes and media type — so that, for example,
  `WebAssembly.instantiateStreaming(fetch('engine.wasm'))` works;
- ES module specifiers that begin with `./`, `../` or `/`, in static and
  dynamic imports, and `new URL(path, import.meta.url)`;
- the script URL given to `new Worker()`, which MUST name a `.js` or `.mjs`
  entry under `code/`.

Any other URL MUST be refused. A worker runs the one script it was given; it
has no Runtime API and receives anything else from the document by message.

### 9.3 Isolation

Document code MUST run in an execution context that:

- cannot read or modify the Reader's own interface, storage, cookies or
  credentials;
- has **no direct network access**: no `fetch`, XHR, WebSocket, WebTransport,
  EventSource, beacon, WebRTC peer connection (including the ICE, STUN and
  TURN traffic and DNS lookups it causes), speculative loading
  (`<link rel>` `prerender`, `prefetch`, `preconnect`, `dns-prefetch`,
  `preload`, `modulepreload`, `next` to a remote address), form submission,
  navigation or resource load to any remote origin;
- cannot open windows, and cannot create frames or other nested browsing
  contexts (`<iframe>` — including `srcdoc` — `<frame>`, `<object>`,
  `<embed>`), other than those the Reader itself provides;
- reaches the Reader only through the Runtime API transport the Reader injects.

A content security policy does not govern every one of these channels: in
current browser engines it does not apply to WebRTC, nor to `about:srcdoc`
frames, nor to every kind of speculative loading. A Reader MUST close the
channels its isolation mechanism does not govern before any document code
runs — for example by removing the WebRTC interfaces from the document's
realm and refusing, synchronously, to create or insert the elements and links
above — and MUST NOT rely on the static checks of §8 for this.

In a web browser the RECOMMENDED realisation is an `<iframe>` with
`sandbox="allow-scripts"` and **without** `allow-same-origin` (an opaque
origin), whose content security policy is
`default-src 'none'` plus the sources the Reader itself needs to serve package
entries, `'wasm-unsafe-eval'` for WebAssembly, and `worker-src` limited to the
Reader's own in-memory URLs; workers inherit that policy. The embedding page's
own policy SHOULD restrict `frame-src` so that the frame cannot be navigated to
a remote address, and a permissions policy SHOULD deny device and payment
features to the frame. A Reader MUST NOT grant `allow-same-origin`,
`allow-modals`, `allow-popups`, `allow-forms` or `allow-top-navigation` to
document code: printing and file dialogs go through the Reader (§11.2).

### 9.4 One document, one context

Each session MUST have its own context and its own Runtime API channel. One
session MUST NOT be able to reach another session's channel, state or
capabilities.

## 10. Storage, Save and revisions

### 10.1 Overlay

On opening, the Reader copies `storage/**` into an in-memory overlay. Reads and
lists see the overlay; writes and deletes change only the overlay. The package
file is not modified until the user saves.

Paths given to the storage API are relative to `storage/` and MUST satisfy §5.
A path that names the `storage/` prefix itself, or escapes it, MUST be refused
(`IDOP-PATH-020`).

### 10.2 Durability states

A Reader SHOULD show the user which of three states a document is in:

| State | Meaning |
| --- | --- |
| `memory` | the document changed its own model but has not written to storage |
| `session` | the overlay changed; the file has not |
| `file` | the latest overlay has been saved into the file |

### 10.3 Save

Saving produces a **new revision**:

1. If the Reader saves into the file it opened, it MUST first verify that the
   file has not changed since it was opened (by content digest). If it has, it
   MUST NOT overwrite it (`IDOP-SAVE-CONFLICT`) and SHOULD offer "Save as".
2. The new package MUST be identical to the old one except for `storage/**` and
   `idop.json`.
3. In `idop.json`, `parentRevisionId` becomes the previous `revisionId`, a new
   UUID becomes `revisionId`, and `modifiedAt` becomes the current UTC time —
   or, when the package carries a later `createdAt` or `modifiedAt` (a clock
   that ran ahead where it was written), that later time: time in a revision
   chain never runs backwards, and a Save MUST NOT fail for that reason.
   `document.id` is unchanged.
4. The new package MUST be fully validated (§9.1) before it replaces the old
   file, and the replacement SHOULD be atomic.

"Save as" follows the same steps without the check in 1.

A Reader MUST NOT save into a local file without the user's action. It MAY
save automatically, following the same steps, into a place that keeps
revisions and that the user opened the document from — for example the
user's own cloud storage — as long as it shows that it does so. A change the
document makes while a revision is being written is not lost: it stays in the
overlay, unsaved, on top of the new revision.

## 11. Runtime API

### 11.1 Client

Before document code runs, the Reader MUST install a frozen object at
`globalThis.idop`. Document code MUST use it and MUST NOT infer any endpoint
from `location`. The transport behind it is the Reader's choice (in a browser,
a `MessagePort` per session is RECOMMENDED) and is not part of this contract.

Every method returns a Promise. A failure rejects with an `Error` whose `code`
property is a stable error code (§16). **Documents MUST branch on `code` and MUST
NOT parse `message`**, which is a diagnostic and may be localised or changed.

### 11.2 Methods

| Method | Parameters | Result |
| --- | --- | --- |
| `idop.runtime.getInfo()` | — | `{ runtimeApiVersion: "1.0", availableCapabilities: string[] }` |
| `idop.storage.read(path)` | storage-relative path | `{ text }` — UTF-8 content (`IDOP-STORAGE-NOT-FOUND`, `IDOP-STORAGE-UTF8`) |
| `idop.storage.write(path, text)` | path, UTF-8 string | `{ written: true, ... }` (`IDOP-STORAGE-QUOTA`) |
| `idop.storage.readBytes(path)` | storage-relative path | `Uint8Array` — the entry's bytes, whatever they are |
| `idop.storage.writeBytes(path, bytes)` | path, `Uint8Array` or `ArrayBuffer` | `{ written: true, ... }` (`IDOP-STORAGE-QUOTA`) |
| `idop.storage.delete(path)` | path | `{ deleted: true, ... }` |
| `idop.storage.list()` | — | `{ paths: string[] }` |
| `idop.storage.transaction(operations)` | `[{ op: "write", path, data } \| { op: "delete", path }]`; `data` is a string or bytes | `{ committed: true, ... }` — all or nothing |
| `idop.env.get(id)` | environment binding id | `{ value }` (`IDOP-ENV-DENIED`, `IDOP-ENV-MISSING`) |
| `idop.network.request(request)` | §11.3 | `{ status, headers, body }` |
| `idop.ui.requestSave()` | — | asks the Reader to save. Made during the user's click or key press in the document, it is the user's decision and the Reader SHOULD save as its own Save control would; otherwise the Reader shows its Save control and nothing is written |
| `idop.ui.requestConfiguration()` | — | asks the Reader to show its configuration interface |
| `idop.ui.saveFile({ name, data, type? })` | file name without a path; `data` a string or bytes, at most 16 MiB | `{ saved: true }` once the user saved it in the Reader's own dialog; `IDOP-UI-CANCELLED`, `IDOP-UI-TOO-LARGE` |
| `idop.ui.openFile({ accept? })` | extensions (`".csv"`) or media types | `{ name, type, size, bytes }` for the one file the user chose; `IDOP-UI-CANCELLED`, `IDOP-UI-TOO-LARGE` |
| `idop.ui.print()` | — | the Reader prints what the document shows, without running document code in the print context |
| `idop.ui.requestFullscreen()`, `idop.ui.exitFullscreen()` | — | full screen for the document; needs a user gesture (`IDOP-UI-DENIED`) |
| `idop.ui.copyText(text)` | string | writes to the clipboard; needs a user gesture (`IDOP-UI-DENIED`). Reading the clipboard is not offered |
| `idop.host.getInputFile()` | — | `{ name, extension, size, bytes }` when the document was opened to display a file (§11.5), else `IDOP-HOST-NO-INPUT` |
| `idop.host.putOutputFile(bytes)` | `Uint8Array` | hands an edited copy of that file back to the Reader; writes nothing |

There is deliberately **no** method that returns a secret, enumerates
environment variables, reads the clipboard, or writes a file without the
user's decision. Every dialog above is the Reader's own: document code can
neither show nor imitate it, and `IDOP-UI-DENIED` is returned where a Reader
does not offer one.

### 11.3 `network.request`

```text
{ capability: string, url: string, method?: string,
  headers?: { [name]: string }, body?: string | Uint8Array,
  responseType?: "text" | "bytes", timeoutMs?: number }
```

The Reader performs the request on the document's behalf, subject to §12. The
response is `{ status, headers, body }`, where `headers` contains only a
Reader-defined allowlist of response headers and `body` is text, or a
`Uint8Array` when `responseType` is `"bytes"`. A Reader MUST accept request
bodies of at least 8 MiB and responses of at least 16 MiB. Errors:
`IDOP-NETWORK-DENIED`, `IDOP-NETWORK-ORIGIN-DENIED`,
`IDOP-NETWORK-METHOD-DENIED`, `IDOP-NETWORK-TIMEOUT`,
`IDOP-NETWORK-REQUEST-TOO-LARGE`, `IDOP-NETWORK-RESPONSE-TOO-LARGE`,
`IDOP-NETWORK-CONCURRENCY`, `IDOP-NETWORK-BUDGET-EXHAUSTED`,
`IDOP-CREDENTIAL-MISSING`, `IDOP-CREDENTIAL-ORIGIN-DENIED`. A non-2xx response
from the remote service is **not** an error: it is returned with its status.

### 11.4 Ordinary web code *(informative)*

Much code is written for an ordinary web page, and in a document context
several web APIs either do not exist or never fire. A Reader MAY bridge them
onto what this specification provides, without granting anything the Runtime
API does not:

- `localStorage` kept in the document's own `storage/` (so it travels with the
  file), and `sessionStorage` for the session only;
- `DOMContentLoaded` and `load` dispatched again after the document's scripts
  have run, since both fired before the Reader inserted them;
- a click on `<a download>` offered through `ui.saveFile`;
- Ctrl+S / Cmd+S in the document treated as `ui.requestSave()`.

The browser's modal dialogs (`alert`, `confirm`, `prompt`) are not offered
(§9.3); a Reader may make `alert` show its text inside the document. Documents
SHOULD use the Runtime API directly and in-page dialogs.

### 11.5 Viewers *(informative)*

A Reader may let the user open an ordinary file (for example a `.docx`) with an
IDOP document chosen as its viewer. The viewer receives exactly that one file
through `host.getInputFile()` and nothing else from the user's storage.

## 12. Capabilities, credentials and permissions

### 12.1 Network capabilities

A capability object has these members:

| Member | Value |
| --- | --- |
| `id` | lowercase kebab-case, unique in the package |
| `type` | `"network"` (the only type in 1.0) |
| `origins` | 1–16 HTTPS origins, each in its ASCII serialization [RFC 6454, §6.2] (below) |
| `methods` | non-empty subset of `GET`, `POST`, `PUT`, `PATCH`, `DELETE` |
| `credentialBinding` | optional id of a credential binding |
| `purpose` | 1–240 characters shown to the user |

An origin is written exactly as a Reader compares it: `https://`, then a host
in lowercase — DNS labels of letters, digits and hyphens (an internationalised
name in its `xn--` form), or an IPv4 address — then `:` and a port only when it
is not 443. User information, a path, a query, a fragment, a trailing dot and
any other spelling MUST cause refusal (`IDOP-MANIFEST-003` where the schema
refuses the value, `IDOP-MANIFEST-023` otherwise). Capability identifiers MUST
be unique across both lists (`IDOP-MANIFEST-022`).

`requiredCapabilities` are needed for the document to work at all;
`optionalCapabilities` may be declined while the document still runs.

### 12.2 Credential bindings

A credential binding is `{ id, required, description? }`. **It names no service.**
A binding is satisfied by a credential the Reader holds whose allowed origins —
set by the user, never by the document — cover every origin of every capability
that references the binding.

- Binding identifiers MUST be unique (`IDOP-MANIFEST-028`), and a capability
  MUST NOT reference an undeclared binding (`IDOP-MANIFEST-024`).
- Every binding MUST be referenced by at least one capability
  (`IDOP-MANIFEST-026`).
- A binding MUST NOT contain a `provider` member. The schema has no such
  member, so a 1.0 Reader refuses it as `IDOP-MANIFEST-003` (§9.1);
  `IDOP-MANIFEST-025` names the same fault for Readers that also accept
  pre-release drafts.
- A Reader MUST NOT reveal a credential value to document code, write it into
  `storage/**`, a log, an export or a response.
- A Reader MUST hold, for each credential, its own list of allowed origins, and
  MUST NOT send the credential to any other origin. The manifest can only narrow
  where a credential is used; it can never widen it
  (`IDOP-CREDENTIAL-ORIGIN-DENIED`).
- A Reader MUST NOT fall back to an unauthenticated request when a credential is
  refused.

A Reader MAY offer well-known services as presets in its own settings. Such a
preset is matched to a binding by origin, exactly like any other credential.

### 12.3 Environment bindings

An environment binding is `{ id, variable, required, description? }`, where
`variable` matches `^[A-Z][A-Z0-9_]*$`. Binding identifiers MUST be unique
(`IDOP-MANIFEST-027`). Its value is non-secret configuration
held by the Reader and returned by `env.get(id)` only for declared bindings.
Values are, by definition, readable by document code; a Reader MUST NOT offer an
environment binding as a place to keep secrets.

### 12.4 Preflight and consent

Between validation and execution the Reader MUST:

1. resolve required credential and environment bindings (asking the user to
   provide them, or refusing the document if they are not provided);
2. review every capability against what the Reader will actually permit, and
   resolve conflicts itself — a capability whose credential may not reach its
   origins MUST be shown as refused, never offered; a *required* capability in
   that state MUST prevent the document from running;
3. only then ask the user. The prompt MUST state, for each capability, which
   credential would travel to which origins and for what declared purpose. The
   user MAY cancel, allow once, or allow for this version.

"Allow for this version" MUST be keyed by a digest over the application id,
application version, a digest of all `code/**` entries, and the canonical
capability declarations. A change to code or to declared capabilities
invalidates it; a change to `storage/**` alone does not.

### 12.5 Broker rules

For each `network.request` the Reader MUST:

- refuse a capability that was not granted (`IDOP-NETWORK-DENIED`);
- refuse a URL whose origin is not exactly one of the capability's origins
  (`IDOP-NETWORK-ORIGIN-DENIED`), and a method it does not list
  (`IDOP-NETWORK-METHOD-DENIED`);
- remove `Authorization`, `Cookie`, `Proxy-Authorization` and similar headers the
  document supplies, and inject a credential only after all checks pass;
- not follow redirects;
- bound request size, response size, time and concurrency;
- enforce a finite **request budget per session**
  (`IDOP-NETWORK-BUDGET-EXHAUSTED`), so an approved document cannot spend a
  user's paid API credit in a loop. A request refused before it reaches the
  network does not consume the budget.

## 13. Portable Items (extension)

A document whose state holds user-visible objects (a note, a card, a quiz) MAY
declare under `extensions["idop.portable-items"]` how they are indexed, so that a
Reader can export one item as a new, valid package with a new `document.id`. The
declaration, the index format and their errors (`IDOP-ITEMS-*`) are defined in
*IDOP Workspace Containers 1.0*, §5, and its schema
`https://idoplabs.com/spec/idop/1.0/schemas/portable-items.json`. The Reader, not
the document, derives the exported package; there is no export API.

## 14. Bundles and containers

Directories that group documents — a **workspace** (`idop.workspace.json`), a
**project** (`idop.project.json`) — and the `.idopbundle` transport that carries
a workspace, folder or project as one file are defined in *IDOP Workspace
Containers 1.0*. A bundle is a ZIP archive under the same profile as §4.1, whose
first entry is a Stored `mimetype` containing `application/vnd.idop.bundle+zip`,
followed by `idop.bundle.json` and `content/**`. That media type is not
registered (§20). A Reader that implements packages need not implement
containers.

## 15. Versioning and compatibility

- `formatVersion` is `MAJOR.MINOR`. Minor versions of 1.x only **add**:
  optional members, optional features, new capability types gated by a feature
  name, new error codes. A 1.0 Reader that meets a `1.x` package with x > 0 MAY
  open it when everything it requires is understood, and MUST refuse it
  otherwise.
- A new major version changes the media type or the meaning of an existing
  member, and a Reader MUST refuse a `formatVersion` or `runtimeApiVersion` it
  does not implement. Because the 1.0 schema admits only `"1.0"`, a 1.0 Reader
  refuses any other value as `IDOP-MANIFEST-003` (§9.1);
  `IDOP-UNSUPPORTED-001` is the code of a Reader whose schema admits a version
  it nevertheless does not implement.
- Error codes, once published, keep their meaning forever.
- Only `formatVersion` values of the form `1.x` are defined by this
  specification. A Producer MUST NOT write any other value.

> **Note** *(informative)*. Packages written before this specification
> (pre-release versions, see Annex D) are not IDOP 1.0 packages. A Reader may
> still offer to open them as a convenience; doing so is outside this
> specification and outside its conformance suite.

## 16. Error codes

Every refusal and every Runtime API failure carries a stable code. Codes are
grouped by prefix. The complete registry, with one line per code, is published
at `https://idoplabs.com/spec/idop/1.0/errors/` (machine-readable:
`https://idoplabs.com/spec/idop/1.0/errors/error-codes.json`). New codes are
only ever added there; an existing code never changes meaning (§15).

| Prefix | Raised by |
| --- | --- |
| `IDOP-ZIP-*` | ZIP structure (§4.1) |
| `IDOP-PROFILE-*` | container identification and agreement (§4.2, §7.5) |
| `IDOP-PATH-*` | entry names and storage paths (§4.3, §5) |
| `IDOP-LIMIT-*` | limits (§6) |
| `IDOP-MANIFEST-*` | manifest (§7, §12) |
| `IDOP-UNSUPPORTED-*` | versions and features (§7.2, §15) |
| `IDOP-POLICY-*` | executable boundary (§8) |
| `IDOP-STORAGE-*`, `IDOP-SAVE-*` | storage and Save (§10) |
| `IDOP-NETWORK-*`, `IDOP-CREDENTIAL-*`, `IDOP-ENV-*` | broker and bindings (§11–12) |
| `IDOP-RUNTIME-*`, `IDOP-HOST-*`, `IDOP-UI-*` | Runtime API (§11) |
| `IDOP-ITEMS-*`, `IDOP-WS-*`, `IDOP-PROJECT-*`, `IDOP-BUNDLE-*` | containers and Portable Items |

A Reader SHOULD explain each code to the user in the user's language. The code
itself MUST NOT be localised. A Reader MAY use further codes for faults of its
own implementation (for example, of its internal transport); such codes MUST NOT
use the prefixes above.

## 17. Security considerations

### 17.1 Active content

An IDOP package **contains executable code**: HTML, CSS, JavaScript and
WebAssembly under `code/`. This is its purpose, and the whole of this
specification is organised around it:

- Code runs only after the complete package has been validated (§9.1), so a
  malformed or truncated file never runs at all.
- Code runs in an isolated context with no access to the Reader and no access
  to other documents (§9.3, §9.4). WebAssembly modules and dedicated workers
  run inside that same context and inherit its policy; shared and service
  workers are refused (§8, §9.3).
- The context has no direct network access (§9.3). The Reader closes the
  channels a content security policy governs through that policy, and the
  others — WebRTC, nested `srcdoc` frames, speculative loading — by removing or
  refusing them before document code runs.
- Network access exists only as a capability the user grants, to exact
  origins, through a broker that does not follow redirects, enforces size,
  time and request budgets, and injects credentials the document cannot read
  (§12).
- A document cannot obtain a secret: there is no API that returns one (§11.2).
- Files leave or enter a document only through Reader dialogs the user
  confirms (§11.2); a document cannot choose a location or read a file it was
  not handed. Data can nevertheless leave a document without such a dialog in
  three ways, each tied to the user: text written to the clipboard after a
  user gesture (`ui.copyText`); the document's own state saved into the file
  after a user gesture in the document (`ui.requestSave`); and automatic saving
  into a revision-keeping place the user opened the document from (§10.3).
- The static checks of §8 are an additional layer; the sandbox is the boundary.

Residual risks that this specification does not remove:

- defects in the browser or engine that hosts the sandbox;
- egress channels of a browser engine that neither its content security
  policy nor the Reader's measures close — new web platform features may add
  such channels, and a Reader that removes interfaces from the document's
  realm depends on that realm being the only one the document can reach;
- side channels, including timing;
- denial of service through CPU or memory use (there is no portable way to
  bound a sandboxed context's CPU);
- **social engineering** — a document can display anything, including a
  convincing imitation of a login form or of the Reader's own interface.

Readers SHOULD visibly distinguish document content from their own interface
and SHOULD warn before running a document received from someone else that
requests network access.

### 17.2 Container attacks

The ZIP profile (§4.1), path rules (§5) and limits (§6) exist to defeat known
attacks on archive formats: path traversal ("zip slip"), entry-name collisions
across file systems (including Unicode case folding), decompression bombs
(Deflate is the only compression; per-entry, aggregate and ratio limits are
checked before and during decompression), polyglot and self-extracting files,
divergent local and central headers, entries hidden in bytes the central
directory does not account for, and ZIP64 parser differentials. A Reader MUST
apply them before any extraction or execution. The security considerations of
ZIP as a structured syntax [RFC 6839, §3.6] apply; its encryption is not
permitted (§4.1).

The manifest is JSON [RFC 8259]; the considerations of RFC 8259, §12, apply.
Its size, depth and node count are limited (§6), duplicate keys are refused,
and its content is validated before it is used (§7).

### 17.3 Integrity and authenticity

1.0 provides **no authenticity** and no integrity protection beyond the CRC-32
values of ZIP, which detect accidental damage only. `application` metadata is
self-declared, and the digest of `code/**` is a fingerprint used for consent
(§12.4), not a signature. Anyone can produce a package claiming any title or
author. A Reader MUST NOT present a package as coming from a particular
publisher. Signatures are reserved (`_idop/signatures/`) for a later version.
Where integrity matters, it must be provided by the channel or storage that
carries the file (for example TLS, or a signed container).

### 17.4 Confidentiality

A package is not encrypted. Anything in `storage/**` is readable by anyone who
has the file. Confidentiality in transit and at rest must be provided
externally (for example TLS). Encryption is reserved (`_idop/encryption/`) for
a later version.

### 17.5 Export

A Reader cannot prevent the user from keeping a copy of a document they can
open. "Read-only" in a Reader's interface is not access control and MUST NOT be
described as such.

### 17.6 Processing outside a Reader

A package is an ordinary ZIP archive, and general-purpose tools can extract it.
Its code is safe to run only in a conforming Reader: opening an extracted entry
point directly in a web browser, or serving extracted entries from a web
origin, runs the code with the privileges of that context and without any of
the protections above. Software that does not implement this specification
SHOULD treat `application/vnd.idop+zip` as opaque data, SHOULD NOT execute or
render its entries, and SHOULD offer it for download rather than display it.
Resources such as SVG images can themselves contain script; they are passive
only as a Reader serves them.

### 17.7 External references

Interpreting a package never requires dereferencing a link outside it. Network
access happens only through a capability the user granted (§12).

## 18. Privacy considerations

- A package carries its state. Users SHOULD be told that sending a document
  sends its saved content.
- Credentials and environment values are Reader state and never travel with the
  package (§12.2, §12.3); a recipient must configure their own.
- A document cannot contact any server unless the user grants a capability; the
  prompt names each origin, so the user knows where data could go.
- Timestamps in `document` reveal when a document was created and last saved.
  Producers MAY round them.

## 19. Accessibility considerations

Documents are web content and SHOULD meet WCAG 2.2 level AA. A Reader SHOULD
make its own interface — prompts, errors, the document frame's title —
accessible, and SHOULD give the document frame an accessible name derived from
the document title while labelling it as document content.

## 20. IANA considerations

This specification requests the registration of one media type in the vendor
tree [RFC 6838, §3.2]. The registration template follows.

```text
Type name: application

Subtype name: vnd.idop+zip

Required parameters: N/A

Optional parameters: N/A

Encoding considerations: binary

Security considerations: See Section 17 of this specification and the
  registration request filed with IANA, which summarises it.

Interoperability considerations: See Sections 4 and 15 of this
  specification.

Published specification: this document.

Applications that use this media type: IDOP Cloud
  (https://cloud.idoplabs.com), a browser-based Reader; the "idop"
  command-line validator and packer (https://idoplabs.com/developers/sdk/).

Fragment identifier considerations: No fragment identifier syntax is defined
  for this type, in line with the +zip structured syntax suffix
  [RFC 6839, Section 3.6].

Additional information:
  Deprecated alias names for this type: N/A
  Magic number(s): 50 4B 03 04 at offset 0; the ASCII string "mimetype"
    at offset 30; the ASCII string "application/vnd.idop+zip" at offset 38.
  File extension(s): .idop
  Macintosh file type code(s): N/A

Person & email address to contact for further information:
  Kacper Gościniak, spec@idoplabs.com

Intended usage: COMMON

Restrictions on usage: N/A

Author: Kacper Gościniak (IDOP LABS)

Change controller: Kacper Gościniak, trading as IDOP LABS
  (https://idoplabs.com)

Provisional registration? No
```

The Uniform Type Identifier `com.idoplabs.idop`, conforming to
`public.zip-archive`, may be declared on Apple platforms *(informative)*.
Pre-release files (Annex D) carried the unregistered label
`application/vnd.idop.foundation+zip`; they are not instances of this type.

The bundle transport (§14) identifies itself with
`application/vnd.idop.bundle+zip` inside its own `mimetype` entry. Its
registration is not requested at this time, and until it is, a bundle is
exchanged as `application/octet-stream`.

## 21. References

### Normative

- [APPNOTE] PKWARE, *.ZIP File Format Specification*, version 6.3.10.
- [RFC 2119] Bradner, *Key words for use in RFCs to Indicate Requirement Levels*.
- [RFC 3339] Klyne, Newman, *Date and Time on the Internet: Timestamps*.
- [RFC 4122/9562] *Universally Unique IDentifiers (UUIDs)*.
- [RFC 6454] Barth, *The Web Origin Concept*.
- [ECMA-262] Ecma International, *ECMAScript Language Specification*, §12 (lexical grammar).
- [RFC 6838] Freed, Klensin, Hansen, *Media Type Specifications and Registration Procedures*.
- [RFC 6839] Hansen, Melnikov, *Additional Media Type Structured Syntax Suffixes* (`+zip`).
- [RFC 8174] Leiba, *Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words*.
- [RFC 8259] Bray, *The JavaScript Object Notation (JSON) Data Interchange Format*.
- [SemVer] *Semantic Versioning 2.0.0*.
- [UAX15] Unicode Standard Annex #15, *Unicode Normalization Forms*.
- [UCD] The Unicode Consortium, *Unicode Character Database*, version 17.0.0, `CaseFolding.txt`.
- [JSON Schema] *JSON Schema 2020-12*.

### Informative

- OASIS, *Open Document Format for Office Applications*, Part 3: Packages.
- W3C, *EPUB 3.3*, Open Container Format.
- W3C, *Content Security Policy Level 3*; WHATWG, *HTML* (`iframe` sandboxing).
- W3C, *WebRTC: Real-Time Communication in Browsers*.
- W3C, *Web Content Accessibility Guidelines 2.2*.

---

## Annex A — JSON Schemas (normative)

| Schema | `$id` |
| --- | --- |
| Manifest | `https://idoplabs.com/spec/idop/1.0/schemas/manifest.json` |
| Workspace marker | `https://idoplabs.com/spec/idop/1.0/schemas/workspace.json` |
| Project marker | `https://idoplabs.com/spec/idop/1.0/schemas/project.json` |
| Bundle manifest | `https://idoplabs.com/spec/idop/1.0/schemas/bundle.json` |
| Portable Items | `https://idoplabs.com/spec/idop/1.0/schemas/portable-items.json` |

Each schema is published at its `$id`. The schemas describe IDOP 1.x only.

## Annex B — Conformance suite (normative for claims of conformance)

A Reader or Producer may claim conformance to IDOP 1.0 when it passes the IDOP
1.0 conformance suite: a set of valid packages that MUST open, invalid packages
that MUST be refused with the listed error code (§16).

The suite is published at `https://idoplabs.com/spec/idop/1.0/conformance/`.
Its index, `suite.json`, lists every case with the file name and the expected
outcome — `valid`, or the error code of the first refusal. Each case is a
single `.idop` file that can be fetched and tested independently. Cases are
only ever added; a published case never changes its expected outcome.

The reference implementation (the `idop` command-line tool and the IDOP Cloud
Reader, which share one validator) passes the suite; its build fails otherwise.

## Annex C — Minimal example *(informative)*

`mimetype`:

```text
application/vnd.idop+zip
```

`idop.json`:

```json
{
  "format": "https://idoplabs.com/ns/idop/package",
  "formatVersion": "1.0",
  "runtimeApiVersion": "1.0",
  "entryPoint": "code/index.html",
  "application": { "id": "com.example.counter", "version": "1.0.0", "title": "Counter" },
  "document": {
    "id": "4df56319-e383-4ae8-a519-faa7f4866f90",
    "revisionId": "2e43a209-0a66-4f54-b545-dae25d3b89d0",
    "parentRevisionId": null,
    "createdAt": "2026-10-01T00:00:00Z",
    "modifiedAt": "2026-10-01T00:00:00Z"
  },
  "state": { "schemaVersion": "1.0.0" },
  "requiredFeatures": ["idop.core-storage-v1"],
  "optionalFeatures": [],
  "requiredCapabilities": [],
  "optionalCapabilities": [],
  "environmentBindings": [],
  "credentialBindings": [],
  "extensions": {}
}
```

`code/index.html`:

```html
<!doctype html>
<html lang="en">
  <head><meta charset="utf-8"><title>Counter</title><script type="module" src="app.js"></script></head>
  <body><button id="add">0</button></body>
</html>
```

`code/app.js`:

```js
const button = document.querySelector('#add');
let count = 0;
try {
  count = JSON.parse((await idop.storage.read('count.json')).text).count;
} catch (error) {
  if (error.code !== 'IDOP-STORAGE-NOT-FOUND') throw error;
}
button.textContent = String(count);
button.addEventListener('click', async () => {
  count += 1;
  button.textContent = String(count);
  await idop.storage.write('count.json', JSON.stringify({ count }));
});
```

A document that needs an external API adds, for example:

```json
"requiredCapabilities": [{
  "id": "ai", "type": "network", "origins": ["https://api.example.com"],
  "methods": ["POST"], "credentialBinding": "api-key", "purpose": "Generate answers"
}],
"credentialBindings": [{ "id": "api-key", "required": true, "description": "Key for api.example.com" }]
```

## Annex D — History *(informative)*

IDOP was developed in the open by IDOP LABS from 2025. Two pre-release
versions, `0.1-draft` and `0.2-draft`, were used by the first Reader and were
never published as specifications. IDOP 1.0 replaces both; the table records
what changed so that old files can be recognised.

| Draft | 1.0 |
| --- | --- |
| media type `application/vnd.idop.foundation+zip` | `application/vnd.idop+zip` |
| `format: "urn:idop:package"` | `https://idoplabs.com/ns/idop/package` |
| two profiles, `0.1-draft` and `0.2-draft` | one profile, `1.0`; a document without capabilities is the former 0.1 |
| credential binding names a provider (`openrouter`, `bearer`) | names no service; matched by origin (§12.2) |
| schemas under `idop.foundation` | schemas under `idoplabs.com/spec/idop/1.0/` |
| — | reserved `_idop/signatures/`, `_idop/thumbnail.png`, `_idop/encryption/` |
| no WebAssembly, no workers, text-only state, no file or print dialogs | WebAssembly, dedicated workers, ES modules, binary state and network bodies, Reader-mediated save, open and print (added before the Recommendation) |

Changes to 1.0 after its publication. Those of 2026-10-08 change what a valid
package is only by accepting what was wrongly refused; those of 2026-10-13 also
refuse a few constructions the earlier text was ambiguous about or let through
against its own security claims, and say so:

| Date | Change |
| --- | --- |
| 2026-10-08 | §8: namespace names and words in comments or strings are not refused; §10.3: `modifiedAt` never runs backwards, and automatic saving into a revision-keeping place the user opened from is allowed; §11.2: `ui.requestSave()` from a user gesture saves; §11.4 added |
| 2026-10-13 | Errata from a review of the specification against its schemas, conformance suite and reference implementation. **Now refused**, where the earlier text was ambiguous or did not support its own security claims: bytes the central directory does not account for (§4.1 item 10, `IDOP-ZIP-023`) and a data descriptor that disagrees with it (item 6, `IDOP-ZIP-024`); names that collide under Unicode *full* case folding (§5 rule 7); timestamps not written with `Z` (§7.4); `extensions` keys that are not reverse-domain namespaces (§7.2); extension namespaces that are not lowercase (§4.3); origins not in their ASCII serialization (§12.1). **Now accepted**, having been wrongly refused: entry data containing the bytes of a ZIP64 signature (§4.1 item 2); `serviceWorker` in a comment or string, and call names in JSON or CSS (§8 rule 5). **Clarified**: the archive comment, data descriptors and the code of each rule (§4.1, §4.2, §5); `.wasm` under `code/` and every `_idop/` entry ignored (§4.3); limits refused, JSON depth and nodes defined (§6); what the schema does not express (§7.1); exact lexical rules (§8); which code is reported (§9.1); `/` resolves from the package root (§9.2); channels a content security policy does not govern — WebRTC, `srcdoc` frames, speculative loading — and the obligation to close them (§9.3); codes (§12.2, §12.3, §15); §17 rewritten; one media type requested (§20). Annex A: the published manifest schema no longer refuses every credential binding, and admits only `formatVersion` `"1.0"`. Annex B: 25 cases added. Annex E: `resources/`, not `assets/`. New codes `IDOP-ZIP-023`, `IDOP-ZIP-024`, `IDOP-MANIFEST-027` and `IDOP-MANIFEST-028`; `IDOP-MANIFEST-020` and `-021` keep their registered meanings, which the reference implementation had also used for duplicate binding identifiers. |

## Annex E — Roadmap *(informative)*

This annex records intended work so that implementers can plan for it. It
creates no requirement, and the items may change before they are specified.

| Version | Planned |
| --- | --- |
| 1.1 | Package signatures in the reserved `_idop/signatures/` (author identity and integrity of `code/`, `resources/`, `idop.json`); the document thumbnail `_idop/thumbnail.png` |
| 1.2 | Optional encryption of `storage/**` in the reserved `_idop/encryption/` |
| 2.0 | Real-time collaboration: a merge model for concurrent revisions of the same document |

Changes are proposed and decided as described on the *Governance* page
(`https://idoplabs.com/spec/idop/governance/`). Every 1.x release only adds
(§15); errata to this document are listed on the same page.
