---
title: "API Reference"
description: "Every method of window.eqtyNotary and of the extension message interface, what needs consent, what each returns, the events, and the error codes."
source: "EQTY Notary"
---
The notary has one API, reached two ways:

- **From a page**: `window.eqtyNotary`, defined in every page and iframe in a secure context
  before any page script runs. The caller is the page's origin.
- **From another extension**: `runtime.sendMessage(notaryId, {method, params})`, which replies
  `{result}` or `{error: {code, message}}`. The caller is the sending extension's ID. In
  Firefox `notaryId` is `browser-notary@eqtylab.io`; in Chrome it is the extension's ID.
  An extension may pass `evidence.tabId` to `attest` to have the notary observe the tab it acted
  in. The SDK's `extensionNotary(id)` wraps this in the same interface as `window.eqtyNotary`.

The caller's identity always comes from the browser's sender metadata (`sender.origin`,
`sender.tab`, `sender.id`), never from the request. Opaque origins (sandboxed iframes, `data:`)
are refused.

## Methods

All methods return Promises.

| method | consent | returns |
|---|---|---|
| `info` (property) | — | `{name, protocol, version}` |
| `detect()` | no | `{available, anchored, state, name, protocol, version}` |
| `isReady()` | no | `{status: "ready", state: "READY", anchored, did?}` |
| `publicKey()` | yes | `{status, public_key, did, curve: "SECP256r1", alg: "ES256", type, key_scope}` |
| `getDids()` | yes | `{executedOn, operatedBy, registeredBy}` |
| `credential()` | yes | manifest with your key's credential chain |
| `sign({data, hash?, algo?})` | yes | `{status, signature, public_key, did}` |
| `signText(text)` · `signBytes(bytes)` · `signJSON(value)` | yes | `sign` reply + `data` |
| `verifySignature({did, signature, text \| bytes \| json \| data})` | no | `{valid}` |
| `attest({action, agent?, result?, inputs?, evidence?})` | yes | `{manifest, computation, action, observation}` |
| `registerStatement({type, body})` | yes | `{manifest, statement}` |
| `verify(manifest)` | no | `{ok, statements, badBlobs, bindings}` |
| `viperStatus()` | no | `{enabled, mode}`: whether [VIPER](../viper.mdx) signs this site's LLM requests, and `"direct"` or `"relay"` |

Events on `window`: `eqtyNotary#initialized`, `eqtyNotary#announce` (detail
`{info, notary}`); dispatch `eqtyNotary#request` to get an announcement.

`sign` has the same contract as the desktop notary's [`POST /v1/sign`](../../desktop-notary/advanced/api.mdx):
`data` is hex, only `SHA256` and `ECDSA` are accepted, signatures are raw `r||s` hex with low-s,
and `data` is at most 2 MiB. `signJSON` signs the RFC 8785 (JCS) form, so key order does not
matter.

### `attest` parameters

| Field                  | Default | Meaning |
| ---------------------- | ------- | ------- |
| `action`               | required | Any JSON object describing what the agent did. `type` and `selector` enable DOM matching; give each action a unique `id`. |
| `agent`                | none    | The agent's self-description, recorded as the computation |
| `result`               | none    | The outcome the agent reports |
| `inputs`               | none    | `urn:cid:` references to what the agent consumed |
| `evidence.corroborate` | `true`  | Match the action to a DOM event |
| `evidence.windowMs`    | `10000` | How far back to look for that event |
| `evidence.screenshot`  | `false` | Add a PNG of the visible tab, if it is visible |
| `evidence.domSnapshot` | `false` | Add the serialized DOM, up to 5 MB |
| `evidence.tabId`       | caller's tab | Extensions only: the tab to observe |

Action types the DOM matching understands: `click`, `dblclick`, `rightclick`,
`type` / `fill` / `input`, `select`, `check`, `submit`, `press` / `keypress`. Other types are
signed but not matched. Form values are recorded as SHA-256 and length, never in clear; password
fields not at all.

### `registerStatement` types

| `type`                   | `body` fields |
| ------------------------ | ------------- |
| `DataRegistration`       | `data` (CID or CIDs) |
| `ComputationRegistration` | `input`, `output` (CID or CIDs), `computation?` (CID), `executedOn?` (DID; defaults to the browser) |
| `MetadataRegistration`   | `subject`, `metadata` (CIDs) |
| `StorageRegistration`    | `data` (CIDs), `storedOn` (DID) |
| `GovernanceRegistration` | `subject`, `document` (CIDs) |

`registeredBy` and `operatedBy` are always the caller's key. Unknown fields are rejected.

## The `fetch` wrapper

The page API also replaces `window.fetch`. LLM POSTs (paths ending in `/chat/completions`,
`/completions`, `/responses`, `/embeddings`, `/messages`, `/messages/count_tokens` or
`/complete`) from a site with VIPER on are signed and sent by the extension, and resolve to a
`Response` with `x-viper-*` headers added. Everything else goes to the browser's `fetch`
unchanged. VIPER is authorized by the popup's per-site switch, not the consent prompt. See
[VIPER](../viper.mdx).

## Detection

None of these need consent or reveal a key:

| Signal | Meaning |
| ------ | ------- |
| `window.eqtyNotary` | Defined when the extension is installed |
| `<html data-eqty-notary="1">` | The same, readable from CSS; the value is the protocol version |
| `eqtyNotary#initialized` event | Fired once on `window` when the API is ready |
| `eqtyNotary#announce` event | A `CustomEvent` with `detail: {info, notary}`, fired once on load and in answer to every `eqtyNotary#request` dispatched on `window` |

The attribute and the global also let any site tell the extension is installed.

## Limits

| Limit | Value |
| ----- | ----- |
| Signing requests per caller | 120 a minute by default, set in the popup |
| `sign` data | 2 MiB |
| DOM snapshot | 5 MB |
| DOM event look-back | 10 s by default (`evidence.windowMs`) |
| VIPER request body | under 10 MiB |

## Errors

Rejections are `Error`s with a `code`:

| code | meaning |
|---|---|
| `DENIED` | the user declined the prompt |
| `FORBIDDEN` | not a secure context, or an opaque origin (sandboxed iframe, `data:`) |
| `RATE_LIMITED` | too many signing requests a minute for this site |
| `BAD_REQUEST` | malformed input: not hex, unsupported `hash`/`algo`, bad statement fields |
| `TOO_LARGE` | `sign` data over 2 MiB |
| `PROVISIONING` | the notary is starting, or requires a desktop notary that isn't ready |
| `UNAVAILABLE` | the extension restarted mid-call; retry |