@orangecheck/me-client 0.25.2 → 0.26.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.mjs CHANGED
@@ -340,6 +340,11 @@ async function fire(options) {
340
340
  if (!options.subtype) {
341
341
  throw new Error("event.fire requires subtype");
342
342
  }
343
+ if (options.userAddress && !options.signingSecret) {
344
+ throw new Error(
345
+ "event.fire: userAddress names who earns, so it requires signingSecret \u2014 the signature over the request body is what authorises that earner. Without the secret, pass bearerToken (or rely on the oc_session cookie) and the caller earns instead."
346
+ );
347
+ }
343
348
  const requestBody = {
344
349
  project_key: options.project_key,
345
350
  subtype: options.subtype
@@ -349,6 +354,7 @@ async function fire(options) {
349
354
  if (options.action_label !== void 0) requestBody.action_label = options.action_label;
350
355
  if (options.metadata !== void 0) requestBody.metadata = options.metadata;
351
356
  if (options.is_agent !== void 0) requestBody.is_agent = options.is_agent;
357
+ if (options.userAddress !== void 0) requestBody.user_address = options.userAddress;
352
358
  const headers = {};
353
359
  if (options.idempotencyKey) headers["idempotency-key"] = options.idempotencyKey;
354
360
  if (options.signingSecret) {
@@ -935,7 +941,8 @@ async function importJWK(jwk, alg, options) {
935
941
  }
936
942
 
937
943
  // src/webhook.ts
938
- var DEFAULT_ISSUER = "https://ochk.io";
944
+ var DEFAULT_ISSUER = "https://me.ochk.io";
945
+ var JWKS_PATH = "/api/dev-jwks";
939
946
  var DEFAULT_TTL_MS = 60 * 60 * 1e3;
940
947
  var jwksCache = /* @__PURE__ */ new Map();
941
948
  var inflight = /* @__PURE__ */ new Map();
@@ -946,7 +953,7 @@ async function fetchJwks(issuer, ttlMs) {
946
953
  if (existing) return existing;
947
954
  const p = (async () => {
948
955
  try {
949
- const url = `${issuer.replace(/\/$/, "")}/.well-known/jwks.json`;
956
+ const url = `${issuer.replace(/\/$/, "")}${JWKS_PATH}`;
950
957
  const res = await fetch(url, { headers: { Accept: "application/json" } });
951
958
  if (!res.ok) throw new Error(`JWKS fetch ${url} returned ${res.status}`);
952
959
  const json = await res.json();