@orangecheck/me-client 0.50.0 → 0.51.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,738 @@
1
+ # Changelog
2
+
3
+ All notable changes to **`@orangecheck/me-client`** will be documented in this
4
+ file.
5
+
6
+ This project follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
7
+ and [Semantic Versioning](https://semver.org/). Wire-format / canonical-message
8
+ changes are coordinated via the relevant `oc-*-protocol` spec repo's CHANGELOG;
9
+ this file tracks the package's TS / Node / runtime API surface.
10
+
11
+ ## [0.51.0] — 2026-10-24
12
+
13
+ ### Added
14
+
15
+ - `safeReturnPath(raw, fallback = '/')`: where to send someone back to after
16
+ they sign in or prove it is them again. It answers `raw` when that is a path
17
+ on your own site, and `fallback` for anything a browser would take elsewhere
18
+ (`//evil.com`, `/\evil.com`, a scheme), a backslash anywhere, C0 and C1
19
+ control characters (browsers drop some, so `/\t/evil.com` becomes
20
+ `//evil.com`), a lone surrogate (which a JSON body can carry), a percent
21
+ that does not decode (`/%`, `/%zz`, bytes that are
22
+ not UTF-8), dot segments, plain or percent-encoded, and anything over 2048
23
+ UTF-16 units. The path comes back
24
+ unchanged. sdk-py's `safe_return_path` answers the same for every input in
25
+ `test-vectors/return-path.json`.
26
+
27
+ ## [0.50.0] — 2026-10-24
28
+
29
+ ### Changed
30
+
31
+ - `exchangeNativeCode(input, options)` checks the traded token as `withOcAuth`
32
+ checks a request's, so `valid` means the same thing on both paths: the
33
+ person has not ended the session everywhere (read as a write: a list that
34
+ can't be read answers `unavailable` `revocations_unavailable`), and the
35
+ account meets the project's "who can sign in" rule, read and cached as
36
+ `checkSignInRule` reads it (`invalid` `bond_required` with `need`, `have`
37
+ and `back_url`; `unavailable` `bond_policy_unavailable`; `invalid`
38
+ `unknown_project_key`). New refusals: `session_ended`, `bond_required`,
39
+ `unknown_project_key`.
40
+ - `projectKey` moves from the input to the options, defaulting to
41
+ `OC_PROJECT_KEY`: it is your own key, from your config. A `projectKey`, or
42
+ any other key the input does not read, throws. New options: `meOrigin`,
43
+ `revocation` (default: read with your project key and `OC_SIGNING_SECRET`) and
44
+ `requireBond`.
45
+ - New type `ExchangeNativeCodeUnavailable`.
46
+
47
+ 0.49.0 is deprecated: use 0.50.0.
48
+
49
+ ## [0.49.0] — 2026-10-24
50
+
51
+ ### Added
52
+
53
+ - `exchangeNativeCode({ code, codeVerifier, redirectUri, projectKey, audience }, { issuer?, timeoutMs? })`
54
+ in `@orangecheck/me-client/server`: the server's half of native sign-in, for
55
+ an app on the person's own device. It trades the one-time code the app's
56
+ loopback listener received at `POST <issuer>/api/auth/native/token`, then
57
+ verifies the returned token for your `audience` as `checkOcToken` does.
58
+ `valid` carries the token and its session (`azp: "native"`); `invalid`
59
+ carries `invalid_grant`, `not_offered`, `bad_request`, `invalid_token` or
60
+ `no_session_handle`; `unavailable` carries `auth_host_unavailable`,
61
+ `rate_limited` or `key_set_unavailable`. Only a mistake in the call throws.
62
+
63
+ ## [0.48.0] — 2026-10-24
64
+
65
+ ### Added
66
+
67
+ - `@orangecheck/me-client/button-auto` (`dist/button-auto.mjs`): the sign-in
68
+ button for a page that loads it by a tag. It enhances every
69
+ `button[data-oc-sign-in]` when it runs, reads its options from the button
70
+ (`data-mark`, `data-appearance`, `data-busy-label`, `data-accessible-label`,
71
+ `data-label="none"`), and reports through DOM events: `oc-signed-in`
72
+ (`{ account, token, waitUntil }`; the button stays busy until every
73
+ `waitUntil` promise settles) and `oc-sign-in-outcome` (`{ status, message }`).
74
+ The page's own code imports nothing, so the file can be loaded from a CDN
75
+ with a pinned version and Subresource Integrity, which covers a
76
+ `<script src>` but no `import` in an inline script. Like `button.mjs`, it is
77
+ one file with no imports. A button it cannot enhance is reported in the
78
+ console and skipped.
79
+
80
+ ## [0.47.0] — 2026-10-24
81
+
82
+ ### Added
83
+
84
+ - A label in any language: `label` takes any words that keep "orangecheck",
85
+ lowercase, as written (`"Se connecter avec orangecheck"`). The approved
86
+ English set stays the default (`SIGN_IN_LABELS`). Words without the name
87
+ still throw. Words already in the button that say "orangecheck" are kept.
88
+ - `busyLabel` sets what the button says while the window is open.
89
+ - `label: false` (or `data-label="none"` on the button) draws the mark alone:
90
+ `aria-label` names it ("Sign in with orangecheck", or `accessibleLabel`), and
91
+ `button.css` makes it at least 44px wide and centred.
92
+ - A `<span data-oc-mark>` placeholder in the button is replaced by the mark,
93
+ at the size `button.css` already gave it, so enhancing changes no size. Its
94
+ value, if any, names the variant (`data-oc-mark="brand"`).
95
+ - `holdWidth(button)`: the busy state keeps the button's width (and minimum
96
+ width), so shorter busy words move nothing beside it.
97
+
98
+ ### Changed
99
+
100
+ - `button.css`: the words stay on one line; the mark is 1.75em wide (the tile
101
+ 1.25em) with its aspect ratio set before it paints; under
102
+ `forced-colors: active` the mark is one flat shape in the text colour, the
103
+ tile has no ink square, and the brand button's ring and edge use system
104
+ colours. The `inherit` appearance no longer draws a focus ring: the site's
105
+ own ring shows, as on its other buttons. `brand` keeps its own.
106
+ - Built with `@orangecheck/mark` 0.2.0: the mono mark's faces step 1, 0.6 and
107
+ 0.3, so it reads as the check at button size.
108
+
109
+ ## [0.46.1] — 2026-10-24
110
+
111
+ ### Fixed
112
+
113
+ - `button.css` leaves the button's alignment to the site in the `inherit`
114
+ appearance. It centred the mark and label, so on me-demo, whose other
115
+ full-width buttons start at the left, the orangecheck button alone was
116
+ centred. `brand` still centres its own content.
117
+
118
+ ## [0.46.0] — 2026-10-24
119
+
120
+ ### Added
121
+
122
+ - `@orangecheck/me-client/button`: `enhanceSignInButton(button, options)` makes
123
+ the site's own `<button>` a "Sign in with orangecheck" button. It keeps the
124
+ button's classes and styles, adds the orangecheck mark (`mono` in the text
125
+ colour by default, `brand`, `tile` or none) and an approved label
126
+ (`SIGN_IN_LABELS`), opens the popup inside the click, holds a focusable busy
127
+ state, and reports how the popup ended (`OUTCOME_COPY` has the words). The
128
+ file has no imports, so it can be copied onto the site's origin, and it
129
+ parses no HTML.
130
+ - `@orangecheck/me-client/react`: `<SignInWithOrangecheck>`, the same as a
131
+ native button (`react` is an optional peer).
132
+ - `@orangecheck/me-client/button.css`: optional, zero specificity. `inherit`
133
+ (the default) adds only the mark's spacing, a 44px target and a focus ring;
134
+ `brand` is orangecheck's button, themed by `--oc-*` properties.
135
+
136
+ ## [0.45.0] — 2026-10-24
137
+
138
+ ### Added
139
+
140
+ - `matchMergedUser(session, lookup)` and `mergedHandles(session)` (server):
141
+ after someone merges two orangecheck accounts, a sign-in token carries
142
+ `merged_rh`, your site's handle for each account merged in. Look them up in
143
+ the handles you stored; the answer is `none` (a new user), `one` (attach this
144
+ `did_oc` to that user) or `conflict` (two of your users: pick neither). A
145
+ claim that is not a list of at most 16 non-empty strings reads as none.
146
+ `orangecheck` 3.4.0 has `match_merged_user`; both are held to
147
+ `test-vectors/integrator.json` (`merged`).
148
+
149
+ ## [0.44.0] — 2026-10-24
150
+
151
+ ### Changed
152
+
153
+ - A family session (no `aud`: the ochk.io cookie a *.ochk.io site reads with
154
+ no `audience`) is checked against ochk.io's revocation feed by default, in
155
+ `checkOcSession`, `getOcSession`, `withOcAuth`, `ocAuthExpress` and
156
+ `ocAuthHono`, through auth-core's `familyRevocationCheck`, the same feed
157
+ site-kit reads. **A family site must now set `OC_REVOCATION_FEED_TOKEN`**; with it unset, a family session makes these
158
+ calls throw, naming the variable, rather than accept it by signature alone.
159
+ `revocation: false` still reads it by signature alone on purpose, and a
160
+ check the site passes still wins. Tokens bound to your site (`aud`) are
161
+ checked as before. A token whose `aud` is an empty list counts as a family
162
+ session here, as verification with no audience already counts it.
163
+ orangecheck (Python) reads no family sessions:
164
+ `verify_session` refuses a token without `aud`.
165
+
166
+ ## [0.43.0] — 2026-10-24
167
+
168
+ ### Added
169
+
170
+ - `checkSignInRule(session, { projectKey })` from
171
+ `@orangecheck/me-client/server`: your project's "who can sign in" rule for a
172
+ session you verified yourself (with `verifyOcToken`, or one your own session
173
+ replaces). The rule is read and held as `withOcAuth({ projectKey })` holds
174
+ it: a minute, the last one read standing ten more while it can't be read,
175
+ then refused. It answers `{ ok: true }` or `{ ok: false, status, body }` with
176
+ `withOcAuth`'s status and body: 403 `bond_required` with `need`, `have` and
177
+ `back_url`, 503 `bond_policy_unavailable`, or 500 `unknown_project_key`.
178
+ `requireBond` sets the floor yourself and reads nothing. It takes only the
179
+ session object `verifyOcToken`, `checkOcToken`, `getOcSession` or an adapter
180
+ returned, and throws for claims read any other way, or on an option it does
181
+ not read. sdk-py 3.3.0 has `check_sign_in_rule`, and both are
182
+ held to `test-vectors/server-helpers.json` (`sign_in_rule`).
183
+
184
+ ## [0.42.1] — 2026-10-24
185
+
186
+ ### Docs
187
+
188
+ - The API reference covers the `/server` and `/popup` entry points, at
189
+ ochk.io/docs/sdk/me-client/server and ochk.io/docs/sdk/me-client/popup. No
190
+ code change.
191
+
192
+ ## [0.42.0] — 2026-10-24
193
+
194
+ ### Added
195
+
196
+ - `checkOcToken(token, options)` from `@orangecheck/me-client/server`, for the
197
+ route that receives the token from the sign-in popup. It answers
198
+ `{ status: 'valid', session }`, `{ status: 'invalid', reason? }` (`reason:
199
+ 'no_session_handle'` for a bound token with no handle) or `{ status:
200
+ 'unavailable', reason: 'key_set_unavailable' }`. Answer the last with 503 so
201
+ the page tries again: `verifyOcToken` answers `null` for it, which reads as a
202
+ failed sign-in. It takes `verifyOcToken`'s options, `requireHandle` included.
203
+
204
+ ### Changed
205
+
206
+ - Needs `@orangecheck/auth-core` ^2.17.0: a key set with no usable key reads as
207
+ an outage (503 `key_set_unavailable`, shared vector "a key set with no key the
208
+ verifier can use"), and the key-set fetch gives up after 10 seconds.
209
+
210
+ ## [0.41.0] — 2026-10-24
211
+
212
+ ### Added
213
+
214
+ - From `/server`, for after a sign-in:
215
+ - `spendOnce(jti, exp, store)`, `JtiStore` and `MemoryJtiStore`: a token's
216
+ `jti` starts one session. True the first time, false for a repeat or a
217
+ token that has expired. The store is yours, shared by every server
218
+ (`add` must be atomic); a store that fails rejects.
219
+ - `revokeToken(token | tokens, { issuer?, timeoutMs? })`: ends a token, or up
220
+ to eight, at the auth host (`POST <issuer>/api/auth/revoke`). Resolves to
221
+ `{ ok: true, revoked }` or `{ ok: false, reason, status }` (`rate_limited`,
222
+ `bad_request`, `unavailable`), never throws on an outage. An unknown option
223
+ throws, and so does an `issuer` that is not one origin (https, or http on
224
+ this machine; no path, query, fragment or user name). ochk.io takes 60
225
+ calls a minute per IP: queue a `rate_limited` or `unavailable` result and
226
+ try again, since the token stays valid until it expires.
227
+ - `FederationMigratingWebhookPayload`, `FederationMigrationCancelledWebhookPayload`
228
+ and `FederationSuccessor`: the two federation notices, typed as me.ochk.io
229
+ sends them. `/integrator` now exports them too, with `SystemWebhookPayload`
230
+ and `DropClosedWebhookPayload`.
231
+ - `test-vectors/server-helpers.json`: what the adapters answer for a token, and
232
+ how `spendOnce` and `revokeToken` behave, read by this package and by
233
+ `orangecheck` 3.2.0's `check_oc_session`, `spend_once` and `revoke_token`.
234
+
235
+ ### Changed
236
+
237
+ - Needs `@orangecheck/auth-core` ^2.16.0. A request whose token can't be
238
+ checked because ochk.io's key set can't be read (and no copy younger than
239
+ `jwksMaxStaleMs` is held) is `{ status: 'unavailable', reason:
240
+ 'key_set_unavailable' }` from `checkOcSession`, and `withOcAuth`,
241
+ `ocAuthExpress` and `ocAuthHono` answer it 503 `key_set_unavailable`, for
242
+ reads and writes alike. It was signed out. `getOcSession` still answers
243
+ `null`. `OcSessionCheck`'s `unavailable` names its `reason`
244
+ (`OcSessionUnavailable`), and a write while the list of ended sessions can't
245
+ be read is `revocations_unavailable`, as before. The same answer as
246
+ `orangecheck` 3.2.0's `check_oc_session`, held to
247
+ `test-vectors/server-helpers.json`.
248
+ - `WebhookHeaders` documents `OC-Envelope-Id` as the event's `id` for a
249
+ billable event only. A system notice (`OC-Class: system`) has no `id` in its
250
+ body, so this header is its only id. `OC-Key-Id` names a key published at
251
+ `https://me.ochk.io/api/dev-jwks`.
252
+
253
+ ## [0.40.1] — 2026-10-23
254
+
255
+ ### Changed
256
+
257
+ - Needs `@orangecheck/auth-core` ^2.15.0: a sign-in token that carries `rh`
258
+ verifies only when `rh` is a non-empty string and `aud` is one string your
259
+ site accepts, so every such session is looked up on its audience's list of
260
+ ended sessions. `SessionPayload.rh` names the handle. The same as
261
+ `orangecheck` 3.1.0, held to `test-vectors/integrator.json`.
262
+
263
+ ## [0.40.0] — 2026-10-23
264
+
265
+ ### Changed
266
+
267
+ - **Breaking, by design.** A sign-in token bound to your site (one with `aud`)
268
+ that carries no `rh` is refused by `verifyOcToken`, `getOcSession`,
269
+ `checkOcSession`, `withOcAuth`, `ocAuthExpress` and `ocAuthHono`. `rh` is the
270
+ token's handle on your project's list of ended sessions, so without it sign
271
+ out everywhere can't end the session, and the quickstart asked every site to
272
+ refuse such a token itself. Now the SDK does. Every token from the ochk.app
273
+ sign-in popup carries one, so a site that signs people in that way sees no
274
+ change. `checkOcSession` answers `{ status: 'signed_out', reason:
275
+ 'no_session_handle' }`, and an adapter with `required` answers
276
+ `401 { reason: 'no_session_handle' }`; the SDK says why once on the console.
277
+ `requireHandle: false` accepts such a token, which sign out everywhere then
278
+ does not end. A family session (no `aud`, on *.ochk.io) is not held to it:
279
+ the family's own feed ends it. `requireHandle` must be `true` or `false`; an
280
+ unknown option is still refused. The same as `orangecheck` 3.0.0
281
+ (`require_handle`), held to `test-vectors/integrator.json`, where every token
282
+ now carries `rh` and two that don't are refused.
283
+ - Popup tokens have carried `rh` since 2026-10-22 and live up to 30 days. A site
284
+ that keeps the popup token and verifies it again on later requests, rather
285
+ than starting its own session, signs out anyone still holding an older one,
286
+ once, until about 2026-11-21; they sign in again.
287
+ - `audience: '*'` admits family sessions too, which have no `rh`; only the
288
+ family's own feed ends them. Use it only on a route that receives tokens
289
+ forwarded from *.ochk.io.
290
+
291
+ ## [0.39.0] — 2026-10-23
292
+
293
+ ### Added
294
+
295
+ - OC Connect for a site that keeps its own login, in `/server`:
296
+ `connectProvision`, `connectClaimLink` and `connectDelete`. Each takes
297
+ `{ apiKey, userId }` (plus `consent`, `email`, `emailVerified` for provision)
298
+ and resolves `{ ok: true, … }` or `{ ok: false, reason, status }`. A refusal or
299
+ an outage is a result, never a throw, and a call gives up after `timeoutMs`
300
+ (5 s, at most 30 s). Only a mistake in the call throws, before anything is sent:
301
+ an option it does not read, a missing key or user id, `emailVerified` without
302
+ `email`, `consent: false` (an unticked box means no call at all), or a call
303
+ where there is a `document` (a hint for the commonest slip, not a guard: import
304
+ these only from server code). Only the options object's own keys are read,
305
+ once, so an inherited `consent` is never used. Every call goes to
306
+ `https://ochk.io` and nowhere else; a redirect is an error. A claim link
307
+ anywhere but `https://ochk.app` is `unavailable`. A user id is counted in UTF-16
308
+ code units, as ochk.io counts it.
309
+ - `@orangecheck/me-client/connect-consent`: `CONNECT_CONSENT_LABEL` and
310
+ `CONNECT_CONSENT_BLURB`, the words for an optional "also make me an orangecheck
311
+ account" box, from a module with no imports so any UI can render it. Also
312
+ exported from the main and `/server` entries. The same words and results as
313
+ `orangecheck` (py) 2.13.0, held to `test-vectors/connect.json`.
314
+
315
+ ## [0.38.1] — 2026-10-22
316
+
317
+ Requires `@orangecheck/auth-core` `^2.13.0`.
318
+
319
+ ### Fixed
320
+
321
+ - A server whose wall clock stepped back let the last sign-in rule stand past ten
322
+ minutes and waited longer before asking me.ochk.io again. Both are the longer of
323
+ the time on `performance.now()` and on the wall clock now, so neither a clock set
324
+ back nor a paused host stretches them, as auth-core 2.13.0 measures the list of
325
+ ended sessions.
326
+ - Requests that arrive together while the rule is being read share that one read
327
+ instead of each asking me.ochk.io.
328
+ - `checkOcSession` reads the list of ended sessions once per request and decides
329
+ on that answer, so two reads can't disagree about the same request.
330
+
331
+ ## [0.38.0] — 2026-10-22
332
+
333
+ ### Added
334
+
335
+ - `checkOcSession(headers, options)`: like `getOcSession`, but resolves
336
+ `{ status: 'signed_in', session }`, `{ status: 'signed_out' }` or
337
+ `{ status: 'unavailable' }`, the last when the token verifies but me.ochk.io's
338
+ list of ended sessions can't vouch for this request (a write while it can't be
339
+ read). `getOcSession` is unchanged.
340
+
341
+ ### Changed
342
+
343
+ - `withOcAuth`, `ocAuthExpress` and `ocAuthHono` answer such a write
344
+ `503 { ok: false, reason: 'revocations_unavailable' }` before your handler runs,
345
+ instead of treating the person as signed out (which `required` turned into a
346
+ 401). Reads go on as before.
347
+
348
+ ## [0.37.0] — 2026-10-22
349
+
350
+ ### Changed
351
+
352
+ - `projectKey`: a request with no session is not held to the project's sign-in
353
+ rule and never waits on reading it, so pages that serve signed-out people keep
354
+ working while me.ochk.io can't be reached. **A project rule no longer refuses
355
+ signed-out requests by itself: set `required: true` if a route must refuse
356
+ them.** A signed-in request is held to the rule as in 0.36.1. An explicit
357
+ `requireBond` still implies `required`.
358
+
359
+ ## [0.36.1] — 2026-10-22
360
+
361
+ ### Fixed
362
+
363
+ - `projectKey`: an answer from me.ochk.io that does not say the sign-in rule
364
+ (not `ok: true`, no `require_bond`, or a floor that is not a whole number of
365
+ at least 0) counts as unreadable, not as "no requirement".
366
+ - `projectKey`: while the rule can't be read, the last one read stands for ten
367
+ minutes, then requests are refused (`503 bond_policy_unavailable`) until it
368
+ can be read.
369
+ - `meOrigin` now applies to the list of ended sessions too, and both the rule and
370
+ the list are held per me.ochk.io as well as per project key.
371
+
372
+ ## [0.36.0] — 2026-10-22
373
+
374
+ ### Added
375
+
376
+ - `signInWithOcOutcome(options?)`: opens the sign-in popup like `signInWithOc` and
377
+ resolves with how it ended: `{ status: 'signed_in', account, token }`,
378
+ `'blocked'` (the browser refused the window), `'closed'` (the person closed it),
379
+ `'aborted'` (your signal) or `'failed'`. `signInWithOc` is unchanged: it still
380
+ resolves the account and token, or `null`.
381
+ - Shared vectors for who may sign in (`bond`), held by `bondMeets` here and by
382
+ sdk-py's `bond_meets`.
383
+
384
+ ## [0.35.0] — 2026-10-22
385
+
386
+ Requires `@orangecheck/auth-core` `^2.12.0`.
387
+
388
+ ### Changed — revocation by per-audience handle
389
+
390
+ - The server helpers look up a token's `rh` (its revocation handle for its own
391
+ audience) in me.ochk.io's list of ended handles for that audience, one list per
392
+ audience the site's tokens carry, so a site served from both `www` and the apex
393
+ is covered with one configuration. A token without `rh` is checked by its
394
+ signature alone. The list names nobody, and two sites' handles for one person
395
+ never match.
396
+
397
+ ### Deprecated
398
+
399
+ - 0.34.0. me.ochk.io answers its request with an empty list, which it reads as
400
+ "nothing ended". Use 0.35.0 or later.
401
+
402
+ ## [0.34.0] — 2026-10-22
403
+
404
+ Requires `@orangecheck/auth-core` `^2.11.0`.
405
+
406
+ ### Added
407
+
408
+ - `getOcSession`, `withOcAuth`, `ocAuthExpress` and `ocAuthHono` refuse a
409
+ session the person ended everywhere (sign out everywhere, a passkey removed,
410
+ the account deleted) once `OC_PROJECT_KEY` and `OC_SIGNING_SECRET` are set.
411
+ They read the account cutoffs from me.ochk.io once a minute through
412
+ auth-core's `integratorRevocationCheck`. While the cutoffs can't be read, reads
413
+ go on and writes are refused. New options: `method` (the adapters pass it),
414
+ `projectKey` and `revocation` (a check of your own, or `false`). Without the
415
+ two variables nothing changes, apart from a one-time warning in production.
416
+
417
+ ### Changed
418
+
419
+ - The README and `signInWithOc`'s example hand the token to the site's server,
420
+ which keeps it in an httpOnly cookie, as ochk.io/docs/me/quickstart teaches.
421
+
422
+ ## [0.33.0] — 2026-10-22
423
+
424
+ ### Changed
425
+
426
+ - Requires `@orangecheck/auth-core` ^2.10.0, so `verifyOcToken` (and
427
+ `withOcAuth`, `ocAuthExpress`, `ocAuthHono`) honours a key published as
428
+ retired only for tokens issued before its `retired_at`, and stops leaning on
429
+ a stale ochk.io key list after `jwksMaxStaleMs` (6 hours by default).
430
+ - `oc.identity.verifyActivityAttestation` and `oc.webhook.verify` take the same
431
+ `jwksMaxStaleMs` option, with the same 6-hour default: the last fetched key
432
+ list stands in during an outage until then, and verification fails closed
433
+ after. An unknown `kid` refetches the list at most once a minute per issuer,
434
+ and keeps the cached keys if that refetch fails.
435
+ - The integrator vectors (`test-vectors/integrator.json`, shared with sdk-py)
436
+ carry a retired key: one token it signed before retiring, which verifies,
437
+ and two it did not, which are refused.
438
+
439
+ ## [0.32.4] — 2026-10-21
440
+
441
+ ### Fixed
442
+
443
+ - `oc.scope.request` sends the user straight to ochk.app's consent page.
444
+ It went to me.ochk.io, whose pages moved to ochk.app on 2026-10-19, so
445
+ every request took an extra redirect. `setOrigin()` no longer moves the
446
+ consent page, since it sets the API origin and the API keeps no pages.
447
+ Pass `origin` to point it somewhere else.
448
+ - Comments and the README no longer point at me.ochk.io pages that moved,
449
+ or at a private repo.
450
+
451
+ ## [0.32.3] — 2026-10-19
452
+
453
+ ### Changed
454
+
455
+ - `oc.identity.verifyActivityAttestation` reads the attestation from the
456
+ signed bytes (`canonical_b64`) and returns those values. The bytes must be
457
+ an `oc-me-activity` attestation in canonical form, the expiry is the signed
458
+ one, and a bundle whose readable `attestation` differs from the signed
459
+ bytes fails. `attestation` in the input is now optional, and the result
460
+ carries `attestation` only when every check passes. Upgrade if you gate on
461
+ the result.
462
+
463
+ ## [0.32.2] — 2026-10-17
464
+
465
+ ### Fixed
466
+
467
+ - A handler typed with Next's own `NextApiRequest` / `NextApiResponse`
468
+ type-checks inside `withOcAuth`. Read the session with
469
+ `WithOcSession<NextApiRequest>`.
470
+ - The missing-`audience` warning also fires for a token in your own
471
+ `oc_session` cookie, the flow the quickstart teaches; it used to stay
472
+ silent there and every sign-in 401ed with no clue.
473
+ - `payment.authorize` no longer requires `identity`, which the server ignores;
474
+ it takes the account from the session.
475
+ - The npm description no longer advertises the removed React button.
476
+
477
+ ## [0.32.1] — 2026-10-17
478
+
479
+ The first published 0.32. The `me-client-v0.32.0` tag was pushed on the
480
+ wrong commit, where the version still read 0.31.0, so the release refused it
481
+ and nothing was published under 0.32.0.
482
+
483
+ ### Removed
484
+
485
+ - `OcSignInButton`, deprecated in 0.30. It was the only React code in the
486
+ main entry, so a Node backend that imported `oc` crashed with "Cannot find
487
+ package 'react'". The main entry has no React now, and `react`,
488
+ `react-dom` and `@orangecheck/auth-client` are no longer peer dependencies.
489
+ Sign in with `signInWithOc()` from `/popup`.
490
+
491
+ ### Changed
492
+
493
+ - A `projectKey` that names no project answers `500 unknown_project_key` and
494
+ logs once which key is wrong. It used to read as an outage
495
+ (`503 bond_policy_unavailable`) on every request.
496
+ - `req.ocSession` is typed on Express's own `Request`, and `OcHonoEnv` types
497
+ `c.get('ocSession')`: `new Hono<OcHonoEnv>()`.
498
+ - `webhook.verify` accepts a missing signature or kid (as `req.header()`
499
+ returns them) and answers `ok: false`.
500
+ - The npm homepage is the quickstart.
501
+
502
+ ## [0.31.0] — 2026-10-17
503
+
504
+ ### Changed — templates price at the full user share
505
+
506
+ - Every `ARCHETYPE_TEMPLATES` event, and the disabled default, sits at
507
+ `user_share_pct: 0.8`, the most a user can earn after the 20% platform
508
+ fee. Prices drop so each user earns exactly what they did at the old
509
+ 0.65 or 0.7 share: account creation 1,300 → 1,056 sats, still 845 earned.
510
+ A smaller share only returned part of the fee to the developer's balance
511
+ after charging it, so it cost more for nothing.
512
+ - Template summaries and examples are plain words with no real company
513
+ names. Doc comments say what the user earns, not "cashback".
514
+
515
+ ## [0.30.1] — 2026-10-17
516
+
517
+ ### Fixed
518
+
519
+ - `back_url` on a `403 bond_required` opens the Backing section of the
520
+ account page, `https://ochk.app/me/account#backing`. The old address
521
+ redirected to the top of the page.
522
+
523
+ ## [0.30.0] — 2026-10-17
524
+
525
+ ### Added — `accountId` names who earns
526
+
527
+ - `oc.event.fire({ accountId })` takes the earner's account id, the `did:oc`
528
+ from `/api/auth/me`. It is what `userAddress` always held: an account id,
529
+ never a Bitcoin address.
530
+
531
+ ### Deprecated
532
+
533
+ - `userAddress`. It still works and means the same thing. Passing both with
534
+ different values throws.
535
+ - `OcSignInButton`. Use `signInWithOc()` from `/popup` on your own site, or
536
+ `<OcSignIn>` from `@orangecheck/auth-client` on orangecheck's. It shares a
537
+ name with auth-client's button, which does something else, and it goes in a
538
+ later minor.
539
+
540
+ ## [0.29.0] — 2026-10-16
541
+
542
+ ### Added — paying users is optional
543
+
544
+ - `payingAt(periods, at)` and the `PayPeriod` type: whether a project pays its
545
+ users at a moment, from the `pay_periods` that `GET /api/integrator/config`
546
+ publishes. A project pays always, in promos, or never.
547
+ - `oc.event.verify(envelope, config, amount, { payPeriods })` flags a receipt
548
+ billed outside every period (`outside_pay_period`).
549
+ - `fireBatch` results can be `not_paying`, and the response carries
550
+ `next_pay_period` when the project isn't paying.
551
+
552
+ ### Changed
553
+
554
+ - `oc.event.fire` resolves to what the server sends: `{ earned: true, event, … }`
555
+ or, outside a pay period, `{ earned: false, reason: 'not_paying',
556
+ next_pay_period }`. It was typed as a bare `BillableEvent`, which the response
557
+ never was: `res.id` was always undefined and `res.event.id` didn't compile.
558
+
559
+ ## [0.28.0] — 2026-10-16
560
+
561
+ ### Changed
562
+
563
+ - A `bond_required` refusal speaks the wire's case: `need` is
564
+ `{ min_sats, min_days }` (plus `max_age_secs` when set), as `have` and the
565
+ project's `require_bond` already were. It also carries `back_url`, where the
566
+ person can back their account; link them there.
567
+ - A signed-out request on an optional route, while the project's requirement
568
+ has never been readable, gets `503 bond_policy_unavailable` rather than
569
+ `401 unauthenticated`: signing in wouldn't have helped.
570
+
571
+ ### Fixed
572
+
573
+ - While me.ochk.io is unreachable, a failed read of the project's requirement
574
+ is retried at most every ten seconds instead of on every request, each of
575
+ which waited up to four seconds.
576
+ - The README imported `useOcSession` from this package; it comes from
577
+ `@orangecheck/auth-client`. `oc.session.create` records no charge, and the
578
+ docs no longer say it does.
579
+
580
+ ## [0.27.4] — 2026-10-16
581
+
582
+ ### Fixed — two docstrings that misled integrators
583
+
584
+ - `OcPopupResult.account` said integrators get a per-project anonymous
585
+ identifier. They get `did_oc`, the same at every site.
586
+ - `OcSignInButton` said it was a drop-in sign-in. It rides the family cookie,
587
+ so it works only on orangecheck's own sites; a third-party site uses
588
+ `signInWithOc()` and `withOcAuth`.
589
+
590
+ ## [0.27.3] — 2026-10-16
591
+
592
+ ### Fixed — a tightened sign-in requirement took up to fifteen minutes to bite
593
+
594
+ - `projectKey` read the requirement from the project's price config, which is
595
+ edge-cached for ten minutes, and held it five more. Live, an app that had
596
+ just turned on "backed accounts only" kept admitting unbacked accounts. It
597
+ now reads me.ochk.io's uncached `/api/integrator/<key>/sign-in` and holds it
598
+ one minute.
599
+
600
+ ## [0.27.2] — 2026-10-16
601
+
602
+ ### Added — ask for accounts backed by bitcoin
603
+
604
+ - `withOcAuth` / `ocAuthExpress` / `ocAuthHono` take `requireBond: { minSats,
605
+ minDays, maxAgeSecs }`, or `projectKey` to read the floor the integrator set
606
+ in the project's settings (public config, cached five minutes). An account
607
+ below it gets 403 `bond_required` with what was needed and what it has; a
608
+ requirement that has never been readable gives 503
609
+ `bond_policy_unavailable`, never a pass. Apps that set neither are unchanged.
610
+ - Re-exports `readBondClaim`, `bondMeets` and `BondClaim` from auth-core 2.8.
611
+
612
+ ### Fixed
613
+
614
+ - The README quick start used an export that doesn't exist (`useOcSession`)
615
+ and a claim tokens don't carry (`addr`). It now shows the popup and server
616
+ flow that works cross-domain.
617
+
618
+ ## [0.27.1] — 2026-09-24
619
+
620
+ ### Fixed
621
+
622
+ - **`oc.family.scopes('oc-pledge')`.** `FamilyVerb` and the verb allowlist
623
+ covered five of the six family verbs, so the pledge verb was refused before
624
+ any request was made. me.ochk.io serves `/api/family/scopes/oc-pledge` as of
625
+ the same day.
626
+
627
+ ## [0.27.0] — 2026-09-22
628
+
629
+ ### Added
630
+
631
+ - **`audience` on `withOcAuth`, `ocAuthExpress`, `ocAuthHono` and
632
+ `getOcSession`.** The sign-in popup issues each site a token bound to that
633
+ site's origin. Pass your own origin —
634
+ `withOcAuth(handler, { audience: 'https://your-site.example' })` — and a
635
+ token issued to any other site is refused. Sites on `*.ochk.io` that read the
636
+ family cookie leave it out.
637
+ - A one-time console warning when a site-bound token reaches a verifier with
638
+ no `audience` configured, rather than a silent 401 on every sign-in.
639
+
640
+ ### Changed
641
+
642
+ - Requires `@orangecheck/auth-core` ^2.7.0.
643
+
644
+ ## [0.25.3] — 2026-09-18
645
+
646
+ ### Fixed — webhook verification could never succeed
647
+
648
+ Two independent defects, either of which was fatal:
649
+
650
+ - **Wrong JWKS.** `webhook.verify` fetched `https://ochk.io/.well-known/jwks.json`
651
+ — the family SESSION key — when me.ochk.io signs its deliveries with a
652
+ different key, published at `https://me.ochk.io/api/dev-jwks`. Any caller that
653
+ did not pass `{ jwk }` failed with `kid … not in JWKS` before it could check a
654
+ signature. The default is now the webhook JWKS; `{ issuer }` still overrides.
655
+ - **Signed material disagreed.** me.ochk.io signed `sha256(body)` while this
656
+ verifier verifies over the raw body — so no delivery it ever sent could
657
+ validate. The server is the side that drifted (its own published JWKS note
658
+ says "sigs over the raw webhook body") and has been corrected; this release
659
+ is the matching half, plus a contract test on the server that signs here and
660
+ verifies with this function.
661
+
662
+ ## [0.25.2] — 2026-09-18
663
+
664
+ ### Fixed
665
+
666
+ - `FireEventOptions.signingSecret` said the signature is "REQUIRED in live
667
+ mode". me.ochk.io now refuses an unsigned `/api/integrator/event` POST in
668
+ **test mode too** — a user session proves a user, never the paying project,
669
+ and a signed-in stranger holding a public `project_key` could otherwise bill
670
+ that project into their own ledger. The docstring is published as SDK
671
+ reference on docs.ochk.io, so a stale one is a false published claim.
672
+
673
+ ## [Unreleased]
674
+
675
+ - _(no pending changes)_
676
+
677
+ ## [0.38.3] — 2026-10-23
678
+
679
+ ### Changed
680
+
681
+ - The session check passes `@orangecheck/auth-core` only the options it
682
+ reads (`issuer`, `jwksCacheTtlMs`, `jwksMaxStaleMs`, `audience`).
683
+
684
+ ## [0.38.2] — 2026-10-23
685
+
686
+ ### Changed
687
+
688
+ - **Unknown options throw.** `withOcAuth`, `ocAuthExpress` and `ocAuthHono`
689
+ throw a `TypeError` when built with an option they do not read, and
690
+ `getOcSession` / `checkOcSession` reject. So does a key in `requireBond`
691
+ other than `minSats`, `minDays` and `maxAgeSecs`. They read only the keys
692
+ in `WithOcAuthOptions`.
693
+
694
+ ## [0.25.1] — 2026-09-14
695
+
696
+ ### Fixed
697
+
698
+ - Raises the `@orangecheck/auth-core` floor to `^2.6.0`, which bounds how often
699
+ an unrecognised `kid` can force a JWKS refetch. This package re-exports
700
+ `verifyOcToken` / `getOcSession`, so an integrator verifying tokens on their
701
+ own server was the one paying for it: a stream of tokens carrying random kids
702
+ dropped the key cache and refetched on every rejection, putting a network
703
+ round-trip in front of each and pointing the volume at the auth host.
704
+
705
+ ## [0.25.0] — 2026-09-03
706
+
707
+ ### Fixed
708
+
709
+ - **`session.invalidate()` emitted the wrong telemetry code.** It sent
710
+ `session.intra_signin`, which the event taxonomy defines as "user pressed
711
+ sign-in while a valid session was already open" — the opposite of a teardown.
712
+ A subscriber therefore saw a sign-in event every time an integrator tore a
713
+ session down. It now emits `session.teardown`.
714
+
715
+ Both codes are non-billable, so no integrator was ever charged for this; the
716
+ cost was corrupt telemetry in the subscriber's own callback. `emitTelemetry`
717
+ notifies local subscribers only and sends nothing to OC.
718
+
719
+ ### Added
720
+
721
+ - `'session.teardown'` on the `TelemetryEvent['code']` union, and in
722
+ `NON_BILLABLE_EVENTS` server-side (served via `/api/abuse-limits`). The
723
+ taxonomy had no teardown code at all, which is why `invalidate` reached for
724
+ the nearest wrong one. A consumer doing an exhaustive `switch` over the union
725
+ will need a case for it.
726
+
727
+ ### Changed
728
+
729
+ - `invalidate`'s docstring now says what the call does: OC sessions are
730
+ stateless, derived from the `oc_session` JWT, so there is no server-side
731
+ record to delete and the endpoint acknowledges without revoking anything.
732
+ Dropping your copy of the token IS the logout. The
733
+ `/api/session/invalidate` OpenAPI summary, which read "Invalidate a session
734
+ (logout)", is corrected in oc-me-web alongside this.
735
+
736
+ ## [0.24.0] and earlier
737
+
738
+ See git history.