@settlemint/dalp-sdk 3.1.19-main.35069012938 → 3.1.19-main.35135009984

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.
@@ -5,16 +5,14 @@ import type { CookieStoreShape } from "../transport/cookie-store.ts";
5
5
  export interface DalpAuthClientConfig {
6
6
  readonly url: string;
7
7
  readonly apiKey?: string;
8
- readonly sessionToken?: string;
9
8
  readonly cookie?: string;
10
9
  readonly cookieStore?: CookieStoreShape;
11
10
  readonly organizationId?: string;
12
11
  readonly headers?: Record<string, string>;
13
12
  readonly fetch?: DalpFetch;
14
13
  }
15
- export interface DecodedDalpAuthClientConfig extends Omit<DalpAuthClientConfig, "apiKey" | "sessionToken" | "cookie"> {
14
+ export interface DecodedDalpAuthClientConfig extends Omit<DalpAuthClientConfig, "apiKey" | "cookie"> {
16
15
  readonly apiKey?: Secret;
17
- readonly sessionToken?: Secret;
18
16
  readonly cookie?: Secret;
19
17
  }
20
18
  export interface DalpAuthError {
package/dist/auth.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  makeCookieStore2,
11
11
  createCookieStoreFetch2,
12
12
  SDK_USER_AGENT2
13
- } from "./chunk-8e2t44g2.js";
13
+ } from "./chunk-wfh1ap44.js";
14
14
 
15
15
  // src/auth/live.ts
16
16
  import { apiKeyClient } from "@better-auth/api-key/client";
@@ -103,10 +103,9 @@ function optionalCookieStore(value) {
103
103
  function decodeAuthConfig(input) {
104
104
  const raw = input;
105
105
  const apiKey = optionalText(raw.apiKey, "apiKey");
106
- const sessionToken = optionalText(raw.sessionToken, "sessionToken");
107
106
  const cookie = optionalText(raw.cookie, "cookie");
108
- if ([apiKey, sessionToken, cookie].filter((credential) => credential !== undefined).length > 1) {
109
- throw new AuthConfigError("apiKey/sessionToken/cookie", "configure only one auth credential source");
107
+ if ([apiKey, cookie].filter((credential) => credential !== undefined).length > 1) {
108
+ throw new AuthConfigError("apiKey/cookie", "configure only one auth credential source");
110
109
  }
111
110
  const url = requiredUrl(raw.url);
112
111
  const cookieStore = optionalCookieStore(raw.cookieStore);
@@ -116,7 +115,6 @@ function decodeAuthConfig(input) {
116
115
  return {
117
116
  url,
118
117
  ...apiKey === undefined ? {} : { apiKey: secret2(apiKey) },
119
- ...sessionToken === undefined ? {} : { sessionToken: secret2(sessionToken) },
120
118
  ...cookie === undefined ? {} : { cookie: secret2(cookie) },
121
119
  ...cookieStore === undefined ? {} : { cookieStore },
122
120
  ...organizationId === undefined ? {} : { organizationId },
@@ -283,10 +281,6 @@ function authHeaders(config) {
283
281
  if (config.apiKey !== undefined) {
284
282
  headers["x-api-key"] = unwrapSecret(config.apiKey);
285
283
  }
286
- if (config.sessionToken !== undefined) {
287
- const token = unwrapSecret(config.sessionToken);
288
- headers.authorization = token.toLowerCase().startsWith("bearer ") ? token : `Bearer ${token}`;
289
- }
290
284
  if (config.organizationId !== undefined) {
291
285
  headers["x-organization-id"] = config.organizationId;
292
286
  }
@@ -322,12 +316,12 @@ async function createDalpAuthClient(input) {
322
316
  if (config.cookie !== undefined) {
323
317
  cookieStore.setCookieHeader(unwrapSecret(config.cookie));
324
318
  }
325
- const credentialCount = [config.apiKey, config.sessionToken, cookieStore.isEmpty() ? undefined : true].filter(Boolean).length;
319
+ const credentialCount = [config.apiKey, cookieStore.isEmpty() ? undefined : true].filter(Boolean).length;
326
320
  if (credentialCount > 1) {
327
321
  throw createDalpSdkConfigurationError2({
328
322
  message: "DALP SDK: configure only one auth credential source.",
329
323
  why: "The auth client received multiple credential types.",
330
- fix: "Use an API key, bearer token, or cookie store, not a combination."
324
+ fix: "Use an API key or a cookie store, not both."
331
325
  });
332
326
  }
333
327
  return createConfiguredBetterAuthClient(config, cookieStore);