@orangecheck/me-client 0.53.4 → 0.55.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 CHANGED
@@ -8,6 +8,43 @@ and [Semantic Versioning](https://semver.org/). Wire-format / canonical-message
8
8
  changes are coordinated via the relevant `oc-*-protocol` spec repo's CHANGELOG;
9
9
  this file tracks the package's TS / Node / runtime API surface.
10
10
 
11
+ ## [0.55.0] — 2026-10-26
12
+
13
+ ### Changed
14
+
15
+ - `validateIntegratorConfig` refuses an enabled event whose fields the fee code
16
+ cannot read, naming the field, as me.ochk.io does: `site_pays` must be an
17
+ object of kind `fixed_sats` with a numeric `sats` or `percent_of_amount` with
18
+ a numeric `pct`; `user_share_pct` must be a number; an `agent` override must
19
+ be an object whose `site_pays` and `user_share_pct`, when given, follow the
20
+ same rules. An event that is not an object, and `events` that is not an
21
+ object, are refused too. A disabled event is still checked only for its key
22
+ and class.
23
+
24
+ ### Added
25
+
26
+ - `test-vectors/integrator-config.json` carries the shape cases under `shape`,
27
+ each with the exact error me.ochk.io and this package give.
28
+
29
+ ## [0.54.0] — 2026-10-26
30
+
31
+ ### Changed
32
+
33
+ - `validateIntegratorConfig` refuses what me.ochk.io refuses: an event `class`
34
+ other than `A`, `B` or `C`, and a custom event key that is not a slug
35
+ (`CUSTOM_EVENT_KEY_RE`) or that names something every object already has
36
+ (`"constructor"`, `"toString"`, in any case). Both checks run whether the
37
+ event is enabled or not.
38
+
39
+ ### Added
40
+
41
+ - `isEventClass`, `isInheritedName` and `CUSTOM_EVENT_KEY_RE` are exported from
42
+ the package and from `/integrator`.
43
+ - `IntegratorEventConfig` carries the custom-event fields me.ochk.io stores:
44
+ `label`, `description` and `class`.
45
+ - `test-vectors/integrator-config.json` ships in the package. me.ochk.io's
46
+ validator is held to the same cases.
47
+
11
48
  ## [0.53.4] — 2026-10-26
12
49
 
13
50
  ### Changed
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-DfxCvxuH.mjs';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-DfxCvxuH.mjs';
3
- import { B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, S as SignInOptions, a as Session, P as PaymentAuthorizeOptions, b as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-BM0Vy-ac.mjs';
4
- export { c as ALL_EVENT_SUBTYPES, d as ARCHETYPE_TEMPLATES, e as AgentClassOverride, h as AttestTier, C as ClassASubtype, i as ClassBSubtype, j as ClassCSubtype, k as ComputedFees, D as DropCadence, l as DropClosedWebhookPayload, m as DropResponseBlock, n as DropScheduleSummary, o as EVENT_SUBTYPES, p as EventClass, q as EventSubtype, r as EventSubtypeMetadata, s as FederationMigratingWebhookPayload, t as FederationMigrationCancelledWebhookPayload, u as FederationStatus, v as FederationSuccessor, w as IntegratorArchetype, x as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, y as MIN_INTEGRATOR_PRICE_SATS, z as PLATFORM_FEE_POLICY, G as SessionPolicy, H as SigningMethod, J as SiteFeeShape, K as SystemWebhookPayload, W as WebhookHeaders, L as WebhookPayload, N as computeFees, O as subtypesForClass, Q as validateIntegratorConfig } from './integrator-BM0Vy-ac.mjs';
3
+ import { B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, S as SignInOptions, a as Session, P as PaymentAuthorizeOptions, b as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-DDeHg7vj.mjs';
4
+ export { c as ALL_EVENT_SUBTYPES, d as ARCHETYPE_TEMPLATES, e as AgentClassOverride, h as AttestTier, C as CUSTOM_EVENT_KEY_RE, i as ClassASubtype, j as ClassBSubtype, k as ClassCSubtype, l as ComputedFees, D as DropCadence, m as DropClosedWebhookPayload, n as DropResponseBlock, o as DropScheduleSummary, p as EVENT_SUBTYPES, q as EventClass, r as EventSubtype, s as EventSubtypeMetadata, t as FederationMigratingWebhookPayload, u as FederationMigrationCancelledWebhookPayload, v as FederationStatus, w as FederationSuccessor, x as IntegratorArchetype, y as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, z as MIN_INTEGRATOR_PRICE_SATS, G as PLATFORM_FEE_POLICY, H as SessionPolicy, J as SigningMethod, K as SiteFeeShape, L as SystemWebhookPayload, W as WebhookHeaders, N as WebhookPayload, O as computeFees, Q as isEventClass, R as isInheritedName, U as subtypesForClass, X as validateIntegratorConfig } from './integrator-DDeHg7vj.mjs';
5
5
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.mjs';
6
6
 
7
7
  type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { v as verifyActivityAttestation, r as refreshEnvelopeJwks } from './identity-DfxCvxuH.js';
2
2
  export { A as ActivityAttestation, a as ActivityAttestationBundle, b as ActivityVerifyCheck, c as ActivityVerifyResult, V as VerifyActivityOptions, i as identity } from './identity-DfxCvxuH.js';
3
- import { B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, S as SignInOptions, a as Session, P as PaymentAuthorizeOptions, b as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-BM0Vy-ac.js';
4
- export { c as ALL_EVENT_SUBTYPES, d as ARCHETYPE_TEMPLATES, e as AgentClassOverride, h as AttestTier, C as ClassASubtype, i as ClassBSubtype, j as ClassCSubtype, k as ComputedFees, D as DropCadence, l as DropClosedWebhookPayload, m as DropResponseBlock, n as DropScheduleSummary, o as EVENT_SUBTYPES, p as EventClass, q as EventSubtype, r as EventSubtypeMetadata, s as FederationMigratingWebhookPayload, t as FederationMigrationCancelledWebhookPayload, u as FederationStatus, v as FederationSuccessor, w as IntegratorArchetype, x as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, y as MIN_INTEGRATOR_PRICE_SATS, z as PLATFORM_FEE_POLICY, G as SessionPolicy, H as SigningMethod, J as SiteFeeShape, K as SystemWebhookPayload, W as WebhookHeaders, L as WebhookPayload, N as computeFees, O as subtypesForClass, Q as validateIntegratorConfig } from './integrator-BM0Vy-ac.js';
3
+ import { B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, S as SignInOptions, a as Session, P as PaymentAuthorizeOptions, b as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation } from './integrator-DDeHg7vj.js';
4
+ export { c as ALL_EVENT_SUBTYPES, d as ARCHETYPE_TEMPLATES, e as AgentClassOverride, h as AttestTier, C as CUSTOM_EVENT_KEY_RE, i as ClassASubtype, j as ClassBSubtype, k as ClassCSubtype, l as ComputedFees, D as DropCadence, m as DropClosedWebhookPayload, n as DropResponseBlock, o as DropScheduleSummary, p as EVENT_SUBTYPES, q as EventClass, r as EventSubtype, s as EventSubtypeMetadata, t as FederationMigratingWebhookPayload, u as FederationMigrationCancelledWebhookPayload, v as FederationStatus, w as FederationSuccessor, x as IntegratorArchetype, y as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, z as MIN_INTEGRATOR_PRICE_SATS, G as PLATFORM_FEE_POLICY, H as SessionPolicy, J as SigningMethod, K as SiteFeeShape, L as SystemWebhookPayload, W as WebhookHeaders, N as WebhookPayload, O as computeFees, Q as isEventClass, R as isInheritedName, U as subtypesForClass, X as validateIntegratorConfig } from './integrator-DDeHg7vj.js';
5
5
  export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.js';
6
6
 
7
7
  type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count';
package/dist/index.js CHANGED
@@ -169,6 +169,129 @@ async function authorize(opts) {
169
169
  }
170
170
  var payment = { authorize };
171
171
 
172
+ // src/subtypes.ts
173
+ var EVENT_SUBTYPES = {
174
+ // ── Class A · durable state transitions ──
175
+ account_creation: {
176
+ id: "account_creation",
177
+ class: "A",
178
+ label: "account creation",
179
+ fires_when: "a new oc identity creates a durable account record on your surface (first sign-in, profile row inserted)",
180
+ example: "user signed up via email-OTP and your account row was inserted in your DB",
181
+ common_use_cases: ["onboarding", "signup", "registration", "first-login"],
182
+ typical_price_hint: "~1300 sats (~$1.24)"
183
+ },
184
+ account_recovery: {
185
+ id: "account_recovery",
186
+ class: "A",
187
+ label: "account recovery",
188
+ fires_when: "a user re-binds an existing account to a new device or recovery method",
189
+ example: "user lost their device and recovered the account via email OTP + recovery code",
190
+ common_use_cases: ["recovery", "device-rebind", "restore-access"],
191
+ typical_price_hint: "~650 sats (~$0.62)"
192
+ },
193
+ attest_bond_increased: {
194
+ id: "attest_bond_increased",
195
+ class: "A",
196
+ label: "attest bond increased",
197
+ fires_when: "a user upgrades their bond size (locks more sats to attest_tier=bonded with higher cap)",
198
+ example: "user moved from 10k-sat bond to 100k-sat bond to clear your higher-trust gate",
199
+ common_use_cases: ["bond-upgrade", "tier-promotion", "sybil-resistance"],
200
+ typical_price_hint: "~1600 sats (~$1.52) \xB7 OFF by default"
201
+ },
202
+ payment_method_connected: {
203
+ id: "payment_method_connected",
204
+ class: "A",
205
+ label: "payment method connected",
206
+ fires_when: "a user connects a Lightning address, BIP-322 wallet, or payment-routing channel to their account",
207
+ example: "user pasted a lightning@address.com receive address into their profile",
208
+ common_use_cases: ["payment-setup", "wallet-connect", "payout-config"],
209
+ typical_price_hint: "~320 sats (~$0.30)"
210
+ },
211
+ agent_delegation_issued: {
212
+ id: "agent_delegation_issued",
213
+ class: "A",
214
+ label: "agent delegation issued",
215
+ fires_when: "a user signs an oc-agent delegation envelope authorizing an AI agent to act on their behalf",
216
+ example: 'user delegated a "summarize my emails" agent for 24 hours with scope email:read',
217
+ common_use_cases: ["agent-grant", "ai-delegation", "scoped-authorization"],
218
+ typical_price_hint: "~320 sats \xB7 OFF by default (power-user)"
219
+ },
220
+ recovery_method_updated: {
221
+ id: "recovery_method_updated",
222
+ class: "A",
223
+ label: "recovery method updated",
224
+ fires_when: "a user changes their recovery email, recovery key, or social-recovery contacts",
225
+ example: "user rotated their recovery email after a phone change",
226
+ common_use_cases: ["recovery-rotation", "security-update"],
227
+ typical_price_hint: "~160 sats (~$0.15)"
228
+ },
229
+ // ── Class B · action-bound ──
230
+ payment_authorization: {
231
+ id: "payment_authorization",
232
+ class: "B",
233
+ label: "payment authorized",
234
+ fires_when: "a user authorizes a payment of underlying value (Lightning, on-chain BTC, or fiat-quoted)",
235
+ example: "user paid $5.00 (\u22485260 sats) for a premium feature on your site",
236
+ common_use_cases: ["payment", "checkout", "paywall", "subscription"],
237
+ typical_price_hint: "0.75% of payment amount (percent_of_amount)"
238
+ },
239
+ scoped_action_authorization: {
240
+ id: "scoped_action_authorization",
241
+ class: "B",
242
+ label: "scoped action authorized",
243
+ fires_when: "a user takes a specific action your site bills on (post, vote, comment, claim) where each instance is meaningful",
244
+ example: "user posted a long-form review that earns them sats from your editorial budget",
245
+ common_use_cases: ["post", "vote", "comment", "claim", "submit"],
246
+ typical_price_hint: "~100 sats (~$0.10)"
247
+ },
248
+ attest_verification_at_gate: {
249
+ id: "attest_verification_at_gate",
250
+ class: "B",
251
+ label: "attest verification",
252
+ fires_when: "your site's gate consulted the user's attest_tier and admitted them (counted only when admitted)",
253
+ example: "admin gate checked attest_tier=bonded with bond\u226510k sats and granted access",
254
+ common_use_cases: ["gate-check", "tier-gate", "sybil-filter"],
255
+ typical_price_hint: "~280 sats (~$0.27) \xB7 OFF by default"
256
+ },
257
+ stamp_signing: {
258
+ id: "stamp_signing",
259
+ class: "B",
260
+ label: "stamp signed",
261
+ fires_when: "a user signs an oc-stamp envelope (provenance attestation, review credential, content stamp)",
262
+ example: "user stamped their published recipe with their oc identity for downstream verification",
263
+ common_use_cases: ["provenance", "review", "credential", "attestation"],
264
+ typical_price_hint: "~55 sats (~$0.05) \xB7 OFF by default"
265
+ },
266
+ pledge_resolution: {
267
+ id: "pledge_resolution",
268
+ class: "B",
269
+ label: "pledge resolved",
270
+ fires_when: "an oc-pledge bonded commitment resolves on your surface (kept / broken / disputed / expired_unresolved). pledge bonds never move \u2014 any sat payout is an integrator-composed flow on top of pledge (e.g., HTLC), not a pledge primitive (oc-pledge-protocol WHY.md H7)",
271
+ example: "user staked sats \xD7 days-unspent on a prediction; the pledge resolved kept and the integrator paid out per its own composed terms",
272
+ common_use_cases: ["pledge", "staking", "resolution", "commit-reveal"],
273
+ typical_price_hint: "1% of pledge bond amount (percent_of_amount) \xB7 OFF by default"
274
+ },
275
+ // ── Class C · session ──
276
+ session_creation: {
277
+ id: "session_creation",
278
+ class: "C",
279
+ label: "session opened",
280
+ fires_when: "a fresh authenticated session is opened for a returning user (sign-in within an existing session is FREE)",
281
+ example: "user signed in after their last session expired; new session token issued",
282
+ common_use_cases: ["sign-in", "session", "authenticate"],
283
+ typical_price_hint: "~55 sats (~$0.05)"
284
+ }
285
+ };
286
+ function subtypesForClass(cls) {
287
+ return Object.values(EVENT_SUBTYPES).filter((m) => m.class === cls);
288
+ }
289
+ var ALL_EVENT_SUBTYPES = [
290
+ ...subtypesForClass("A"),
291
+ ...subtypesForClass("B"),
292
+ ...subtypesForClass("C")
293
+ ];
294
+
172
295
  // src/types.ts
173
296
  var PLATFORM_FEE_POLICY = {
174
297
  /** Fraction of every gross_fee that OC retains. */
@@ -182,6 +305,17 @@ var PLATFORM_FEE_POLICY = {
182
305
  var MIN_INTEGRATOR_PRICE_SATS = 1;
183
306
  var MAX_INTEGRATOR_PRICE_SATS = 1e7;
184
307
  var MAX_DROP_WINDOW_DAYS = 92;
308
+ var EVENT_CLASSES = /* @__PURE__ */ new Set(["A", "B", "C"]);
309
+ function isEventClass(value) {
310
+ return EVENT_CLASSES.has(value);
311
+ }
312
+ var CUSTOM_EVENT_KEY_RE = /^[a-z0-9](?:[a-z0-9_.:-]{0,62}[a-z0-9])?$/i;
313
+ var INHERITED_NAMES = new Set(
314
+ [...Object.getOwnPropertyNames(Object.prototype), "__proto__"].map((n) => n.toLowerCase())
315
+ );
316
+ function isInheritedName(key) {
317
+ return INHERITED_NAMES.has(key.toLowerCase());
318
+ }
185
319
  function computeFees(cfg, payment_amount_sats, opts) {
186
320
  const is_agent = opts?.is_agent === true;
187
321
  if (is_agent && cfg.agent?.refuse) {
@@ -211,15 +345,67 @@ function computeFees(cfg, payment_amount_sats, opts) {
211
345
  const site_rebate_sats = gross - platform_fee_sats - user_earned_sats;
212
346
  return { gross_fee_sats: gross, platform_fee_sats, user_earned_sats, site_rebate_sats };
213
347
  }
348
+ var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
349
+ function siteFeeShapeProblem(v) {
350
+ if (!isRecord(v)) return "must be an object";
351
+ if (v.kind === "fixed_sats") return Number.isFinite(v.sats) ? null : "sats must be a number";
352
+ if (v.kind === "percent_of_amount") {
353
+ return Number.isFinite(v.pct) ? null : "pct must be a number";
354
+ }
355
+ return `kind must be fixed_sats or percent_of_amount (got ${JSON.stringify(v.kind)})`;
356
+ }
357
+ function eventShapeProblem(e) {
358
+ const fee = siteFeeShapeProblem(e.site_pays);
359
+ if (fee) return `site_pays ${fee}`;
360
+ if (!Number.isFinite(e.user_share_pct)) return "user_share_pct must be a number";
361
+ if (e.agent == null) return null;
362
+ if (!isRecord(e.agent)) return "agent must be an object";
363
+ if (e.agent.site_pays != null) {
364
+ const agentFee = siteFeeShapeProblem(e.agent.site_pays);
365
+ if (agentFee) return `agent.site_pays ${agentFee}`;
366
+ }
367
+ if (e.agent.user_share_pct != null && !Number.isFinite(e.agent.user_share_pct)) {
368
+ return "agent.user_share_pct must be a number";
369
+ }
370
+ return null;
371
+ }
214
372
  function validateIntegratorConfig(cfg) {
215
373
  const errors = [];
216
374
  if (!cfg.project_key) errors.push({ message: "project_key is required" });
217
375
  if (!cfg.display_name) errors.push({ message: "display_name is required" });
218
376
  if (!cfg.domain) errors.push({ message: "domain is required" });
219
- for (const [key, eventCfg] of Object.entries(cfg.events)) {
377
+ if (!isRecord(cfg.events)) errors.push({ message: "events must be an object" });
378
+ for (const [key, eventCfg] of Object.entries(isRecord(cfg.events) ? cfg.events : {})) {
220
379
  if (!eventCfg) continue;
221
380
  const subtype = key;
381
+ if (!isRecord(eventCfg)) {
382
+ errors.push({ subtype, message: "must be an object" });
383
+ continue;
384
+ }
385
+ const builtin = Object.prototype.hasOwnProperty.call(EVENT_SUBTYPES, key);
386
+ if (!builtin && !CUSTOM_EVENT_KEY_RE.test(key)) {
387
+ errors.push({
388
+ subtype,
389
+ message: `custom event key "${key}" must match ${CUSTOM_EVENT_KEY_RE} (1\u201364 chars, letters/digits/_.:- )`
390
+ });
391
+ } else if (!builtin && isInheritedName(key)) {
392
+ errors.push({
393
+ subtype,
394
+ message: `custom event key "${key}" is a name every object already has; pick another`
395
+ });
396
+ }
397
+ if (eventCfg.class != null && !isEventClass(eventCfg.class)) {
398
+ errors.push({
399
+ subtype,
400
+ message: `class must be A, B or C (got ${JSON.stringify(eventCfg.class)})`
401
+ });
402
+ }
222
403
  if (!eventCfg.enabled) continue;
404
+ const shape = eventShapeProblem(eventCfg);
405
+ if (shape) {
406
+ errors.push({ subtype, message: shape });
407
+ continue;
408
+ }
223
409
  if (eventCfg.site_pays.kind === "fixed_sats") {
224
410
  if (eventCfg.site_pays.sats < MIN_INTEGRATOR_PRICE_SATS) {
225
411
  errors.push({
@@ -1512,129 +1698,6 @@ var identity = {
1512
1698
  refreshEnvelopeJwks
1513
1699
  };
1514
1700
 
1515
- // src/subtypes.ts
1516
- var EVENT_SUBTYPES = {
1517
- // ── Class A · durable state transitions ──
1518
- account_creation: {
1519
- id: "account_creation",
1520
- class: "A",
1521
- label: "account creation",
1522
- fires_when: "a new oc identity creates a durable account record on your surface (first sign-in, profile row inserted)",
1523
- example: "user signed up via email-OTP and your account row was inserted in your DB",
1524
- common_use_cases: ["onboarding", "signup", "registration", "first-login"],
1525
- typical_price_hint: "~1300 sats (~$1.24)"
1526
- },
1527
- account_recovery: {
1528
- id: "account_recovery",
1529
- class: "A",
1530
- label: "account recovery",
1531
- fires_when: "a user re-binds an existing account to a new device or recovery method",
1532
- example: "user lost their device and recovered the account via email OTP + recovery code",
1533
- common_use_cases: ["recovery", "device-rebind", "restore-access"],
1534
- typical_price_hint: "~650 sats (~$0.62)"
1535
- },
1536
- attest_bond_increased: {
1537
- id: "attest_bond_increased",
1538
- class: "A",
1539
- label: "attest bond increased",
1540
- fires_when: "a user upgrades their bond size (locks more sats to attest_tier=bonded with higher cap)",
1541
- example: "user moved from 10k-sat bond to 100k-sat bond to clear your higher-trust gate",
1542
- common_use_cases: ["bond-upgrade", "tier-promotion", "sybil-resistance"],
1543
- typical_price_hint: "~1600 sats (~$1.52) \xB7 OFF by default"
1544
- },
1545
- payment_method_connected: {
1546
- id: "payment_method_connected",
1547
- class: "A",
1548
- label: "payment method connected",
1549
- fires_when: "a user connects a Lightning address, BIP-322 wallet, or payment-routing channel to their account",
1550
- example: "user pasted a lightning@address.com receive address into their profile",
1551
- common_use_cases: ["payment-setup", "wallet-connect", "payout-config"],
1552
- typical_price_hint: "~320 sats (~$0.30)"
1553
- },
1554
- agent_delegation_issued: {
1555
- id: "agent_delegation_issued",
1556
- class: "A",
1557
- label: "agent delegation issued",
1558
- fires_when: "a user signs an oc-agent delegation envelope authorizing an AI agent to act on their behalf",
1559
- example: 'user delegated a "summarize my emails" agent for 24 hours with scope email:read',
1560
- common_use_cases: ["agent-grant", "ai-delegation", "scoped-authorization"],
1561
- typical_price_hint: "~320 sats \xB7 OFF by default (power-user)"
1562
- },
1563
- recovery_method_updated: {
1564
- id: "recovery_method_updated",
1565
- class: "A",
1566
- label: "recovery method updated",
1567
- fires_when: "a user changes their recovery email, recovery key, or social-recovery contacts",
1568
- example: "user rotated their recovery email after a phone change",
1569
- common_use_cases: ["recovery-rotation", "security-update"],
1570
- typical_price_hint: "~160 sats (~$0.15)"
1571
- },
1572
- // ── Class B · action-bound ──
1573
- payment_authorization: {
1574
- id: "payment_authorization",
1575
- class: "B",
1576
- label: "payment authorized",
1577
- fires_when: "a user authorizes a payment of underlying value (Lightning, on-chain BTC, or fiat-quoted)",
1578
- example: "user paid $5.00 (\u22485260 sats) for a premium feature on your site",
1579
- common_use_cases: ["payment", "checkout", "paywall", "subscription"],
1580
- typical_price_hint: "0.75% of payment amount (percent_of_amount)"
1581
- },
1582
- scoped_action_authorization: {
1583
- id: "scoped_action_authorization",
1584
- class: "B",
1585
- label: "scoped action authorized",
1586
- fires_when: "a user takes a specific action your site bills on (post, vote, comment, claim) where each instance is meaningful",
1587
- example: "user posted a long-form review that earns them sats from your editorial budget",
1588
- common_use_cases: ["post", "vote", "comment", "claim", "submit"],
1589
- typical_price_hint: "~100 sats (~$0.10)"
1590
- },
1591
- attest_verification_at_gate: {
1592
- id: "attest_verification_at_gate",
1593
- class: "B",
1594
- label: "attest verification",
1595
- fires_when: "your site's gate consulted the user's attest_tier and admitted them (counted only when admitted)",
1596
- example: "admin gate checked attest_tier=bonded with bond\u226510k sats and granted access",
1597
- common_use_cases: ["gate-check", "tier-gate", "sybil-filter"],
1598
- typical_price_hint: "~280 sats (~$0.27) \xB7 OFF by default"
1599
- },
1600
- stamp_signing: {
1601
- id: "stamp_signing",
1602
- class: "B",
1603
- label: "stamp signed",
1604
- fires_when: "a user signs an oc-stamp envelope (provenance attestation, review credential, content stamp)",
1605
- example: "user stamped their published recipe with their oc identity for downstream verification",
1606
- common_use_cases: ["provenance", "review", "credential", "attestation"],
1607
- typical_price_hint: "~55 sats (~$0.05) \xB7 OFF by default"
1608
- },
1609
- pledge_resolution: {
1610
- id: "pledge_resolution",
1611
- class: "B",
1612
- label: "pledge resolved",
1613
- fires_when: "an oc-pledge bonded commitment resolves on your surface (kept / broken / disputed / expired_unresolved). pledge bonds never move \u2014 any sat payout is an integrator-composed flow on top of pledge (e.g., HTLC), not a pledge primitive (oc-pledge-protocol WHY.md H7)",
1614
- example: "user staked sats \xD7 days-unspent on a prediction; the pledge resolved kept and the integrator paid out per its own composed terms",
1615
- common_use_cases: ["pledge", "staking", "resolution", "commit-reveal"],
1616
- typical_price_hint: "1% of pledge bond amount (percent_of_amount) \xB7 OFF by default"
1617
- },
1618
- // ── Class C · session ──
1619
- session_creation: {
1620
- id: "session_creation",
1621
- class: "C",
1622
- label: "session opened",
1623
- fires_when: "a fresh authenticated session is opened for a returning user (sign-in within an existing session is FREE)",
1624
- example: "user signed in after their last session expired; new session token issued",
1625
- common_use_cases: ["sign-in", "session", "authenticate"],
1626
- typical_price_hint: "~55 sats (~$0.05)"
1627
- }
1628
- };
1629
- function subtypesForClass(cls) {
1630
- return Object.values(EVENT_SUBTYPES).filter((m) => m.class === cls);
1631
- }
1632
- var ALL_EVENT_SUBTYPES = [
1633
- ...subtypesForClass("A"),
1634
- ...subtypesForClass("B"),
1635
- ...subtypesForClass("C")
1636
- ];
1637
-
1638
1701
  // src/index.ts
1639
1702
  var oc = {
1640
1703
  session,
@@ -1652,6 +1715,7 @@ exports.ALL_EVENT_SUBTYPES = ALL_EVENT_SUBTYPES;
1652
1715
  exports.ARCHETYPE_TEMPLATES = ARCHETYPE_TEMPLATES;
1653
1716
  exports.CONNECT_CONSENT_BLURB = CONNECT_CONSENT_BLURB;
1654
1717
  exports.CONNECT_CONSENT_LABEL = CONNECT_CONSENT_LABEL;
1718
+ exports.CUSTOM_EVENT_KEY_RE = CUSTOM_EVENT_KEY_RE;
1655
1719
  exports.EVENT_SUBTYPES = EVENT_SUBTYPES;
1656
1720
  exports.MAX_DROP_WINDOW_DAYS = MAX_DROP_WINDOW_DAYS;
1657
1721
  exports.MIN_INTEGRATOR_PRICE_SATS = MIN_INTEGRATOR_PRICE_SATS;
@@ -1668,6 +1732,8 @@ exports.getArchetypeTemplate = getArchetypeTemplate;
1668
1732
  exports.getBearerToken = getBearerToken;
1669
1733
  exports.getOrigin = getOrigin;
1670
1734
  exports.identity = identity;
1735
+ exports.isEventClass = isEventClass;
1736
+ exports.isInheritedName = isInheritedName;
1671
1737
  exports.oc = oc;
1672
1738
  exports.onTelemetry = onTelemetry;
1673
1739
  exports.parseTrustAttestationCount = parseTrustAttestationCount;