@orangecheck/me-client 0.57.0 → 0.58.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 +27 -6
- package/README.md +2 -1
- package/dist/index.d.mts +3 -35
- package/dist/index.d.ts +3 -35
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -7
- package/dist/index.mjs.map +1 -1
- package/dist/{integrator-BmRHP_iX.d.mts → integrator-fTchEeNJ.d.mts} +36 -2
- package/dist/{integrator-BmRHP_iX.d.ts → integrator-fTchEeNJ.d.ts} +36 -2
- package/dist/integrator.d.mts +1 -1
- package/dist/integrator.d.ts +1 -1
- package/dist/integrator.js.map +1 -1
- package/dist/integrator.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,33 @@ this file tracks the package's TS / Node / runtime API surface.
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.58.0] — 2026-11-09
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `bearerToken` on `oc.payment.authorize`, for that call only, as on
|
|
18
|
+
`oc.event.fire`. `setBearerToken` holds one token for the whole process, so a
|
|
19
|
+
server serving many people passes each person's token per call instead. It
|
|
20
|
+
is sent as Authorization and never in the body. `setBearerToken` still works.
|
|
21
|
+
- The five scopes me.ochk.io already knows and `oc.scope.request` refused:
|
|
22
|
+
`cross_integrator_lifetime_sats`, `cross_integrator_distinct_count`,
|
|
23
|
+
`cross_integrator_oldest_event_at`, `cross_integrator_active_days` and
|
|
24
|
+
`trust_attestations_bundle`. `Scope` has all twelve, and `SCOPE_IDS` exports
|
|
25
|
+
them, frozen, in the order me.ochk.io lists them; a me.ochk.io test fails when
|
|
26
|
+
the two lists differ.
|
|
27
|
+
|
|
28
|
+
### Deprecated
|
|
29
|
+
|
|
30
|
+
- The `attest_tier` scope, as me.ochk.io already marks it. ochk.app no longer
|
|
31
|
+
asks for it, so a request for it asks the person nothing; a backed account
|
|
32
|
+
tells your site what backs it at sign-in. Old grants still resolve. The
|
|
33
|
+
`oc.scope` example asks for `email` and `bitcoin_address` instead.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- `WebhookPayload.scopes` is keyed by `Scope`, so it names the four cross-app
|
|
38
|
+
scopes a delivery can carry beside the ones it already listed.
|
|
39
|
+
|
|
13
40
|
## [0.57.0] — 2026-11-09
|
|
14
41
|
|
|
15
42
|
### Deprecated
|
|
@@ -833,12 +860,6 @@ Two independent defects, either of which was fatal:
|
|
|
833
860
|
that project into their own ledger. The docstring is published as SDK
|
|
834
861
|
reference on docs.ochk.io, so a stale one is a false published claim.
|
|
835
862
|
|
|
836
|
-
## [Unreleased]
|
|
837
|
-
|
|
838
|
-
## [0.57.0] — 2026-11-09
|
|
839
|
-
|
|
840
|
-
- _(no pending changes)_
|
|
841
|
-
|
|
842
863
|
## [0.38.3] — 2026-10-23
|
|
843
864
|
|
|
844
865
|
### Changed
|
package/README.md
CHANGED
|
@@ -177,9 +177,10 @@ Class B billable event. Sub-Stripe rates (0.5–1.0% percentage-based). The pers
|
|
|
177
177
|
import { oc } from '@orangecheck/me-client';
|
|
178
178
|
|
|
179
179
|
const payment = await oc.payment.authorize({
|
|
180
|
-
identity: session.identity,
|
|
181
180
|
amount_sats: 240_000,
|
|
182
181
|
description: 'breez · march invoice',
|
|
182
|
+
// On a server, the person's oc_session token for this call only.
|
|
183
|
+
bearerToken: token,
|
|
183
184
|
});
|
|
184
185
|
```
|
|
185
186
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,41 +1,9 @@
|
|
|
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,
|
|
4
|
-
export {
|
|
3
|
+
import { S as Scope, B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-fTchEeNJ.mjs';
|
|
4
|
+
export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, D as DropCadence, o as DropClosedWebhookPayload, q as DropResponseBlock, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-fTchEeNJ.mjs';
|
|
5
5
|
export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.mjs';
|
|
6
6
|
|
|
7
|
-
type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count';
|
|
8
|
-
interface TrustAttestationCount {
|
|
9
|
-
total: number;
|
|
10
|
-
good: number;
|
|
11
|
-
distinct_good_issuers: number;
|
|
12
|
-
caution: number;
|
|
13
|
-
}
|
|
14
|
-
declare function parseTrustAttestationCount(value: string): TrustAttestationCount | null;
|
|
15
|
-
interface GrantedOptions {
|
|
16
|
-
project_key: string;
|
|
17
|
-
accountId?: string;
|
|
18
|
-
signingSecret?: string;
|
|
19
|
-
signal?: AbortSignal;
|
|
20
|
-
}
|
|
21
|
-
interface GrantedResult {
|
|
22
|
-
sub: string;
|
|
23
|
-
scopes_granted: Scope[];
|
|
24
|
-
scopes: Partial<Record<Scope, string>>;
|
|
25
|
-
}
|
|
26
|
-
declare function granted(options: GrantedOptions): Promise<GrantedResult>;
|
|
27
|
-
interface RequestOptions {
|
|
28
|
-
project_key: string;
|
|
29
|
-
return_to: string;
|
|
30
|
-
origin?: string;
|
|
31
|
-
}
|
|
32
|
-
declare function request(scopes: Scope[], options: RequestOptions): never;
|
|
33
|
-
declare const scope: {
|
|
34
|
-
granted: typeof granted;
|
|
35
|
-
request: typeof request;
|
|
36
|
-
parseTrustAttestationCount: typeof parseTrustAttestationCount;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
7
|
type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock' | 'oc-pledge';
|
|
40
8
|
interface FamilyScopesOptions {
|
|
41
9
|
origin?: string;
|
|
@@ -293,4 +261,4 @@ declare const oc: {
|
|
|
293
261
|
};
|
|
294
262
|
};
|
|
295
263
|
|
|
296
|
-
export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult,
|
|
264
|
+
export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,9 @@
|
|
|
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,
|
|
4
|
-
export {
|
|
3
|
+
import { S as Scope, B as BillableEvent, E as EventKey, I as IntegratorPriceConfig, T as TelemetryEvent, a as SignInOptions, b as Session, P as PaymentAuthorizeOptions, c as PaymentResult, V as ValidationResult, f as fromTemplate, g as getArchetypeTemplate, A as ArchetypeTemplate, F as Federation, G as GrantedOptions, d as GrantedResult, r as request, p as parseTrustAttestationCount } from './integrator-fTchEeNJ.js';
|
|
4
|
+
export { e as ALL_EVENT_SUBTYPES, h as ARCHETYPE_TEMPLATES, i as AgentClassOverride, j as AttestTier, C as CUSTOM_EVENT_KEY_RE, k as ClassASubtype, l as ClassBSubtype, m as ClassCSubtype, n as ComputedFees, D as DropCadence, o as DropClosedWebhookPayload, q as DropResponseBlock, s as DropScheduleSummary, t as EVENT_SUBTYPES, u as EventClass, v as EventSubtype, w as EventSubtypeMetadata, x as FederationMigratingWebhookPayload, y as FederationMigrationCancelledWebhookPayload, z as FederationStatus, H as FederationSuccessor, J as IntegratorArchetype, K as IntegratorEventConfig, M as MAX_DROP_WINDOW_DAYS, L as MIN_INTEGRATOR_PRICE_SATS, N as PLATFORM_FEE_POLICY, R as RequestOptions, O as SCOPE_IDS, Q as SessionPolicy, U as SigningMethod, W as SiteFeeShape, X as SystemWebhookPayload, Y as TrustAttestationCount, Z as WebhookHeaders, _ as WebhookPayload, $ as computeFees, a0 as isEventClass, a1 as isInheritedName, a2 as scope, a3 as subtypesForClass, a4 as validateIntegratorConfig } from './integrator-fTchEeNJ.js';
|
|
5
5
|
export { CONNECT_CONSENT_BLURB, CONNECT_CONSENT_LABEL } from './connect-consent.js';
|
|
6
6
|
|
|
7
|
-
type Scope = 'bitcoin_address' | 'email' | 'attest_tier' | 'display_name' | 'cross_integrator_event_count' | 'cross_integrator_human_event_count' | 'trust_attestation_count';
|
|
8
|
-
interface TrustAttestationCount {
|
|
9
|
-
total: number;
|
|
10
|
-
good: number;
|
|
11
|
-
distinct_good_issuers: number;
|
|
12
|
-
caution: number;
|
|
13
|
-
}
|
|
14
|
-
declare function parseTrustAttestationCount(value: string): TrustAttestationCount | null;
|
|
15
|
-
interface GrantedOptions {
|
|
16
|
-
project_key: string;
|
|
17
|
-
accountId?: string;
|
|
18
|
-
signingSecret?: string;
|
|
19
|
-
signal?: AbortSignal;
|
|
20
|
-
}
|
|
21
|
-
interface GrantedResult {
|
|
22
|
-
sub: string;
|
|
23
|
-
scopes_granted: Scope[];
|
|
24
|
-
scopes: Partial<Record<Scope, string>>;
|
|
25
|
-
}
|
|
26
|
-
declare function granted(options: GrantedOptions): Promise<GrantedResult>;
|
|
27
|
-
interface RequestOptions {
|
|
28
|
-
project_key: string;
|
|
29
|
-
return_to: string;
|
|
30
|
-
origin?: string;
|
|
31
|
-
}
|
|
32
|
-
declare function request(scopes: Scope[], options: RequestOptions): never;
|
|
33
|
-
declare const scope: {
|
|
34
|
-
granted: typeof granted;
|
|
35
|
-
request: typeof request;
|
|
36
|
-
parseTrustAttestationCount: typeof parseTrustAttestationCount;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
7
|
type FamilyVerb = 'oc-vote' | 'oc-stamp' | 'oc-agent' | 'oc-attest' | 'oc-lock' | 'oc-pledge';
|
|
40
8
|
interface FamilyScopesOptions {
|
|
41
9
|
origin?: string;
|
|
@@ -293,4 +261,4 @@ declare const oc: {
|
|
|
293
261
|
};
|
|
294
262
|
};
|
|
295
263
|
|
|
296
|
-
export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult,
|
|
264
|
+
export { ArchetypeTemplate, type BatchEventResult, type BatchRejectCode, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, GrantedOptions, GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, Scope, Session, SignInOptions, TelemetryEvent, ValidationResult, type VerifyEventResult, type VerifyOptions, type VerifyResult, type WithRateLimitRetryOptions, clearBearerToken, config, fromTemplate as configFromTemplate, event, family, federations, getArchetypeTemplate, getBearerToken, getOrigin, oc, onTelemetry, parseTrustAttestationCount, payingAt, payment, refreshEnvelopeJwks, safeReturnPath, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
|
package/dist/index.js
CHANGED
|
@@ -164,9 +164,11 @@ async function authorize(opts) {
|
|
|
164
164
|
if (opts.amount_sats == null && opts.usd_cents == null) {
|
|
165
165
|
throw new Error("payment.authorize requires amount_sats or usd_cents");
|
|
166
166
|
}
|
|
167
|
+
const { bearerToken: bearerToken2, ...body } = opts;
|
|
167
168
|
return api("/api/payment/authorize", {
|
|
168
169
|
method: "POST",
|
|
169
|
-
body
|
|
170
|
+
body,
|
|
171
|
+
bearerToken: bearerToken2
|
|
170
172
|
});
|
|
171
173
|
}
|
|
172
174
|
var payment = { authorize };
|
|
@@ -1301,15 +1303,20 @@ async function defaultLive() {
|
|
|
1301
1303
|
}
|
|
1302
1304
|
var federations = { list, live, get, defaultLive };
|
|
1303
1305
|
var CONSENT_ORIGIN = "https://ochk.app";
|
|
1304
|
-
var
|
|
1306
|
+
var SCOPE_IDS = Object.freeze([
|
|
1305
1307
|
"bitcoin_address",
|
|
1306
1308
|
"email",
|
|
1307
1309
|
"attest_tier",
|
|
1308
1310
|
"display_name",
|
|
1309
1311
|
"cross_integrator_event_count",
|
|
1310
1312
|
"cross_integrator_human_event_count",
|
|
1311
|
-
"
|
|
1312
|
-
|
|
1313
|
+
"cross_integrator_lifetime_sats",
|
|
1314
|
+
"cross_integrator_distinct_count",
|
|
1315
|
+
"cross_integrator_oldest_event_at",
|
|
1316
|
+
"cross_integrator_active_days",
|
|
1317
|
+
"trust_attestation_count",
|
|
1318
|
+
"trust_attestations_bundle"
|
|
1319
|
+
]);
|
|
1313
1320
|
function parseTrustAttestationCount(value) {
|
|
1314
1321
|
const parts = value.split(",");
|
|
1315
1322
|
if (parts.length !== 4) return null;
|
|
@@ -1366,9 +1373,9 @@ function request(scopes2, options) {
|
|
|
1366
1373
|
throw new Error("oc.scope.request: scopes must be a non-empty array");
|
|
1367
1374
|
}
|
|
1368
1375
|
for (const s of scopes2) {
|
|
1369
|
-
if (!
|
|
1376
|
+
if (!SCOPE_IDS.includes(s)) {
|
|
1370
1377
|
throw new Error(
|
|
1371
|
-
`oc.scope.request: unknown scope "${s}" \xB7 valid: ${
|
|
1378
|
+
`oc.scope.request: unknown scope "${s}" \xB7 valid: ${SCOPE_IDS.join(", ")}`
|
|
1372
1379
|
);
|
|
1373
1380
|
}
|
|
1374
1381
|
}
|
|
@@ -1740,6 +1747,7 @@ exports.MAX_DROP_WINDOW_DAYS = MAX_DROP_WINDOW_DAYS;
|
|
|
1740
1747
|
exports.MIN_INTEGRATOR_PRICE_SATS = MIN_INTEGRATOR_PRICE_SATS;
|
|
1741
1748
|
exports.MeClientError = MeClientError;
|
|
1742
1749
|
exports.PLATFORM_FEE_POLICY = PLATFORM_FEE_POLICY;
|
|
1750
|
+
exports.SCOPE_IDS = SCOPE_IDS;
|
|
1743
1751
|
exports.clearBearerToken = clearBearerToken;
|
|
1744
1752
|
exports.computeFees = computeFees;
|
|
1745
1753
|
exports.config = config;
|