Publishing signed blobs
The PublishBlobs endpoint as the mobile app uses it: request format, what is signed, time, responses, callers and how tests avoid production writes.

POST {server}/api/PublishBlobs is the one write endpoint of a Seed site that Seed Exact uses. The app builds content-addressed blobs, signs them on the device with an identity's Ed25519 key, and uploads them. The server needs no session or token: the signatures inside the blobs are the authorization. Two features write this way: comments (Discuss) and profile edits (Profile).

Request

POST {server}/api/PublishBlobs Content-Type: application/cbor Accept: application/json DAG-CBOR of {blobs: [{cid?: string, data: bytes}, ...]}

    The body is encoded with the app's own CBOR encoder (src/crypto/cbor, see Crypto: vendored CBOR and gzip codecs). data is the blob's bytes; cid is included when the builder supplies one and omitted otherwise. Both callers use the same mapping: b.cid ? {cid: b.cid, data: b.data} : {data: b.data}.

    Deadline: exactTimeout: 15000 in both callers.

    The call is a direct fetch, not the read client, because that client is GET only.

    {server} has trailing slashes trimmed. For comments it is readContextServer (the server of the visible reader); for profiles it is the configured server.

What gets signed

Caller

Blobs, in order

Builder

postComment

One Comment blob (plus attachment blobs, which the mobile composer never produces)

createComment

publishProfile

A genesis Change (only for a home that does not exist yet), a Change with SetAttributes operations, a version Ref

createProfilePublishBlobs

A Comment blob carries type: "Comment", body (blocks), space (the target account's key bytes), path, version (the document's head CIDs), optional replyParent and threadRoot CIDs, signer, ts and sig. The profile Ref carries the space, an empty path, the genesis, the new head and the generation. The Bun test for profiles shows the Ref blob is sent without a cid. The exact encodings and signing rules are documented in Crypto: changes, refs, comments and profiles and Crypto: primitives and key derivation.

The signer is always built the same way: signerFor(store, account) from Identity gives the key, and the caller adapts it to {principal: principalFromEd25519(publicKey), sign}.

Time

Blob timestamps are not read in the data module. The Contract action computes time.epochAtZero + performanceNow() and passes it as nowMs; both callers use Math.round(nowMs). See State, refresh and stale-reply patterns. The app does not enforce a time window here, and none is visible in the app's code or mocks for this endpoint.

Reads before a write

Both callers read current state first, through the read API, so the blob references real versions:

    Comment: Resource for the document's version; for a reply, Resource for the parent comment (its version and threadRootVersion).

    Profile: Resource for the home document, then ListChanges to compute genesis, heads, depth and generation. Anything other than a clean document or not-found refuses the save, so a network failure can never create a second home.

Responses

Only the HTTP status is relied on.

Caller

Non-2xx handling

After success

Comment

The server refused the comment ({status}): {detail}, where detail is the JSON body's error or json.error when present

Derive the comment id from the blob (commentRecordIdFromBlob), drop that document's cached listing, navigate to the new thread

Profile

The server refused the profile ({status}). Try again.

Re-read /api/Account and report success only if it shows the new name and summary

Thrown errors (offline, timeout) become Couldn't post: {message} for comments and the raw message for profiles. Neither caller retries, and a failed post keeps the person's draft.

In tests

    Contract write tests use https://dev.hyper.media with the public BIP39 test-vector identity: one in discuss.test.contract (a comment and two replies), one in profile.test.contract (two saves). app.ts lists net.fetch https://dev.hyper.media for them. Both files state that they never write to production.

    profile.test.contract uses fail fetch "https://dev.hyper.media/api/PublishBlobs" to prove a failed upload keeps the form.

    The local test server forwards only GET requests to hyper.media, so a publish to it cannot reach production. In the thread scenario of the mock notify service, POST /api/PublishBlobs answers 409 {"error": "Reply received by local fixture"}, which open-site-activity.test.contract asserts in the composer.

    Bun tests decode the uploaded CBOR: the discuss test checks the signed reply's replyParent, threadRoot, version and path and the 15000 ms deadline; the profile test verifies every blob's signature (discuss load.test.ts, profile profile.test.ts).

Known limits

    No media upload: comments have no attachments and profiles cannot set an icon.

    Documents cannot be created or edited from the mobile app; only comments and profile metadata are published. See Current limits and known gaps.

User stories

The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0
Linked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentPublishing signed blobsPublishing signed blobs
Citations 0Children & links 19

Loading child documentsโ€ฆ

Connections show where other documents or comments link to this document.

Related documents

Loading connectionsโ€ฆ