@orangecheck/me-client 0.15.0 → 0.17.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/dist/index.d.mts CHANGED
@@ -1,7 +1,14 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
 
4
- type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count';
4
+ type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count';
5
+ interface TrustAttestationCount {
6
+ total: number;
7
+ good: number;
8
+ distinct_good_issuers: number;
9
+ caution: number;
10
+ }
11
+ declare function parseTrustAttestationCount(value: string): TrustAttestationCount | null;
5
12
  interface GrantedOptions {
6
13
  project_key: string;
7
14
  signal?: AbortSignal;
@@ -21,6 +28,7 @@ declare function request(scopes: Scope[], options: RequestOptions): never;
21
28
  declare const scope: {
22
29
  granted: typeof granted;
23
30
  request: typeof request;
31
+ parseTrustAttestationCount: typeof parseTrustAttestationCount;
24
32
  };
25
33
 
26
34
  type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock';
@@ -74,11 +82,11 @@ declare const PLATFORM_FEE_POLICY: {
74
82
  };
75
83
  declare const MIN_INTEGRATOR_PRICE_SATS = 5;
76
84
  type EventClass = 'A' | 'B' | 'C';
77
- type ClassASubtype = 'account_creation' | 'account_recovery' | 'kyc_tier_upgrade' | 'payment_method_connected' | 'agent_delegation_issued' | 'recovery_method_updated';
85
+ type ClassASubtype = 'account_creation' | 'account_recovery' | 'attest_bond_increased' | 'payment_method_connected' | 'agent_delegation_issued' | 'recovery_method_updated';
78
86
  type ClassBSubtype = 'payment_authorization' | 'scoped_action_authorization' | 'attest_verification_at_gate' | 'stamp_signing' | 'pledge_resolution';
79
87
  type ClassCSubtype = 'session_creation';
80
88
  type EventSubtype = ClassASubtype | ClassBSubtype | ClassCSubtype;
81
- type AttestTier = 'anonymous' | 'bonded' | 'kyc_light' | 'kyc_strong';
89
+ type AttestTier = 'anonymous' | 'bonded';
82
90
  type SiteFeeShape = {
83
91
  kind: 'fixed_sats';
84
92
  sats: number;
@@ -127,6 +135,20 @@ interface BillableEvent {
127
135
  user_earned_sats: number;
128
136
  site_rebate_sats: number;
129
137
  verify_url: string;
138
+ is_agent?: boolean;
139
+ }
140
+ interface WebhookPayload extends BillableEvent {
141
+ kind: 'oc-billable-event';
142
+ sub: string;
143
+ scopes?: Partial<Record<'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count' | 'trust_attestations_bundle', string>>;
144
+ }
145
+ interface WebhookHeaders {
146
+ 'OC-Signature': string;
147
+ 'OC-Key-Id': string;
148
+ 'OC-Envelope-Id': string;
149
+ 'OC-Subtype': EventSubtype;
150
+ 'OC-Class': EventClass;
151
+ 'OC-Delivery-Attempt': string;
130
152
  }
131
153
  interface SessionPolicy {
132
154
  duration_seconds: number;
@@ -185,6 +207,23 @@ interface Federation {
185
207
  }
186
208
  type SigningMethod = 'fedimint_threshold' | 'fedimint_client' | 'bip322';
187
209
 
210
+ type IntegratorArchetype = 'saas-paywall' | 'marketplace' | 'content-platform' | 'gaming' | 'agent-only';
211
+ interface ProjectIdentity {
212
+ project_key: string;
213
+ domain: string;
214
+ display_name: string;
215
+ }
216
+ interface ArchetypeTemplate {
217
+ id: IntegratorArchetype;
218
+ label: string;
219
+ summary: string;
220
+ examples: readonly string[];
221
+ events: Partial<Record<EventSubtype, IntegratorEventConfig>>;
222
+ }
223
+ declare const ARCHETYPE_TEMPLATES: readonly ArchetypeTemplate[];
224
+ declare function fromTemplate(useCase: IntegratorArchetype, identity: ProjectIdentity): IntegratorPriceConfig;
225
+ declare function getArchetypeTemplate(id: IntegratorArchetype): ArchetypeTemplate;
226
+
188
227
  interface FireEventOptions {
189
228
  project_key: string;
190
229
  subtype: EventSubtype;
@@ -277,6 +316,9 @@ declare const payment: {
277
316
  declare function validate(cfg: IntegratorPriceConfig): ValidationResult;
278
317
  declare const config: {
279
318
  validate: typeof validate;
319
+ fromTemplate: typeof fromTemplate;
320
+ getArchetype: typeof getArchetypeTemplate;
321
+ archetypes: readonly ArchetypeTemplate[];
280
322
  };
281
323
 
282
324
  declare function list(): Promise<Federation[]>;
@@ -312,6 +354,19 @@ interface WithRateLimitRetryOptions {
312
354
  }
313
355
  declare function withRateLimitRetry<T>(fn: () => Promise<T>, opts?: WithRateLimitRetryOptions): Promise<T>;
314
356
 
357
+ interface EventSubtypeMetadata {
358
+ id: EventSubtype;
359
+ class: EventClass;
360
+ label: string;
361
+ fires_when: string;
362
+ example: string;
363
+ common_use_cases: readonly string[];
364
+ typical_price_hint: string;
365
+ }
366
+ declare const EVENT_SUBTYPES: Record<EventSubtype, EventSubtypeMetadata>;
367
+ declare function subtypesForClass(cls: EventClass): EventSubtypeMetadata[];
368
+ declare const ALL_EVENT_SUBTYPES: readonly EventSubtypeMetadata[];
369
+
315
370
  declare const oc: {
316
371
  session: {
317
372
  create: (opts: SignInOptions) => Promise<Session>;
@@ -328,6 +383,9 @@ declare const oc: {
328
383
  };
329
384
  config: {
330
385
  validate: (cfg: IntegratorPriceConfig) => ValidationResult;
386
+ fromTemplate: typeof fromTemplate;
387
+ getArchetype: typeof getArchetypeTemplate;
388
+ archetypes: readonly ArchetypeTemplate[];
331
389
  };
332
390
  webhook: {
333
391
  verify: typeof verify$1;
@@ -342,10 +400,11 @@ declare const oc: {
342
400
  scope: {
343
401
  granted: (options: GrantedOptions) => Promise<GrantedResult>;
344
402
  request: typeof request;
403
+ parseTrustAttestationCount: typeof parseTrustAttestationCount;
345
404
  };
346
405
  family: {
347
406
  scopes: (verb: FamilyVerb, options?: FamilyScopesOptions) => Promise<FamilyScopesResult>;
348
407
  };
349
408
  };
350
409
 
351
- export { type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, type EventClass, type EventSubtype, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, type Federation, type FederationStatus, type FireEventOptions, type GrantedOptions, type GrantedResult, type IntegratorEventConfig, type IntegratorPriceConfig, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type RequestOptions, type Scope, type Session, type SessionPolicy, type SignInOptions, type SigningMethod, type SiteFeeShape, type TelemetryEvent, type ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, computeFees, config, event, family, federations, getBearerToken, getOrigin, oc, onTelemetry, payment, scope, session, setBearerToken, setOrigin, validateIntegratorConfig, webhook, withRateLimitRetry };
410
+ export { ALL_EVENT_SUBTYPES, ARCHETYPE_TEMPLATES, type ArchetypeTemplate, type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, EVENT_SUBTYPES, type EventClass, type EventSubtype, type EventSubtypeMetadata, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, type Federation, type FederationStatus, type FireEventOptions, type GrantedOptions, type GrantedResult, type IntegratorArchetype, type IntegratorEventConfig, type IntegratorPriceConfig, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type RequestOptions, type Scope, type Session, type SessionPolicy, type SignInOptions, type SigningMethod, type SiteFeeShape, type TelemetryEvent, type TrustAttestationCount, type ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WebhookHeaders, type WebhookPayload, type WithRateLimitRetryOptions, clearBearerToken, computeFees, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payment, scope, session, setBearerToken, setOrigin, subtypesForClass, validateIntegratorConfig, webhook, withRateLimitRetry };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,14 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
 
4
- type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count';
4
+ type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count';
5
+ interface TrustAttestationCount {
6
+ total: number;
7
+ good: number;
8
+ distinct_good_issuers: number;
9
+ caution: number;
10
+ }
11
+ declare function parseTrustAttestationCount(value: string): TrustAttestationCount | null;
5
12
  interface GrantedOptions {
6
13
  project_key: string;
7
14
  signal?: AbortSignal;
@@ -21,6 +28,7 @@ declare function request(scopes: Scope[], options: RequestOptions): never;
21
28
  declare const scope: {
22
29
  granted: typeof granted;
23
30
  request: typeof request;
31
+ parseTrustAttestationCount: typeof parseTrustAttestationCount;
24
32
  };
25
33
 
26
34
  type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock';
@@ -74,11 +82,11 @@ declare const PLATFORM_FEE_POLICY: {
74
82
  };
75
83
  declare const MIN_INTEGRATOR_PRICE_SATS = 5;
76
84
  type EventClass = 'A' | 'B' | 'C';
77
- type ClassASubtype = 'account_creation' | 'account_recovery' | 'kyc_tier_upgrade' | 'payment_method_connected' | 'agent_delegation_issued' | 'recovery_method_updated';
85
+ type ClassASubtype = 'account_creation' | 'account_recovery' | 'attest_bond_increased' | 'payment_method_connected' | 'agent_delegation_issued' | 'recovery_method_updated';
78
86
  type ClassBSubtype = 'payment_authorization' | 'scoped_action_authorization' | 'attest_verification_at_gate' | 'stamp_signing' | 'pledge_resolution';
79
87
  type ClassCSubtype = 'session_creation';
80
88
  type EventSubtype = ClassASubtype | ClassBSubtype | ClassCSubtype;
81
- type AttestTier = 'anonymous' | 'bonded' | 'kyc_light' | 'kyc_strong';
89
+ type AttestTier = 'anonymous' | 'bonded';
82
90
  type SiteFeeShape = {
83
91
  kind: 'fixed_sats';
84
92
  sats: number;
@@ -127,6 +135,20 @@ interface BillableEvent {
127
135
  user_earned_sats: number;
128
136
  site_rebate_sats: number;
129
137
  verify_url: string;
138
+ is_agent?: boolean;
139
+ }
140
+ interface WebhookPayload extends BillableEvent {
141
+ kind: 'oc-billable-event';
142
+ sub: string;
143
+ scopes?: Partial<Record<'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count' | 'trust_attestations_bundle', string>>;
144
+ }
145
+ interface WebhookHeaders {
146
+ 'OC-Signature': string;
147
+ 'OC-Key-Id': string;
148
+ 'OC-Envelope-Id': string;
149
+ 'OC-Subtype': EventSubtype;
150
+ 'OC-Class': EventClass;
151
+ 'OC-Delivery-Attempt': string;
130
152
  }
131
153
  interface SessionPolicy {
132
154
  duration_seconds: number;
@@ -185,6 +207,23 @@ interface Federation {
185
207
  }
186
208
  type SigningMethod = 'fedimint_threshold' | 'fedimint_client' | 'bip322';
187
209
 
210
+ type IntegratorArchetype = 'saas-paywall' | 'marketplace' | 'content-platform' | 'gaming' | 'agent-only';
211
+ interface ProjectIdentity {
212
+ project_key: string;
213
+ domain: string;
214
+ display_name: string;
215
+ }
216
+ interface ArchetypeTemplate {
217
+ id: IntegratorArchetype;
218
+ label: string;
219
+ summary: string;
220
+ examples: readonly string[];
221
+ events: Partial<Record<EventSubtype, IntegratorEventConfig>>;
222
+ }
223
+ declare const ARCHETYPE_TEMPLATES: readonly ArchetypeTemplate[];
224
+ declare function fromTemplate(useCase: IntegratorArchetype, identity: ProjectIdentity): IntegratorPriceConfig;
225
+ declare function getArchetypeTemplate(id: IntegratorArchetype): ArchetypeTemplate;
226
+
188
227
  interface FireEventOptions {
189
228
  project_key: string;
190
229
  subtype: EventSubtype;
@@ -277,6 +316,9 @@ declare const payment: {
277
316
  declare function validate(cfg: IntegratorPriceConfig): ValidationResult;
278
317
  declare const config: {
279
318
  validate: typeof validate;
319
+ fromTemplate: typeof fromTemplate;
320
+ getArchetype: typeof getArchetypeTemplate;
321
+ archetypes: readonly ArchetypeTemplate[];
280
322
  };
281
323
 
282
324
  declare function list(): Promise<Federation[]>;
@@ -312,6 +354,19 @@ interface WithRateLimitRetryOptions {
312
354
  }
313
355
  declare function withRateLimitRetry<T>(fn: () => Promise<T>, opts?: WithRateLimitRetryOptions): Promise<T>;
314
356
 
357
+ interface EventSubtypeMetadata {
358
+ id: EventSubtype;
359
+ class: EventClass;
360
+ label: string;
361
+ fires_when: string;
362
+ example: string;
363
+ common_use_cases: readonly string[];
364
+ typical_price_hint: string;
365
+ }
366
+ declare const EVENT_SUBTYPES: Record<EventSubtype, EventSubtypeMetadata>;
367
+ declare function subtypesForClass(cls: EventClass): EventSubtypeMetadata[];
368
+ declare const ALL_EVENT_SUBTYPES: readonly EventSubtypeMetadata[];
369
+
315
370
  declare const oc: {
316
371
  session: {
317
372
  create: (opts: SignInOptions) => Promise<Session>;
@@ -328,6 +383,9 @@ declare const oc: {
328
383
  };
329
384
  config: {
330
385
  validate: (cfg: IntegratorPriceConfig) => ValidationResult;
386
+ fromTemplate: typeof fromTemplate;
387
+ getArchetype: typeof getArchetypeTemplate;
388
+ archetypes: readonly ArchetypeTemplate[];
331
389
  };
332
390
  webhook: {
333
391
  verify: typeof verify$1;
@@ -342,10 +400,11 @@ declare const oc: {
342
400
  scope: {
343
401
  granted: (options: GrantedOptions) => Promise<GrantedResult>;
344
402
  request: typeof request;
403
+ parseTrustAttestationCount: typeof parseTrustAttestationCount;
345
404
  };
346
405
  family: {
347
406
  scopes: (verb: FamilyVerb, options?: FamilyScopesOptions) => Promise<FamilyScopesResult>;
348
407
  };
349
408
  };
350
409
 
351
- export { type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, type EventClass, type EventSubtype, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, type Federation, type FederationStatus, type FireEventOptions, type GrantedOptions, type GrantedResult, type IntegratorEventConfig, type IntegratorPriceConfig, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type RequestOptions, type Scope, type Session, type SessionPolicy, type SignInOptions, type SigningMethod, type SiteFeeShape, type TelemetryEvent, type ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, computeFees, config, event, family, federations, getBearerToken, getOrigin, oc, onTelemetry, payment, scope, session, setBearerToken, setOrigin, validateIntegratorConfig, webhook, withRateLimitRetry };
410
+ export { ALL_EVENT_SUBTYPES, ARCHETYPE_TEMPLATES, type ArchetypeTemplate, type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, EVENT_SUBTYPES, type EventClass, type EventSubtype, type EventSubtypeMetadata, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, type Federation, type FederationStatus, type FireEventOptions, type GrantedOptions, type GrantedResult, type IntegratorArchetype, type IntegratorEventConfig, type IntegratorPriceConfig, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type RequestOptions, type Scope, type Session, type SessionPolicy, type SignInOptions, type SigningMethod, type SiteFeeShape, type TelemetryEvent, type TrustAttestationCount, type ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WebhookHeaders, type WebhookPayload, type WithRateLimitRetryOptions, clearBearerToken, computeFees, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payment, scope, session, setBearerToken, setOrigin, subtypesForClass, validateIntegratorConfig, webhook, withRateLimitRetry };