@orangecheck/me-client 0.53.3 → 0.54.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 +26 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +155 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +153 -124
- package/dist/index.mjs.map +1 -1
- package/dist/{integrator-BM0Vy-ac.d.mts → integrator-DDeHg7vj.d.mts} +7 -1
- package/dist/{integrator-BM0Vy-ac.d.ts → integrator-DDeHg7vj.d.ts} +7 -1
- package/dist/integrator.d.mts +1 -1
- package/dist/integrator.d.ts +1 -1
- package/dist/integrator.js +109 -77
- package/dist/integrator.js.map +1 -1
- package/dist/integrator.mjs +107 -78
- package/dist/integrator.mjs.map +1 -1
- package/package.json +3 -2
- package/test-vectors/integrator-config.json +71 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,32 @@ 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.54.0] — 2026-10-26
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- `validateIntegratorConfig` refuses what me.ochk.io refuses: an event `class`
|
|
16
|
+
other than `A`, `B` or `C`, and a custom event key that is not a slug
|
|
17
|
+
(`CUSTOM_EVENT_KEY_RE`) or that names something every object already has
|
|
18
|
+
(`"constructor"`, `"toString"`, in any case). Both checks run whether the
|
|
19
|
+
event is enabled or not.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- `isEventClass`, `isInheritedName` and `CUSTOM_EVENT_KEY_RE` are exported from
|
|
24
|
+
the package and from `/integrator`.
|
|
25
|
+
- `IntegratorEventConfig` carries the custom-event fields me.ochk.io stores:
|
|
26
|
+
`label`, `description` and `class`.
|
|
27
|
+
- `test-vectors/integrator-config.json` ships in the package. me.ochk.io's
|
|
28
|
+
validator is held to the same cases.
|
|
29
|
+
|
|
30
|
+
## [0.53.4] — 2026-10-26
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Depends on `@orangecheck/auth-core` ^2.26.1, so the session checks it runs
|
|
35
|
+
through auth-core look a `kid` up the same way as 0.53.3's own verifiers.
|
|
36
|
+
|
|
11
37
|
## [0.53.3] — 2026-10-26
|
|
12
38
|
|
|
13
39
|
### Fixed
|
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-
|
|
4
|
-
export { c as ALL_EVENT_SUBTYPES, d as ARCHETYPE_TEMPLATES, e as AgentClassOverride, h as AttestTier, C as
|
|
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-
|
|
4
|
-
export { c as ALL_EVENT_SUBTYPES, d as ARCHETYPE_TEMPLATES, e as AgentClassOverride, h as AttestTier, C as
|
|
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) {
|
|
@@ -219,6 +353,24 @@ function validateIntegratorConfig(cfg) {
|
|
|
219
353
|
for (const [key, eventCfg] of Object.entries(cfg.events)) {
|
|
220
354
|
if (!eventCfg) continue;
|
|
221
355
|
const subtype = key;
|
|
356
|
+
const builtin = Object.prototype.hasOwnProperty.call(EVENT_SUBTYPES, key);
|
|
357
|
+
if (!builtin && !CUSTOM_EVENT_KEY_RE.test(key)) {
|
|
358
|
+
errors.push({
|
|
359
|
+
subtype,
|
|
360
|
+
message: `custom event key "${key}" must match ${CUSTOM_EVENT_KEY_RE} (1\u201364 chars, letters/digits/_.:- )`
|
|
361
|
+
});
|
|
362
|
+
} else if (!builtin && isInheritedName(key)) {
|
|
363
|
+
errors.push({
|
|
364
|
+
subtype,
|
|
365
|
+
message: `custom event key "${key}" is a name every object already has; pick another`
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
if (eventCfg.class != null && !isEventClass(eventCfg.class)) {
|
|
369
|
+
errors.push({
|
|
370
|
+
subtype,
|
|
371
|
+
message: `class must be A, B or C (got ${JSON.stringify(eventCfg.class)})`
|
|
372
|
+
});
|
|
373
|
+
}
|
|
222
374
|
if (!eventCfg.enabled) continue;
|
|
223
375
|
if (eventCfg.site_pays.kind === "fixed_sats") {
|
|
224
376
|
if (eventCfg.site_pays.sats < MIN_INTEGRATOR_PRICE_SATS) {
|
|
@@ -1512,129 +1664,6 @@ var identity = {
|
|
|
1512
1664
|
refreshEnvelopeJwks
|
|
1513
1665
|
};
|
|
1514
1666
|
|
|
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
1667
|
// src/index.ts
|
|
1639
1668
|
var oc = {
|
|
1640
1669
|
session,
|
|
@@ -1652,6 +1681,7 @@ exports.ALL_EVENT_SUBTYPES = ALL_EVENT_SUBTYPES;
|
|
|
1652
1681
|
exports.ARCHETYPE_TEMPLATES = ARCHETYPE_TEMPLATES;
|
|
1653
1682
|
exports.CONNECT_CONSENT_BLURB = CONNECT_CONSENT_BLURB;
|
|
1654
1683
|
exports.CONNECT_CONSENT_LABEL = CONNECT_CONSENT_LABEL;
|
|
1684
|
+
exports.CUSTOM_EVENT_KEY_RE = CUSTOM_EVENT_KEY_RE;
|
|
1655
1685
|
exports.EVENT_SUBTYPES = EVENT_SUBTYPES;
|
|
1656
1686
|
exports.MAX_DROP_WINDOW_DAYS = MAX_DROP_WINDOW_DAYS;
|
|
1657
1687
|
exports.MIN_INTEGRATOR_PRICE_SATS = MIN_INTEGRATOR_PRICE_SATS;
|
|
@@ -1668,6 +1698,8 @@ exports.getArchetypeTemplate = getArchetypeTemplate;
|
|
|
1668
1698
|
exports.getBearerToken = getBearerToken;
|
|
1669
1699
|
exports.getOrigin = getOrigin;
|
|
1670
1700
|
exports.identity = identity;
|
|
1701
|
+
exports.isEventClass = isEventClass;
|
|
1702
|
+
exports.isInheritedName = isInheritedName;
|
|
1671
1703
|
exports.oc = oc;
|
|
1672
1704
|
exports.onTelemetry = onTelemetry;
|
|
1673
1705
|
exports.parseTrustAttestationCount = parseTrustAttestationCount;
|