Bindle v0 runtime profile

Public release and live third-party conformance remain separately gated. This document supersedes earlier discovery-only SDK and disconnected runtime descriptions. Amendments labelled "proposed (approved provisionally 2026-10-20)" below are normative proposals; their runtime work is deferred to EXT-X1, and is not claimed as implemented.

Discovery and registration

The host manifest is /.well-known/bindle/manifest.json, with version 0, exact issuer, authorization_request_endpoint, authorization_endpoint, token_endpoint, rpc_endpoint, jwks_uri, preferences_contract, and redirect presentation. Endpoint URLs belong to the issuer. Discovery is host-level, cookie-free and publicly CORS-readable. Opaque OAuth tokens need no JWT verification keys; /oauth/jwks therefore returns an empty key set and does not imply OIDC support.

This initial runtime uses operator-reviewed clients and immutable fragments. FEDERATION_CLIENTS is a JSON array of {id,name,origin,redirectUris}. Redirects are exact registered URLs on the registered origin. Names are presentation, not proof of trust. Operators must establish origin control before adding a client. FEDERATION_SCHEMAS is a JSON object keyed by fragment URL, whose values are the corresponding public documents. The registry prevents SSRF and arbitrary executable schemas; no resource or fragment URL causes ambient server fetching. Self-hosts can inject a reviewed fetch capability. Open dynamic registration is not implemented; the optional client ID metadata documents below are the only network client resolution. The registries and enabled flag are independently configurable on Workers and Node.

Client ID metadata documents (client-id-metadata.v1)

Implemented locally, off by default; not production-verified. With CLIENT_METADATA_ENABLED=true and an injected SSRF-safe egress port, the provider accepts an HTTPS URL client_id that no reviewed registration names and resolves it to an OAuth client ID metadata document (draft -02). The manifest then declares features["client-id-metadata.v1"] = {}; without the flag or the port nothing is declared and URL IDs are ordinary unregistered clients. Code: packages/federation/client-metadata.mjs (ClientDirectory).

Fragment bytes are validated against the bounded declarative field subset and pinned using SHA-256 over canonical() JSON: recursively sorted object keys using JavaScript string ordering, array order preserved, scalar JSON.stringify, UTF-8 bytes, unpadded Base64url digest. No executable properties, external references or UI HTML are accepted. A URL whose digest changes is rejected; publish a new URL for a new version.

HTTP flow

  1. An app discovers the selected provider. BindleClient.beginLogin(handle,{requests}) generates a random state and PKCE verifier, derives S256 and POSTs /api/oauth/requests with {identity,clientId,redirectUri,challenge,challengeMethod:'S256',state,requests}. Requests are {fragment,required,purpose,fields,methods?} in the implemented baseline. AMD-C2 — proposed (approved provisionally 2026-10-20): requests MAY additionally carry digest (sha256- plus the canonical JSON SHA-256 digest in unpadded base64url); the provider MUST reject a mismatch with its pin or fetched document. Methods are {field:{contractURL:[method]}}. At most eight fragments are requested; an empty list is an identity-only connection.
  2. The provider resolves the explicit handle to an active identity and returns {requestId,view}. The SDK redirects to /oauth/authorize?request_id=.... Requests last ten minutes. Targeted authorization reveals identity availability and a public UUID locator; it is not an enumeration-proof lookup. Public discovery does not reveal individual existence. IP/subnet/service admission limits bound lookup and request creation.
  3. The provider page loads its actual session and request. An anonymous view has public request metadata only. Signing in preserves only a validated, expiring same-provider authorization continuation; it creates no grant. Only the target account can approve the request.
  4. Users configure missing fragments, choose optional fragments, inspect every shared value, choose resources/methods and review affected apps. POST /api/preferences is owner-session/Origin/CSRF protected. Scalar edits propagate to approved consumers; additions, resource scope changes, removal/restoration and generation changes require fresh resource consent. Optional decline survives configuration of another fragment.
  5. POST /api/oauth/requests/:id/decision accepts {requestId,approved:[{fragment,revision,fields,resources,methods}]} or {requestId,denied:true}. Cancel needs no configured values. Approval checks the current revision, owner authority epoch and app connection generation. It redirects only to the exact registered callback with code/state/iss or access_denied/state/iss. Codes last sixty seconds and are consumed atomically once.
  6. POST /oauth/token supports standard form fields grant_type=authorization_code, code, code_verifier, client_id, redirect_uri. It returns {access_token,token_type:'Bearer',expires_in:300,issuer,subject,client_id,audience,grants,granted_fragments}. The SDK verifies exact callback, state, issuer, client, audience, subject and token metadata, clears the callback query and pending verifier, and keeps the bearer in memory. The native profile additionally returns refresh_token and refresh_expires_in, with an absolute eight-hour lifetime. The SDK retains both access and renewal credentials only in memory. It rotates the renewal credential before access expiry; reloading loses the session and starts a fresh login. Providers advertise supported grants in grant_types_supported.
  7. POST /bindle/rpc uses Authorization Bearer plus {version:'0',tx:UUID,resource,contract,method,args}. @preferences with the preferences contract's read({fragment}) returns only granted fields. Resource-valued fields yield {id,contracts,token}. The opaque reference hides the backing resource URL and private scope, remains stable across consumers and renewal, and resolves relative logical keys. Each resource token is independently attenuated to its field, resource, scope, generation and live method grants; it cannot read sibling resources or scalar preferences. The SDK's callResource uses that token rather than the app's broader bearer.

AMD-C5 — proposed (approved provisionally 2026-10-20). The token response and client grant listing MUST report per-requested-fragment outcomes through fragment_outcomes, a map from exact fragment URL to granted, declined, unsupported or unavailable. A missing outcome MUST be interpreted as declined, never as granted. granted_fragments continues to carry only granted fragment details. Outcomes do not confer authority; unsupported and unavailable follow the public-fact rules in extensions §5.2, without revealing private occupancy.

CORS permits only registered app origins for request/token/RPC endpoints, and public manifest/JWKS reads. Owner methods never use app-origin CORS or bearer authority. Unknown/expired tokens fail closed. Header/body/origin/JSON byte bounds apply before processing; RPC envelopes/results are bounded to 1,500,000 bytes. Configured storage currently supports at most 1 MiB per object; that is an implementation limit, not a storage plan size. Actual provider capability and conformance limits are independently documented.

Authority, scoping and revocation

The controller authenticates through the real IdentityService and sharded identity repository. Account authority is a digest of permanent assignment and current recovery authority. Exchange and every RPC check current account status and authority epoch. Account recovery, suspension or deletion invalidates existing access. App connections are ordinary managed resources with transport bindle; disconnect changes generation and invalidates parent and child tokens. GET /api/grants lists owner grants; DELETE /api/grants/:id revokes one fragment grant with Origin/CSRF checks.

A resource assignment is a URI or {resource:URI,scope:{prefix?,readOnly?,maxObjectBytes?}}. Scope support comes from the optional resource-scoping contract; unsupported options fail closed. Storage prefix means the selected key and slash-delimited descendants, rather than a raw textual prefix. Read-only denies write/delete/write-presigning. Byte limits bound object reads/uploads. Presigning preserves these restrictions through signed proxy URLs when a native backend cannot enforce them. Presign also requires the corresponding get/put permission on the same field; each URL authorizes only its requested read or write operation. Prefix-constrained URLs remain opaque. Native URLs are used only where size/version/other bounds can be enforced, disclose the backing address and have expiry-only revocation; proxy URLs recheck current authority. See storage contract for exact arguments and headers. Ranged reads under a byte limit remain disabled for external connectors until full object size can be verified; hosted storage verifies the full size. Scope belongs to the shared preference field and applies to every consumer. Apps cannot edit it. The owner editor at /preferences reviews old/new values and the exact live assigned subscriptions, then performs a single explicit shared save using expectedRevision, reviewedConsumerDigest and updateShared:true. Consumer/grant/assignment changes invalidate that review. Existing field/method ceilings are preserved; revoked, disconnected or removed subscriptions cannot revive. A subscription can remain reviewable when a temporary shared restriction disables all its previously approved methods; the owner can explicitly restore those methods within their existing ceiling. Without the explicit shared review, changed/removed/restored assignments permanently narrow old resource grants. Old child references/tokens stop working on every assignment change; apps reread the fragment for the replacement reference.

Native resource descriptors are refreshed from actual owned, connected resources before review and dispatch. Their generations are snapshotted in grants. Reconnecting a provider never silently restores old access. The native Account effect boundary checks identity epoch, app connection, resource generation and scope before replay or effects. Grant revocation prevents subsequent admissions; an operation admitted before revocation can finish. Remote effects and grant metadata are not one distributed transaction, and no stronger guarantee is claimed.

AMD-C3 — proposed (approved provisionally 2026-10-20). Preferences reads MUST project approved resources in owner order, omit unapproved resources and add their field to requiresConsent; an unapproved addition MUST NOT withhold approved resources. AMD-C8/C9 — proposed (approved provisionally 2026-10-20): brokered resources are projected only through preferences v2; v1 omits them and reports the field in requiresConsent. Only brokered-resources.v1 permits direct integration RPC, with its endpoint/audience and revocation rules; the native gateway behavior above is unchanged.

Persistence and scaling

Federation state is independent per stable account UUID, in a FederationObject on Workers and a private SQLite database on Node. Opaque locators have UUID.random256bit form; the UUID locates state but grants no authority. Missing/inactive UUIDs are rejected before allocating federation state. Code and token records are keyed by domain-separated hashes, never plaintext credentials. Owner preferences and grants do not require global scans or a global lock.

Per-account bounds are 32 pending requests, 64 codes, 256 bearer records and 256 live grants. Expired requests/codes/tokens and revoked grants are pruned during bounded admission; retained mutations are bounded to 256 outcomes for twenty-four hours per account. Resource tokens are deterministic derivations of the parent secret plus exact attenuation and a private random field incarnation, stored by hash and never outlive their parent. Opaque reference IDs are derived independently of the parent bearer from that private incarnation, so a consumer cannot guess hidden prefixes offline and all consumers see the same scoped resource identity. Incarnations rotate on assignment changes and are never returned to apps. At most 32 live renewal families and 128 retained rotation hashes per family are permitted. Consumed hashes stay until absolute expiry or family retirement; replay revokes the family and all its access/child tokens. Wrong-client or arbitrary-token attempts cannot revoke another family. Renewal intersects only the original still-live grants, never newly approved ones. Recovery/disconnect/revoked families are reclaimed at admission, and account-local alarms prune expired ephemeral state in bounded batches. Node uses the same cleanup policy and private timers. Do not imply unlimited background automation throughput from these limits.

Mutations durably reserve a journal entry before native/provider effects. Fingerprints bind resource, contract, method, args, account epoch, connection/resource generation and scope. Repeated writes return the recorded result only after current authorization; collisions fail. Unknown outcomes remain indeterminate and require reconciliation by fresh reads. Local transactional adapters retain a short transaction; remote account/provider dispatch executes outside the federation metadata transaction to avoid lock cycles and false distributed atomicity.

SDK session behavior

Email absence detection is implemented, but magic-link account materialization and delivery are separately gated; the SDK does not silently create accounts or attach email.

The SDK coalesces concurrent renewal into one request. Aborting one caller does not replay a spent secret or cancel other waiters. Sign-out/new login prevents late credentials from restoring a session. Tracked resource references are reacquired by the exact same opaque ID after renewal; a changed assignment fails rather than substituting another resource. Uncertain renewal outcomes require a new login. Mutating RPCs are never retried merely because a network response was lost.