@ollaid/native-sso 1.0.0 → 1.0.3

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.
@@ -21,6 +21,13 @@ export interface NativeAuthConfig {
21
21
  timeout?: number;
22
22
  /** Mode debug (logs console) */
23
23
  debug?: boolean;
24
+ /**
25
+ * Préfixe de configuration IAM côté backend (défaut: 'iam').
26
+ * Permet le multi-tenant : chaque frontend envoie son préfixe
27
+ * pour que le backend SaaS lise le bon bloc config/services.php.
28
+ * Ex: 'iam', 'iam_vendor', 'iam_client', 'iam_admin'
29
+ */
30
+ configPrefix?: string;
24
31
  }
25
32
  export declare const setNativeAuthConfig: (newConfig: Partial<NativeAuthConfig>) => void;
26
33
  export declare const getNativeAuthConfig: () => NativeAuthConfig;
@@ -31,6 +38,7 @@ declare const STORAGE: {
31
38
  readonly TOKEN: "token";
32
39
  readonly USER: "user";
33
40
  readonly ACCOUNT_TYPE: "account_type";
41
+ readonly ALIAS_REFERENCE: "alias_reference";
34
42
  };
35
43
  export declare const setAuthToken: (token: string) => void;
36
44
  export declare const getAuthToken: () => string | null;
@@ -41,7 +49,7 @@ export declare const setAccountType: (type: string) => void;
41
49
  export declare const getAccountType: () => string | null;
42
50
  export { STORAGE as STORAGE_KEYS };
43
51
  export declare function fetchWithTimeout<T>(url: string, options: RequestInit, timeout: number): Promise<T>;
44
- export declare function getHeaders(token?: string): HeadersInit;
52
+ export declare function getHeaders(token?: string, includeConfigPrefix?: boolean): HeadersInit;
45
53
  declare const _default: {
46
54
  getConfig: () => NativeAuthConfig;
47
55
  setConfig: (newConfig: Partial<NativeAuthConfig>) => void;
@@ -8,6 +8,10 @@ import type { NativeAuthType, NativeEncryptRequest, NativeEncryptResponse, Nativ
8
8
  export declare const nativeAuthService: {
9
9
  hasCredentials(): boolean;
10
10
  getCredentials(): NativeCredentials | null;
11
+ getCredentialsTtl(): number;
12
+ getCredentialsAge(): number;
13
+ areCredentialsExpiringSoon(): boolean;
14
+ ensureFreshCredentials(): Promise<void>;
11
15
  loadCredentials(): Promise<NativeCredentials>;
12
16
  encrypt(type: NativeAuthType, data: Partial<NativeEncryptRequest>): Promise<NativeEncryptResponse>;
13
17
  init(nativeToken: string): Promise<NativeInitResponse>;
@@ -32,6 +32,7 @@ export interface NativeConfigResponse {
32
32
  app_key: string;
33
33
  encrypted_credentials: string;
34
34
  debug?: boolean;
35
+ credentials_ttl?: number;
35
36
  }
36
37
  export interface NativeEncryptResponse {
37
38
  success: boolean;
@@ -139,6 +140,8 @@ export interface NativeUser {
139
140
  country?: string;
140
141
  address?: string;
141
142
  auth_2fa?: boolean;
143
+ alias_reference?: string;
144
+ iam_reference?: string;
142
145
  }
143
146
  export interface NativeExchangeResponse {
144
147
  success: boolean;
@@ -151,6 +154,8 @@ export interface NativeExchangeResponse {
151
154
  expires_at: string;
152
155
  user: NativeUser;
153
156
  user_infos?: UserInfos;
157
+ /** Alias reference retournée au niveau racine par certains backends SaaS */
158
+ alias_reference?: string;
154
159
  }
155
160
  export interface CheckTokenResponse {
156
161
  success: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ollaid/native-sso",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Package NPM fullstack pour l'authentification Native SSO Ollaid - Frontend-First",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",