@singi-labs/sifa-sdk 0.19.9 → 0.19.11

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.
@@ -216,8 +216,12 @@ interface FetchPendingEndorsementsOptions extends ApiFetchOptions {
216
216
  }
217
217
  /**
218
218
  * Endorsements awaiting the signed-in user's decision. Requires credentials --
219
- * the AppView reads the subject DID from the session, not from a parameter, so
220
- * there is no way to read someone else's inbox.
219
+ * the AppView reads the subject DID from the caller's identity, not from a
220
+ * parameter, so there is no way to read someone else's inbox.
221
+ *
222
+ * Auth is identity-only server-side, so the NATIVE app supplies
223
+ * `config.getAuthToken` to mint a service-auth Bearer, while WEB relies on its
224
+ * session cookie (`credentials: 'include'`).
221
225
  *
222
226
  * Returns an empty page on failure so a broken inbox degrades to "nothing
223
227
  * pending" rather than breaking the surface hosting it.
@@ -216,8 +216,12 @@ interface FetchPendingEndorsementsOptions extends ApiFetchOptions {
216
216
  }
217
217
  /**
218
218
  * Endorsements awaiting the signed-in user's decision. Requires credentials --
219
- * the AppView reads the subject DID from the session, not from a parameter, so
220
- * there is no way to read someone else's inbox.
219
+ * the AppView reads the subject DID from the caller's identity, not from a
220
+ * parameter, so there is no way to read someone else's inbox.
221
+ *
222
+ * Auth is identity-only server-side, so the NATIVE app supplies
223
+ * `config.getAuthToken` to mint a service-auth Bearer, while WEB relies on its
224
+ * session cookie (`credentials: 'include'`).
221
225
  *
222
226
  * Returns an empty page on failure so a broken inbox degrades to "nothing
223
227
  * pending" rather than breaking the surface hosting it.
@@ -471,10 +471,15 @@ async function fetchReciprocityCandidate(config, options = {}) {
471
471
  }
472
472
 
473
473
  // src/query/fetchers/endorsement-inbox.ts
474
+ var PENDING_ENDORSEMENTS_LXM = "id.sifa.endorsement.getPending";
474
475
  async function fetchPendingEndorsements(config, options = {}) {
475
476
  const { cookieHeader, ...rest } = options;
476
477
  const headers = { ...rest.headers ?? {} };
477
478
  if (cookieHeader) headers.cookie = cookieHeader;
479
+ if (config.getAuthToken) {
480
+ const token = await config.getAuthToken(PENDING_ENDORSEMENTS_LXM);
481
+ if (token) headers.Authorization = `Bearer ${token}`;
482
+ }
478
483
  try {
479
484
  const data = await apiFetch(config, "/api/endorsements/pending", {
480
485
  cache: "no-store",