Skip to main content
@phosra/sdk-dev/protocol is @openchildsafety/ocss re-exported verbatim. Phosra adds zero cryptographic logic to this subpath. If you later integrate a different OCSS-conformant provider, this import is identical across all of them.

The management/protocol boundary

@phosra/sdk-dev has two clearly-named halves. Understanding the split matters because it is the ownership-boundary made legible in code: The root import (@phosra/sdk-dev) does not re-export the protocol surface. This is intentional: it keeps crypto off the management import and makes the OCSS/Phosra boundary legible to tree-shakers and to readers. See Phosra Developer SDK for the full SDK reference including the management half.

What the protocol surface covers

The /protocol subpath is the OCSS reference TypeScript library. It covers the full Trust Framework verification surface:
  • Receipt signing and verification — sign OCSS write receipts with an Ed25519 signing key; verify receipts against the Trust List.
  • Sealed envelopes — create and open the two-layer OCSS envelope (the harm_context router-blind lane).
  • Rule vocabulary and canon — the 123-category rule vocabulary as typed identifiers; canonical JSON serialization for deterministic hashing.
  • Family hash derivation — compute the family-scoped hash that appears in receipts and attestation exports.
  • Trust List resolution — fetch and verify the Trust List; resolve a signing party’s key from it.

Installation

@openchildsafety/ocss@0.1.5 is published on npm. @phosra/sdk-dev — the unified wrapper that will re-export it as /protocol — is a planned future package; install the exact public OCSS version directly for now (tracked on the status page).
@openchildsafety/ocss is a peer dependency — the open OCSS library. Installing it separately keeps the OCSS version pinnable independently of the Phosra management client version.
ESM-only. @openchildsafety/ocss is pure ESM. A CommonJS require("@openchildsafety/ocss") fails with ERR_PACKAGE_PATH_NOT_EXPORTED (or ERR_REQUIRE_ESM). Import it with static ESM import { … } from "@openchildsafety/ocss", or from CJS use a dynamic const ocss = await import("@openchildsafety/ocss"). The same applies to every subpath.

Usage

Sign a write receipt

Verify a receipt against the Trust List

Sealed envelopes (router-blind lane)

The router handles the sealed blob as an opaque byte string — it reads only the outer-layer headers needed for routing and never calls open. This is cryptographic enforcement of the router-blind invariant (OCSS §3A.3), not a policy.

Resolve the Trust List

Verify a signed document to root (copy-paste ready)

Encoding: two alphabets. RFC-9421 request signing uses standard base64 (padded, +/) for the Signature header and the RFC-9530 Content-Digest header. Everything else — receipt sender_signature, envelope signatures, Trust List JWK x/y, public keys — is base64url-RAW (unpadded, -_, RFC 4648 §5). The SDKs handle this for you; hand-rolling RFC-9421 with base64url (or decoding keys with standard base64) produces a silent 401 / corrupted bytes. (Source: packages/ocss-ts/src/crypto.ts “porter trap 2”.)

Importing directly from @openchildsafety/ocss

Because /protocol is a verbatim re-export, you can import directly from @openchildsafety/ocss if you prefer — the symbols are identical:
@phosra/sdk-dev is not published yet, so every example on this page imports from @openchildsafety/ocss directly — the published package. When the wrapper ships, the /protocol subpath will re-export it verbatim and both import forms will resolve to the same object identities.
Importing via /protocol is recommended when you want the dependency footprint of @phosra/sdk-dev to cover both halves in package.json. Import directly from @openchildsafety/ocss if you are not using the Phosra management surface at all.

Subpath exports


Further reading

  • Phosra Developer SDK — the full SDK reference, including the management half
  • Trust Framework — the Trust List and signing model the protocol surface implements
  • OCSS specification — normative text for signed verbs, envelopes, and the §9.4 attestation export