@ollaid/native-sso 2.1.5 → 2.5.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.
@@ -2,7 +2,7 @@
2
2
  * NativeSSOProvider — React Context pour @ollaid/native-sso
3
3
  * Centralise la configuration pour les hooks et composants individuels
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.5.0
6
6
  */
7
7
  import { type ReactNode } from 'react';
8
8
  export interface NativeSSOConfig {
@@ -2,7 +2,7 @@
2
2
  * Client API pour @ollaid/native-sso
3
3
  * Gestion des requêtes HTTP avec timeout, device ID, token storage
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.5.0
6
6
  */
7
7
  export type ApiErrorType = 'network' | 'timeout' | 'server' | 'validation' | 'auth' | 'unknown';
8
8
  export declare class ApiError extends Error {
@@ -32,7 +32,16 @@ export interface NativeAuthConfig {
32
32
  export declare const setNativeAuthConfig: (newConfig: Partial<NativeAuthConfig>) => void;
33
33
  export declare const getNativeAuthConfig: () => NativeAuthConfig;
34
34
  export declare const isDebugMode: () => boolean;
35
+ export declare const getSaasApiBaseUrl: () => string;
36
+ export declare const getIamApiBaseUrl: () => string;
35
37
  export declare const getDeviceId: () => string;
38
+ /**
39
+ * Stable session UUID (instance id) persisted in localStorage.
40
+ *
41
+ * This is NOT a security token. It is used to disambiguate sessions across devices/webviews
42
+ * and to help backends implement multi-session behavior safely.
43
+ */
44
+ export declare const getSessionUuid: () => string;
36
45
  declare const STORAGE: {
37
46
  readonly AUTH_TOKEN: "auth_token";
38
47
  readonly TOKEN: "token";
@@ -40,6 +49,14 @@ declare const STORAGE: {
40
49
  readonly ACCOUNT_TYPE: "account_type";
41
50
  readonly ALIAS_REFERENCE: "alias_reference";
42
51
  readonly APP_ACCESS_TOKEN_REF: "app_access_token_ref";
52
+ readonly REFRESH_TOKEN: "refresh_token";
53
+ readonly TOKEN_EXPIRES_AT: "token_expires_at";
54
+ readonly REFRESH_EXPIRES_AT: "refresh_expires_at";
55
+ };
56
+ declare const PROFILE_STORAGE: {
57
+ readonly IMAGE_LAST_STATUS: "sso_image_last_status";
58
+ readonly IMAGE_LAST_CHECK: "sso_image_last_check";
59
+ readonly IMAGE_RECHECK_AT: "sso_image_recheck_at";
43
60
  };
44
61
  export declare const setAuthToken: (token: string) => void;
45
62
  export declare const getAuthToken: () => string | null;
@@ -74,6 +91,16 @@ export declare const getAuthUser: <T>() => T | null;
74
91
  export declare const setAccountType: (type: string) => void;
75
92
  export declare const getAccountType: () => string | null;
76
93
  export { STORAGE as STORAGE_KEYS };
94
+ export { PROFILE_STORAGE as PROFILE_PROMPT_KEYS };
95
+ export interface ProfilePromptState {
96
+ lastStatus: boolean | null;
97
+ lastCheckAt: number | null;
98
+ recheckAt: number | null;
99
+ }
100
+ export declare function getProfilePromptState(): ProfilePromptState;
101
+ export declare function setProfilePromptState(status: boolean, recheckAt?: number | null): void;
102
+ export declare function markProfilePromptComplete(): void;
103
+ export declare function snoozeProfilePrompt(hours?: number): void;
77
104
  export declare function fetchWithTimeout<T>(url: string, options: RequestInit, timeout: number): Promise<T>;
78
105
  export declare function getHeaders(token?: string, includeConfigPrefix?: boolean): HeadersInit;
79
106
  declare const _default: {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Debug Logger pour @ollaid/native-sso
3
3
  * Stocke l'historique des appels API en mémoire pour le DebugPanel
4
- * @version 2.1.4
4
+ * @version 2.5.0
5
5
  */
6
6
  export interface ApiCallLog {
7
7
  id: string;
@@ -8,7 +8,7 @@
8
8
  * Ne JAMAIS appeler ces méthodes depuis du code frontend/navigateur car la
9
9
  * secret_key serait exposée dans les DevTools réseau.
10
10
  *
11
- * @version 2.1.4
11
+ * @version 2.5.0
12
12
  */
13
13
  import type { LinkPhoneRequest, LinkPhoneResponse, LinkEmailRequest, LinkEmailResponse, RefreshUserInfoSingleRequest, RefreshUserInfoSingleResponse, RefreshUserInfoBulkRequest, RefreshUserInfoBulkResponse, UpdateAvatarRequest, UpdateAvatarResponse, ResetAvatarRequest, ResetAvatarResponse } from '../types/native';
14
14
  export declare const iamAccountService: {
@@ -2,7 +2,7 @@
2
2
  * Service de récupération de mot de passe v1.0
3
3
  * Architecture Frontend-First : Appels directs à l'IAM
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.5.0
6
6
  */
7
7
  import { ApiError } from './api';
8
8
  import type { MobilePasswordInitResponse, MobilePasswordSelectMethodResponse, MobilePasswordResetResponse, MobilePasswordResendResponse } from '../types/mobile';
@@ -2,7 +2,7 @@
2
2
  * Service d'inscription Mobile SSO v1.0
3
3
  * Architecture Frontend-First : Appels directs à l'IAM via nativeAuth
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.5.0
6
6
  */
7
7
  import type { MobileRegistrationFormData, MobileVerifyOtpResponse, MobileRegistrationCompleteResponse, MobileResendOtpResponse } from '../types/mobile';
8
8
  import type { NativeInitResponse } from '../types/native';
@@ -2,9 +2,9 @@
2
2
  * Service d'authentification Native Mobile SSO v1.0
3
3
  * Architecture Frontend-First : Direct IAM après encryption
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.5.0
6
6
  */
7
- import type { NativeAuthType, NativeEncryptRequest, NativeEncryptResponse, NativeInitResponse, NativeValidateResponse, NativeGrantAccessResponse, NativeResendOtpResponse, NativeExchangeResponse, NativeCredentials } from '../types/native';
7
+ import type { NativeAuthType, NativeEncryptRequest, NativeEncryptResponse, NativeInitResponse, NativeValidateResponse, NativeGrantAccessResponse, NativeResendOtpResponse, NativeExchangeResponse, NativeCredentials, NativeRefreshResponse } from '../types/native';
8
8
  export declare const nativeAuthService: {
9
9
  hasCredentials(): boolean;
10
10
  getCredentials(): NativeCredentials | null;
@@ -27,6 +27,7 @@ export declare const nativeAuthService: {
27
27
  valid: boolean;
28
28
  user?: import("../types/native").UserInfos;
29
29
  }>;
30
+ refresh(): Promise<NativeRefreshResponse>;
30
31
  logout(token?: string): Promise<{
31
32
  success: boolean;
32
33
  }>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Profile service for @ollaid/native-sso
3
+ * Updates the authenticated profile fields via IAM.
4
+ *
5
+ * @version 2.5.0
6
+ */
7
+ import type { UserInfos } from '../types/native';
8
+ export interface ProfileUpdateRequest {
9
+ name?: string;
10
+ ccphone?: string;
11
+ phone?: string;
12
+ email?: string;
13
+ address?: string;
14
+ town?: string;
15
+ country?: string;
16
+ }
17
+ export interface ProfileUpdateResponse {
18
+ message?: string;
19
+ user?: UserInfos;
20
+ user_infos?: UserInfos;
21
+ }
22
+ export interface ProfileFetchResponse {
23
+ message?: string;
24
+ user?: UserInfos;
25
+ user_infos?: UserInfos;
26
+ }
27
+ export declare const profileService: {
28
+ getProfile(): Promise<ProfileFetchResponse>;
29
+ updateProfile(data: ProfileUpdateRequest): Promise<ProfileUpdateResponse>;
30
+ };
31
+ export default profileService;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Profile change service for @ollaid/native-sso
3
+ * Uses authenticated IAM endpoints for email / phone change with OTP confirmation.
4
+ *
5
+ * @version 2.5.0
6
+ */
7
+ export type ProfileChangeKind = 'email' | 'phone';
8
+ export type ProfileChangeMethod = 'email' | 'phone';
9
+ export interface ProfileChangeRequestResponse {
10
+ success: boolean;
11
+ message?: string;
12
+ request_id?: number;
13
+ method?: ProfileChangeMethod;
14
+ otp_dev?: string | null;
15
+ }
16
+ export interface ProfileChangeVerifyResponse {
17
+ success: boolean;
18
+ message?: string;
19
+ step?: 'pending_new_otp' | 'completed' | string;
20
+ user?: unknown;
21
+ }
22
+ export declare const profileChangeService: {
23
+ requestEmailChange(newEmail: string, method?: ProfileChangeMethod): Promise<ProfileChangeRequestResponse>;
24
+ requestPhoneChange(ccphone: string, phone: string, method?: ProfileChangeMethod): Promise<ProfileChangeRequestResponse>;
25
+ verifyOldOTP(requestId: number, otpCode: string): Promise<ProfileChangeVerifyResponse>;
26
+ verifyNewOTP(requestId: number, otpCode: string): Promise<ProfileChangeVerifyResponse>;
27
+ resendOTP(requestId: number): Promise<ProfileChangeRequestResponse>;
28
+ switchMethod(requestId: number, method: ProfileChangeMethod): Promise<ProfileChangeRequestResponse>;
29
+ };
30
+ export default profileChangeService;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Profile media service for @ollaid/native-sso
3
+ * Uploads the cropped avatar to the IAM authenticated profile endpoint.
4
+ *
5
+ * @version 2.5.0
6
+ */
7
+ import type { UserInfos } from '../types/native';
8
+ export interface ProfileImageUploadResponse {
9
+ message?: string;
10
+ user?: UserInfos;
11
+ user_infos?: UserInfos;
12
+ }
13
+ export declare const profileMediaService: {
14
+ uploadProfileImage(image: Blob, filename?: string): Promise<ProfileImageUploadResponse>;
15
+ };
16
+ export default profileMediaService;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Types pour le password recovery et registration Mobile SSO v1.0
3
3
  *
4
- * @version 2.1.4
4
+ * @version 2.5.0
5
5
  */
6
6
  export type MobilePasswordStatus = 'idle' | 'choice_required' | 'pending_otp' | 'pending_password' | 'completed';
7
7
  export interface MobilePasswordState {
@@ -2,7 +2,7 @@
2
2
  * Types pour l'authentification Native SSO v1.0
3
3
  * Architecture Frontend-First avec encryption directe
4
4
  *
5
- * @version 2.1.4
5
+ * @version 2.5.0
6
6
  */
7
7
  export type NativeAuthType = 'login_email' | 'login_phone' | 'login_access_otp' | 'register' | 'recovery_password';
8
8
  export type AccountType = 'email' | 'phone-only';
@@ -152,6 +152,10 @@ export interface NativeExchangeResponse {
152
152
  token: string;
153
153
  auth_token?: string;
154
154
  expires_at: string;
155
+ /** Refresh token (optional until all SaaS backends implement it) */
156
+ refresh_token?: string;
157
+ /** Refresh expiration timestamp */
158
+ refresh_expires_at?: string;
155
159
  user: NativeUser;
156
160
  user_infos?: UserInfos;
157
161
  /** Alias reference retournée au niveau racine par certains backends SaaS */
@@ -159,6 +163,20 @@ export interface NativeExchangeResponse {
159
163
  /** Référence AppAccessToken IAM liée au token Sanctum (pour revocation rapide) */
160
164
  app_access_token_ref?: string;
161
165
  }
166
+ export interface NativeRefreshResponse {
167
+ success: boolean;
168
+ message?: string;
169
+ error_type?: string;
170
+ token?: string;
171
+ expires_at?: string;
172
+ refresh_token?: string;
173
+ refresh_expires_at?: string;
174
+ user?: NativeUser | UserInfos;
175
+ /** Référence AppAccessToken IAM liée au token Sanctum (pour revocation rapide) */
176
+ app_access_token_ref?: string;
177
+ /** Alias reference optionnelle */
178
+ alias_reference?: string;
179
+ }
162
180
  export interface CheckTokenResponse {
163
181
  status?: string;
164
182
  success?: boolean;
@@ -201,6 +219,7 @@ export interface NativeAuthState {
201
219
  otpSentTo?: string | null;
202
220
  }
203
221
  export interface UserInfos {
222
+ reference?: string;
204
223
  name: string;
205
224
  email: string | null;
206
225
  ccphone?: string;
@@ -209,7 +228,10 @@ export interface UserInfos {
209
228
  town?: string;
210
229
  country?: string;
211
230
  image_url?: string;
231
+ image?: string;
212
232
  auth_2fa?: boolean;
233
+ alias_reference?: string;
234
+ iam_reference?: string;
213
235
  }
214
236
  export interface LinkPhoneRequest {
215
237
  app_key: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ollaid/native-sso",
3
- "version": "2.1.5",
4
- "description": "Package NPM fullstack pour l'authentification Native SSO Ollaid - Frontend-First",
3
+ "version": "2.5.0",
4
+ "description": "Package NPM fullstack pour l'authentification Native SSO Ollaid - Frontend-First (Link APIs & Refresh support)",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",