@orangecheck/me-client 0.15.0 → 0.16.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';
@@ -342,10 +350,11 @@ declare const oc: {
342
350
  scope: {
343
351
  granted: (options: GrantedOptions) => Promise<GrantedResult>;
344
352
  request: typeof request;
353
+ parseTrustAttestationCount: typeof parseTrustAttestationCount;
345
354
  };
346
355
  family: {
347
356
  scopes: (verb: FamilyVerb, options?: FamilyScopesOptions) => Promise<FamilyScopesResult>;
348
357
  };
349
358
  };
350
359
 
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 };
360
+ 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 TrustAttestationCount, type ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, computeFees, config, event, family, federations, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payment, scope, session, setBearerToken, setOrigin, 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';
@@ -342,10 +350,11 @@ declare const oc: {
342
350
  scope: {
343
351
  granted: (options: GrantedOptions) => Promise<GrantedResult>;
344
352
  request: typeof request;
353
+ parseTrustAttestationCount: typeof parseTrustAttestationCount;
345
354
  };
346
355
  family: {
347
356
  scopes: (verb: FamilyVerb, options?: FamilyScopesOptions) => Promise<FamilyScopesResult>;
348
357
  };
349
358
  };
350
359
 
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 };
360
+ 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 TrustAttestationCount, type ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, computeFees, config, event, family, federations, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payment, scope, session, setBearerToken, setOrigin, validateIntegratorConfig, webhook, withRateLimitRetry };
package/dist/index.js CHANGED
@@ -815,8 +815,21 @@ var VALID_SCOPES = [
815
815
  "attest_tier",
816
816
  "display_name",
817
817
  "cross_integrator_event_count",
818
- "cross_integrator_human_event_count"
818
+ "cross_integrator_human_event_count",
819
+ "trust_attestation_count"
819
820
  ];
821
+ function parseTrustAttestationCount(value) {
822
+ const parts = value.split(",");
823
+ if (parts.length !== 4) return null;
824
+ const ints = parts.map((p) => Number.parseInt(p, 10));
825
+ if (ints.some((n) => !Number.isInteger(n) || n < 0)) return null;
826
+ return {
827
+ total: ints[0],
828
+ good: ints[1],
829
+ distinct_good_issuers: ints[2],
830
+ caution: ints[3]
831
+ };
832
+ }
820
833
  async function granted(options) {
821
834
  if (!options.project_key) {
822
835
  throw new Error("oc.scope.granted: project_key is required");
@@ -859,7 +872,7 @@ function request(scopes2, options) {
859
872
  window.location.assign(url.toString());
860
873
  throw new Error("oc.scope.request: redirected to consent prompt");
861
874
  }
862
- var scope = { granted, request };
875
+ var scope = { granted, request, parseTrustAttestationCount };
863
876
 
864
877
  // src/family.ts
865
878
  var VALID_VERBS = [
@@ -913,6 +926,7 @@ exports.getBearerToken = getBearerToken;
913
926
  exports.getOrigin = getOrigin;
914
927
  exports.oc = oc;
915
928
  exports.onTelemetry = onTelemetry;
929
+ exports.parseTrustAttestationCount = parseTrustAttestationCount;
916
930
  exports.payment = payment;
917
931
  exports.scope = scope;
918
932
  exports.session = session;