@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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -362,6 +362,11 @@ async function fire(options) {
|
|
|
362
362
|
if (!options.subtype) {
|
|
363
363
|
throw new Error("event.fire requires subtype");
|
|
364
364
|
}
|
|
365
|
+
if (options.userAddress && !options.signingSecret) {
|
|
366
|
+
throw new Error(
|
|
367
|
+
"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."
|
|
368
|
+
);
|
|
369
|
+
}
|
|
365
370
|
const requestBody = {
|
|
366
371
|
project_key: options.project_key,
|
|
367
372
|
subtype: options.subtype
|
|
@@ -371,6 +376,7 @@ async function fire(options) {
|
|
|
371
376
|
if (options.action_label !== void 0) requestBody.action_label = options.action_label;
|
|
372
377
|
if (options.metadata !== void 0) requestBody.metadata = options.metadata;
|
|
373
378
|
if (options.is_agent !== void 0) requestBody.is_agent = options.is_agent;
|
|
379
|
+
if (options.userAddress !== void 0) requestBody.user_address = options.userAddress;
|
|
374
380
|
const headers = {};
|
|
375
381
|
if (options.idempotencyKey) headers["idempotency-key"] = options.idempotencyKey;
|
|
376
382
|
if (options.signingSecret) {
|
|
@@ -957,7 +963,8 @@ async function importJWK(jwk, alg, options) {
|
|
|
957
963
|
}
|
|
958
964
|
|
|
959
965
|
// src/webhook.ts
|
|
960
|
-
var DEFAULT_ISSUER = "https://ochk.io";
|
|
966
|
+
var DEFAULT_ISSUER = "https://me.ochk.io";
|
|
967
|
+
var JWKS_PATH = "/api/dev-jwks";
|
|
961
968
|
var DEFAULT_TTL_MS = 60 * 60 * 1e3;
|
|
962
969
|
var jwksCache = /* @__PURE__ */ new Map();
|
|
963
970
|
var inflight = /* @__PURE__ */ new Map();
|
|
@@ -968,7 +975,7 @@ async function fetchJwks(issuer, ttlMs) {
|
|
|
968
975
|
if (existing) return existing;
|
|
969
976
|
const p = (async () => {
|
|
970
977
|
try {
|
|
971
|
-
const url = `${issuer.replace(/\/$/, "")}
|
|
978
|
+
const url = `${issuer.replace(/\/$/, "")}${JWKS_PATH}`;
|
|
972
979
|
const res = await fetch(url, { headers: { Accept: "application/json" } });
|
|
973
980
|
if (!res.ok) throw new Error(`JWKS fetch ${url} returned ${res.status}`);
|
|
974
981
|
const json = await res.json();
|