@orangecheck/me-client 0.50.0 → 0.51.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
@@ -219,6 +219,8 @@ declare const federations: {
219
219
  defaultLive: typeof defaultLive;
220
220
  };
221
221
 
222
+ declare function safeReturnPath(raw: unknown, fallback?: string): string;
223
+
222
224
  declare function setOrigin(url: string): void;
223
225
  declare function getOrigin(): string;
224
226
  declare function setBearerToken(token: string | null): void;
@@ -287,4 +289,4 @@ declare const oc: {
287
289
  };
288
290
  };
289
291
 
290
- export { ArchetypeTemplate, type BatchEventResult, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, type GrantedOptions, type GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, type RequestOptions, type Scope, Session, SignInOptions, TelemetryEvent, type TrustAttestationCount, 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, scope, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
292
+ export { ArchetypeTemplate, type BatchEventResult, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, type GrantedOptions, type GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, type RequestOptions, type Scope, Session, SignInOptions, TelemetryEvent, type TrustAttestationCount, 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, scope, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
package/dist/index.d.ts CHANGED
@@ -219,6 +219,8 @@ declare const federations: {
219
219
  defaultLive: typeof defaultLive;
220
220
  };
221
221
 
222
+ declare function safeReturnPath(raw: unknown, fallback?: string): string;
223
+
222
224
  declare function setOrigin(url: string): void;
223
225
  declare function getOrigin(): string;
224
226
  declare function setBearerToken(token: string | null): void;
@@ -287,4 +289,4 @@ declare const oc: {
287
289
  };
288
290
  };
289
291
 
290
- export { ArchetypeTemplate, type BatchEventResult, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, type GrantedOptions, type GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, type RequestOptions, type Scope, Session, SignInOptions, TelemetryEvent, type TrustAttestationCount, 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, scope, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
292
+ export { ArchetypeTemplate, type BatchEventResult, BillableEvent, EventKey, type FamilyScopesOptions, type FamilyScopesResult, type FamilyVerb, Federation, type FireBatchResponse, type FireEventOptions, type FireEventResult, type GrantedOptions, type GrantedResult, IntegratorPriceConfig, MeClientError, type OcPublicJwk, type PayPeriod, type PayingState, PaymentAuthorizeOptions, PaymentResult, type RequestOptions, type Scope, Session, SignInOptions, TelemetryEvent, type TrustAttestationCount, 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, scope, session, setBearerToken, setOrigin, verifyActivityAttestation, webhook, withRateLimitRetry };
package/dist/index.js CHANGED
@@ -1220,6 +1220,30 @@ var family = { scopes };
1220
1220
  var CONNECT_CONSENT_LABEL = "Also create my orangecheck account";
1221
1221
  var CONNECT_CONSENT_BLURB = "It stays with orangecheck until you claim it at ochk.app. Then you can use it on other sites, or delete it.";
1222
1222
 
1223
+ // src/return-path.ts
1224
+ function safeReturnPath(raw, fallback = "/") {
1225
+ if (typeof raw !== "string" || raw.length === 0 || raw.length > 2048) return fallback;
1226
+ try {
1227
+ encodeURIComponent(raw);
1228
+ } catch {
1229
+ return fallback;
1230
+ }
1231
+ if (!raw.startsWith("/") || raw.startsWith("//") || raw.startsWith("/\\")) return fallback;
1232
+ if (/[\u0000-\u001f\u007f-\u009f\\]/.test(raw)) return fallback;
1233
+ try {
1234
+ decodeURIComponent(raw);
1235
+ } catch {
1236
+ return fallback;
1237
+ }
1238
+ const segments = raw.split(/[?#]/, 1)[0].split("/");
1239
+ if (segments.some((s) => /^(\.|%2e){1,2}$/i.test(s))) return fallback;
1240
+ try {
1241
+ return new URL(raw, "https://site.invalid").origin === "https://site.invalid" ? raw : fallback;
1242
+ } catch {
1243
+ return fallback;
1244
+ }
1245
+ }
1246
+
1223
1247
  // src/identity.ts
1224
1248
  var DEFAULT_ISSUER2 = "https://me.ochk.io";
1225
1249
  var DEFAULT_TTL_MS2 = 60 * 60 * 1e3;
@@ -1650,6 +1674,7 @@ exports.parseTrustAttestationCount = parseTrustAttestationCount;
1650
1674
  exports.payingAt = payingAt;
1651
1675
  exports.payment = payment;
1652
1676
  exports.refreshEnvelopeJwks = refreshEnvelopeJwks;
1677
+ exports.safeReturnPath = safeReturnPath;
1653
1678
  exports.scope = scope;
1654
1679
  exports.session = session;
1655
1680
  exports.setBearerToken = setBearerToken;