@orangecheck/me-client 0.5.0 → 0.7.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,6 +1,29 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- export { OcAccount, OcAuthConfig, OcSessionProvider, OcSessionState, OcSessionStatus, useOcSession, useOptionalOcSession } from '@orangecheck/auth-client';
3
+
4
+ interface VerifyResult {
5
+ ok: boolean;
6
+ reason?: string;
7
+ }
8
+ interface OcPublicJwk {
9
+ kty: 'OKP';
10
+ crv: 'Ed25519';
11
+ x: string;
12
+ kid: string;
13
+ alg?: 'EdDSA';
14
+ use?: 'sig';
15
+ }
16
+ interface VerifyOptions {
17
+ issuer?: string;
18
+ jwk?: OcPublicJwk;
19
+ jwksCacheTtlMs?: number;
20
+ }
21
+ declare function verify(rawBody: string | Uint8Array, sigHex: string, kid: string, options?: VerifyOptions): Promise<VerifyResult>;
22
+ declare function fetchJwksForce(issuer?: string): Promise<void>;
23
+ declare const webhook: {
24
+ verify: typeof verify;
25
+ fetchJwks: typeof fetchJwksForce;
26
+ };
4
27
 
5
28
  declare const PLATFORM_FEE_POLICY: {
6
29
  readonly pct: 0.2;
@@ -80,7 +103,6 @@ interface SignInOptions {
80
103
  scope: string[];
81
104
  sessionPolicy?: Partial<SessionPolicy>;
82
105
  returnTo?: string;
83
- project_key?: string;
84
106
  }
85
107
  interface PaymentAuthorizeOptions {
86
108
  identity: string;
@@ -88,7 +110,6 @@ interface PaymentAuthorizeOptions {
88
110
  usd_cents?: number;
89
111
  description: string;
90
112
  external_ref?: string;
91
- project_key?: string;
92
113
  }
93
114
  interface PaymentResult {
94
115
  id: string;
@@ -106,58 +127,16 @@ interface TelemetryEvent {
106
127
  interface FireEventOptions {
107
128
  project_key: string;
108
129
  subtype: EventSubtype;
109
- payment_amount_sats?: number;
110
130
  action_label?: string;
111
- note?: string;
131
+ payment_amount_sats?: number;
132
+ user_address?: string;
133
+ metadata?: Record<string, unknown>;
112
134
  }
113
- declare function fire(opts: FireEventOptions): Promise<BillableEvent>;
135
+ declare function fire(options: FireEventOptions): Promise<BillableEvent>;
114
136
  declare const event: {
115
137
  fire: typeof fire;
116
138
  };
117
139
 
118
- type DelegationScope = 'identity.read' | 'inbox.read' | 'attest.verify' | 'stamp.sign' | 'payment.authorize';
119
- interface IssueDelegationOptions {
120
- agent_id: string;
121
- scope: DelegationScope[];
122
- expires_at: string;
123
- reason?: string;
124
- }
125
- interface DelegationEnvelope {
126
- id: string;
127
- scope: DelegationScope[];
128
- expires_at: string;
129
- issued_at: string;
130
- verify_url: string;
131
- }
132
- declare function issue(opts: IssueDelegationOptions): Promise<DelegationEnvelope>;
133
- declare function revoke(delegation_id: string): Promise<{
134
- ok: true;
135
- }>;
136
- declare const delegation: {
137
- issue: typeof issue;
138
- revoke: typeof revoke;
139
- };
140
-
141
- interface OcPublicJwk {
142
- kty: 'OKP';
143
- crv: 'Ed25519';
144
- x: string;
145
- kid: string;
146
- alg?: string;
147
- use?: string;
148
- }
149
- interface VerifyResult {
150
- ok: boolean;
151
- reason?: string;
152
- key_id?: string;
153
- }
154
- declare function fetchJwks(): Promise<OcPublicJwk[]>;
155
- declare function verify(rawBody: string | Uint8Array, sigHex: string, kid: string, jwk?: OcPublicJwk): Promise<VerifyResult>;
156
- declare const webhook: {
157
- verify: typeof verify;
158
- fetchJwks: typeof fetchJwks;
159
- };
160
-
161
140
  interface OcSignInButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onError'> {
162
141
  scope: string[];
163
142
  sessionPolicy?: Partial<SessionPolicy>;
@@ -183,17 +162,16 @@ declare const payment: {
183
162
  authorize: typeof authorize;
184
163
  };
185
164
 
186
- declare function get(): Promise<IntegratorPriceConfig>;
187
- declare function update(cfg: IntegratorPriceConfig): Promise<IntegratorPriceConfig>;
188
165
  declare function validate(cfg: IntegratorPriceConfig): ValidationResult;
189
166
  declare const config: {
190
- get: typeof get;
191
- update: typeof update;
192
167
  validate: typeof validate;
193
168
  };
194
169
 
195
170
  declare function setOrigin(url: string): void;
196
171
  declare function getOrigin(): string;
172
+ declare function setBearerToken(token: string | null): void;
173
+ declare function getBearerToken(): string | null;
174
+ declare function clearBearerToken(): void;
197
175
  declare class MeClientError extends Error {
198
176
  readonly status: number;
199
177
  constructor(message: string, status: number);
@@ -208,24 +186,16 @@ declare const oc: {
208
186
  payment: {
209
187
  authorize: (opts: PaymentAuthorizeOptions) => Promise<PaymentResult>;
210
188
  };
189
+ event: {
190
+ fire: (options: FireEventOptions) => Promise<BillableEvent>;
191
+ };
211
192
  config: {
212
- get: () => Promise<IntegratorPriceConfig>;
213
- update: (cfg: IntegratorPriceConfig) => Promise<IntegratorPriceConfig>;
214
193
  validate: (cfg: IntegratorPriceConfig) => ValidationResult;
215
194
  };
216
195
  webhook: {
217
196
  verify: typeof verify;
218
- fetchJwks: () => Promise<OcPublicJwk[]>;
219
- };
220
- delegation: {
221
- issue: (opts: IssueDelegationOptions) => Promise<DelegationEnvelope>;
222
- revoke: (delegation_id: string) => Promise<{
223
- ok: true;
224
- }>;
225
- };
226
- event: {
227
- fire: (opts: FireEventOptions) => Promise<BillableEvent>;
197
+ fetchJwks: typeof fetchJwksForce;
228
198
  };
229
199
  };
230
200
 
231
- export { type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, type DelegationEnvelope, type DelegationScope, type EventClass, type EventSubtype, type FireEventOptions, type IntegratorEventConfig, type IntegratorPriceConfig, type IssueDelegationOptions, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type Session, type SessionPolicy, type SignInOptions, type SiteFeeShape, type TelemetryEvent, type ValidationResult, type VerifyResult, computeFees, config, delegation, event, getOrigin, oc, onTelemetry, payment, session, setOrigin, validateIntegratorConfig, webhook };
201
+ export { type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, type EventClass, type EventSubtype, type FireEventOptions, type IntegratorEventConfig, type IntegratorPriceConfig, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type Session, type SessionPolicy, type SignInOptions, type SiteFeeShape, type TelemetryEvent, type ValidationResult, type VerifyOptions, type VerifyResult, clearBearerToken, computeFees, config, event, getBearerToken, getOrigin, oc, onTelemetry, payment, session, setBearerToken, setOrigin, validateIntegratorConfig, webhook };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,29 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- export { OcAccount, OcAuthConfig, OcSessionProvider, OcSessionState, OcSessionStatus, useOcSession, useOptionalOcSession } from '@orangecheck/auth-client';
3
+
4
+ interface VerifyResult {
5
+ ok: boolean;
6
+ reason?: string;
7
+ }
8
+ interface OcPublicJwk {
9
+ kty: 'OKP';
10
+ crv: 'Ed25519';
11
+ x: string;
12
+ kid: string;
13
+ alg?: 'EdDSA';
14
+ use?: 'sig';
15
+ }
16
+ interface VerifyOptions {
17
+ issuer?: string;
18
+ jwk?: OcPublicJwk;
19
+ jwksCacheTtlMs?: number;
20
+ }
21
+ declare function verify(rawBody: string | Uint8Array, sigHex: string, kid: string, options?: VerifyOptions): Promise<VerifyResult>;
22
+ declare function fetchJwksForce(issuer?: string): Promise<void>;
23
+ declare const webhook: {
24
+ verify: typeof verify;
25
+ fetchJwks: typeof fetchJwksForce;
26
+ };
4
27
 
5
28
  declare const PLATFORM_FEE_POLICY: {
6
29
  readonly pct: 0.2;
@@ -80,7 +103,6 @@ interface SignInOptions {
80
103
  scope: string[];
81
104
  sessionPolicy?: Partial<SessionPolicy>;
82
105
  returnTo?: string;
83
- project_key?: string;
84
106
  }
85
107
  interface PaymentAuthorizeOptions {
86
108
  identity: string;
@@ -88,7 +110,6 @@ interface PaymentAuthorizeOptions {
88
110
  usd_cents?: number;
89
111
  description: string;
90
112
  external_ref?: string;
91
- project_key?: string;
92
113
  }
93
114
  interface PaymentResult {
94
115
  id: string;
@@ -106,58 +127,16 @@ interface TelemetryEvent {
106
127
  interface FireEventOptions {
107
128
  project_key: string;
108
129
  subtype: EventSubtype;
109
- payment_amount_sats?: number;
110
130
  action_label?: string;
111
- note?: string;
131
+ payment_amount_sats?: number;
132
+ user_address?: string;
133
+ metadata?: Record<string, unknown>;
112
134
  }
113
- declare function fire(opts: FireEventOptions): Promise<BillableEvent>;
135
+ declare function fire(options: FireEventOptions): Promise<BillableEvent>;
114
136
  declare const event: {
115
137
  fire: typeof fire;
116
138
  };
117
139
 
118
- type DelegationScope = 'identity.read' | 'inbox.read' | 'attest.verify' | 'stamp.sign' | 'payment.authorize';
119
- interface IssueDelegationOptions {
120
- agent_id: string;
121
- scope: DelegationScope[];
122
- expires_at: string;
123
- reason?: string;
124
- }
125
- interface DelegationEnvelope {
126
- id: string;
127
- scope: DelegationScope[];
128
- expires_at: string;
129
- issued_at: string;
130
- verify_url: string;
131
- }
132
- declare function issue(opts: IssueDelegationOptions): Promise<DelegationEnvelope>;
133
- declare function revoke(delegation_id: string): Promise<{
134
- ok: true;
135
- }>;
136
- declare const delegation: {
137
- issue: typeof issue;
138
- revoke: typeof revoke;
139
- };
140
-
141
- interface OcPublicJwk {
142
- kty: 'OKP';
143
- crv: 'Ed25519';
144
- x: string;
145
- kid: string;
146
- alg?: string;
147
- use?: string;
148
- }
149
- interface VerifyResult {
150
- ok: boolean;
151
- reason?: string;
152
- key_id?: string;
153
- }
154
- declare function fetchJwks(): Promise<OcPublicJwk[]>;
155
- declare function verify(rawBody: string | Uint8Array, sigHex: string, kid: string, jwk?: OcPublicJwk): Promise<VerifyResult>;
156
- declare const webhook: {
157
- verify: typeof verify;
158
- fetchJwks: typeof fetchJwks;
159
- };
160
-
161
140
  interface OcSignInButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onError'> {
162
141
  scope: string[];
163
142
  sessionPolicy?: Partial<SessionPolicy>;
@@ -183,17 +162,16 @@ declare const payment: {
183
162
  authorize: typeof authorize;
184
163
  };
185
164
 
186
- declare function get(): Promise<IntegratorPriceConfig>;
187
- declare function update(cfg: IntegratorPriceConfig): Promise<IntegratorPriceConfig>;
188
165
  declare function validate(cfg: IntegratorPriceConfig): ValidationResult;
189
166
  declare const config: {
190
- get: typeof get;
191
- update: typeof update;
192
167
  validate: typeof validate;
193
168
  };
194
169
 
195
170
  declare function setOrigin(url: string): void;
196
171
  declare function getOrigin(): string;
172
+ declare function setBearerToken(token: string | null): void;
173
+ declare function getBearerToken(): string | null;
174
+ declare function clearBearerToken(): void;
197
175
  declare class MeClientError extends Error {
198
176
  readonly status: number;
199
177
  constructor(message: string, status: number);
@@ -208,24 +186,16 @@ declare const oc: {
208
186
  payment: {
209
187
  authorize: (opts: PaymentAuthorizeOptions) => Promise<PaymentResult>;
210
188
  };
189
+ event: {
190
+ fire: (options: FireEventOptions) => Promise<BillableEvent>;
191
+ };
211
192
  config: {
212
- get: () => Promise<IntegratorPriceConfig>;
213
- update: (cfg: IntegratorPriceConfig) => Promise<IntegratorPriceConfig>;
214
193
  validate: (cfg: IntegratorPriceConfig) => ValidationResult;
215
194
  };
216
195
  webhook: {
217
196
  verify: typeof verify;
218
- fetchJwks: () => Promise<OcPublicJwk[]>;
219
- };
220
- delegation: {
221
- issue: (opts: IssueDelegationOptions) => Promise<DelegationEnvelope>;
222
- revoke: (delegation_id: string) => Promise<{
223
- ok: true;
224
- }>;
225
- };
226
- event: {
227
- fire: (opts: FireEventOptions) => Promise<BillableEvent>;
197
+ fetchJwks: typeof fetchJwksForce;
228
198
  };
229
199
  };
230
200
 
231
- export { type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, type DelegationEnvelope, type DelegationScope, type EventClass, type EventSubtype, type FireEventOptions, type IntegratorEventConfig, type IntegratorPriceConfig, type IssueDelegationOptions, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type Session, type SessionPolicy, type SignInOptions, type SiteFeeShape, type TelemetryEvent, type ValidationResult, type VerifyResult, computeFees, config, delegation, event, getOrigin, oc, onTelemetry, payment, session, setOrigin, validateIntegratorConfig, webhook };
201
+ export { type AttestTier, type BillableEvent, type ClassASubtype, type ClassBSubtype, type ClassCSubtype, type ComputedFees, type EventClass, type EventSubtype, type FireEventOptions, type IntegratorEventConfig, type IntegratorPriceConfig, MIN_INTEGRATOR_PRICE_SATS, MeClientError, type OcPublicJwk, OcSignInButton, type OcSignInButtonProps, PLATFORM_FEE_POLICY, type PaymentAuthorizeOptions, type PaymentResult, type Session, type SessionPolicy, type SignInOptions, type SiteFeeShape, type TelemetryEvent, type ValidationResult, type VerifyOptions, type VerifyResult, clearBearerToken, computeFees, config, event, getBearerToken, getOrigin, oc, onTelemetry, payment, session, setBearerToken, setOrigin, validateIntegratorConfig, webhook };