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