@metalabel/dfos-client 0.36.0 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -136,7 +136,7 @@ It throws `ApiRequestVerifyError`, carrying `reason` (`invalid` / `unverifiable`
136
136
 
137
137
  ### `@metalabel/dfos-client/siwd`
138
138
 
139
- The end-to-end integration recipe (mint an app identity, serve the app description, verify the callback) is at <https://docs.dfos.com/docs/developers/sign-in-with-dfos/setup>.
139
+ There are two end-to-end integration recipes, and which one you want depends on where your application runs. An app with a domain (mint an app identity, serve the app description, verify the callback) follows <https://docs.dfos.com/docs/developers/sign-in-with-dfos/setup>. A CLI or agent running on the user's own machine, redirecting to a loopback port, follows <https://docs.dfos.com/docs/developers/sign-in-with-dfos/local-apps>.
140
140
 
141
141
  ```typescript
142
142
  import {
package/dist/siwd.d.ts CHANGED
@@ -87,7 +87,13 @@ interface SiwdLoginRequestInput {
87
87
  domain: string;
88
88
  /** Exact redirect target; must match the RP's registered or served allowlist. */
89
89
  redirectUri: string;
90
- /** Requested scope. `identity` is the only scope implemented today. */
90
+ /**
91
+ * Requested scope: a space-separated SET of scope tokens (the OAuth `scope`
92
+ * convention), each of which must be one specs/SIWD.md §Scopes and Credentials
93
+ * registers. A request naming an unregistered token is refused WHOLE rather
94
+ * than partially honored — a consent screen that silently dropped a token
95
+ * would describe something other than what was asked for.
96
+ */
91
97
  scope: string;
92
98
  /** Consent-screen prose. A host MAY decline to render it; see specs/SIWD.md. */
93
99
  statement?: string;
@@ -222,6 +228,14 @@ declare const MAX_SIWD_CLIENT_CHAIN_OPS = 100;
222
228
  * FULL ordered operation log, genesis first, as base64url of its JSON array —
223
229
  * the same grammar as the `challenge` param, so one decoder shape serves both.
224
230
  *
231
+ * THIS IS THE LOOPBACK CARRIAGE FORM, and only that. An application that holds a
232
+ * domain encodes nothing: it publishes the very same log as the raw JSON array
233
+ * of the `identity_chain` member of its `/.well-known/dfos-app.json` app
234
+ * description (SIWD.md §`identity_chain` — chain carriage), where the origin
235
+ * serving the file is what associates the domain with the DID. Same chain, same
236
+ * carriage rules — a URL is simply the carrier available to software that holds
237
+ * no origin to publish from.
238
+ *
225
239
  * The DID derived from the genesis operation MUST equal the `client_did` the
226
240
  * request names; a request where the two disagree makes no claim at all and the
227
241
  * host refuses it WHOLE rather than ingesting the chain and ignoring the
@@ -242,7 +256,12 @@ declare const MAX_SIWD_CLIENT_CHAIN_OPS = 100;
242
256
  declare const encodeSiwdClientChain: (log: string[]) => string;
243
257
  interface SiwdClientIdentity {
244
258
  did: string;
245
- /** Verbatim identity-op JWS log, genesis first — feed to encodeSiwdClientChain. */
259
+ /**
260
+ * Verbatim identity-op JWS log, genesis first. A loopback client feeds it to
261
+ * `encodeSiwdClientChain` to carry on the authorize URL; an application that
262
+ * holds a domain serves this same array verbatim as the `identity_chain`
263
+ * member of its app description document.
264
+ */
246
265
  chain: string[];
247
266
  /** DID URL of the current auth key — feed to signSiwdAskProof. */
248
267
  kid: string;
@@ -251,11 +270,19 @@ interface SiwdClientIdentity {
251
270
  privateKey: Uint8Array;
252
271
  }
253
272
  /**
254
- * Mint a fresh client identity for the loopback credential tier: one Ed25519
255
- * keypair and a single genesis `create` operation naming it as the auth,
256
- * assertion, and controller key. That is the whole identity a CLI needs to ask
257
- * under this tier a DID it can prove control of, and a one-operation chain
258
- * small enough to carry on the request itself.
273
+ * Mint a fresh client identity: one Ed25519 keypair and a single genesis
274
+ * `create` operation naming it as the auth, assertion, and controller key. That
275
+ * is an entire application identity a DID whose key control is provable, and a
276
+ * one-operation chain small enough to travel anywhere a chain has to travel.
277
+ *
278
+ * TIER-AGNOSTIC. What comes back is an ordinary DFOS identity, not a
279
+ * loopback-only artifact; the tier is a property of how the identity is
280
+ * PRESENTED, not of the identity itself. An application that holds a domain
281
+ * serves `chain` verbatim as the `identity_chain` member of its
282
+ * `/.well-known/dfos-app.json` app description and names `did` as its
283
+ * `client_did` there; a loopback client carries the same chain on the authorize
284
+ * request instead (`createSiwdLoopbackLoginRequest`), because it has no origin
285
+ * to publish from. Both are minted here.
259
286
  *
260
287
  * KEY CUSTODY IS THE CALLER'S, and the identity is only as durable as the
261
288
  * custody: persist `privateKey` and `chain` — an OS keychain, a file the caller
@@ -295,9 +322,11 @@ interface SiwdLoopbackLoginRequestInput {
295
322
  /** Loopback redirect target — `http://` on localhost / 127.0.0.1 / [::1], any port/path. */
296
323
  redirectUri: string;
297
324
  /**
298
- * Requested scope. Naming a client identity opens the tier, so every scope the
299
- * HOST offers is available here the `identity`-only bound belongs to the
300
- * anonymous loopback shape, which has no `client_did` to issue a credential to.
325
+ * Requested scope, in the same space-separated set form as
326
+ * `SiwdLoginRequestInput.scope`. Naming a client identity opens the tier, so
327
+ * every scope the HOST offers is available here the `identity`-only bound
328
+ * belongs to the anonymous loopback shape, which has no `client_did` to issue
329
+ * a credential to.
301
330
  */
302
331
  scope: string;
303
332
  /** Consent-screen prose. A host MAY decline to render it; see specs/SIWD.md. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metalabel/dfos-client",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "type": "module",
5
5
  "description": "DFOS Client — the client-side kit for participating in the protocol: resolve, verify, prove. Fetch, resolve, verify-orchestration and cache over untrusted relays, plus the SIWD and API-AUTH proof surfaces. Holds no keys; all crypto truth comes from @metalabel/dfos-protocol",
6
6
  "license": "MIT",
@@ -47,15 +47,15 @@
47
47
  "README.md"
48
48
  ],
49
49
  "peerDependencies": {
50
- "@metalabel/dfos-protocol": "^0.36.0",
51
- "@metalabel/dfos-web-relay": "^0.36.0"
50
+ "@metalabel/dfos-protocol": "^0.36.1",
51
+ "@metalabel/dfos-web-relay": "^0.36.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^24.10.4",
55
55
  "tsup": "^8.5.1",
56
56
  "vitest": "^4.1.8",
57
- "@metalabel/dfos-web-relay": "0.36.0",
58
- "@metalabel/dfos-protocol": "0.36.0"
57
+ "@metalabel/dfos-protocol": "0.36.1",
58
+ "@metalabel/dfos-web-relay": "0.36.1"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsup",