@aurabase/auth 0.6.1 → 0.6.2
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/README.md +1 -1
- package/dist/index.cjs +19 -5
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +19 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -279,7 +279,7 @@ Réservé au serveur (clé `service_role`). Deux façons d'y accéder :
|
|
|
279
279
|
// Via le client admin (recommandé)
|
|
280
280
|
import { createAdminClient } from '@aurabase/aurabase-js'
|
|
281
281
|
|
|
282
|
-
const admin = createAdminClient('https://mon-projet.aurabase.cloud', process.env.
|
|
282
|
+
const admin = createAdminClient('https://mon-projet.aurabase.cloud', process.env.AURABASE_SERVICE_ROLE_KEY!)
|
|
283
283
|
await admin.authAdmin.listUsers({ limit: 50 })
|
|
284
284
|
```
|
|
285
285
|
|
package/dist/index.cjs
CHANGED
|
@@ -1125,13 +1125,26 @@ var AuthService = class extends core.BaseService {
|
|
|
1125
1125
|
* applique l'isolation projet native : un token d'un AUTRE projet → 403.
|
|
1126
1126
|
*/
|
|
1127
1127
|
async getUser(jwt) {
|
|
1128
|
+
let res;
|
|
1128
1129
|
if (jwt !== void 0) {
|
|
1129
|
-
|
|
1130
|
+
res = await this.request("GET", `${this.prefix}/user`, void 0, {
|
|
1130
1131
|
authToken: jwt,
|
|
1131
1132
|
skipAuthRefresh: true
|
|
1132
1133
|
});
|
|
1134
|
+
} else {
|
|
1135
|
+
res = await this.request("GET", `${this.prefix}/user`);
|
|
1136
|
+
}
|
|
1137
|
+
if (res.data && typeof res.data === "object") {
|
|
1138
|
+
const userObj = res.data;
|
|
1139
|
+
Object.defineProperty(userObj, "user", {
|
|
1140
|
+
get() {
|
|
1141
|
+
return userObj;
|
|
1142
|
+
},
|
|
1143
|
+
enumerable: false,
|
|
1144
|
+
configurable: true
|
|
1145
|
+
});
|
|
1133
1146
|
}
|
|
1134
|
-
return
|
|
1147
|
+
return res;
|
|
1135
1148
|
}
|
|
1136
1149
|
/**
|
|
1137
1150
|
* Vérifie et décode les claims d'un JWT.
|
|
@@ -1296,9 +1309,10 @@ var AuthService = class extends core.BaseService {
|
|
|
1296
1309
|
return res;
|
|
1297
1310
|
}
|
|
1298
1311
|
// -- Password recovery ------------------------------------------------------
|
|
1299
|
-
/** Envoie un e-mail de réinitialisation du mot de passe. */
|
|
1300
|
-
async resetPasswordForEmail(
|
|
1301
|
-
|
|
1312
|
+
/** Envoie un e-mail de réinitialisation du mot de passe (accepte un email sous forme de chaîne ou un objet PasswordResetRequest). */
|
|
1313
|
+
async resetPasswordForEmail(emailOrReq) {
|
|
1314
|
+
const body = typeof emailOrReq === "string" ? { email: emailOrReq } : emailOrReq;
|
|
1315
|
+
return this.request("POST", `${this.prefix}/forgot-password`, body);
|
|
1302
1316
|
}
|
|
1303
1317
|
/**
|
|
1304
1318
|
* Change le mot de passe de l'utilisateur connecté. Le serveur révoque toutes ses sessions : le SDK vide la session locale et émet `SIGNED_OUT`.
|
package/dist/index.d.cts
CHANGED
|
@@ -381,7 +381,9 @@ declare class AuthService extends BaseService {
|
|
|
381
381
|
* (`skipAuthRefresh`, aucun refresh ni retry-401 sur le store). Le backend
|
|
382
382
|
* applique l'isolation projet native : un token d'un AUTRE projet → 403.
|
|
383
383
|
*/
|
|
384
|
-
getUser(jwt?: string): Promise<AuraResponse<User
|
|
384
|
+
getUser(jwt?: string): Promise<AuraResponse<User & {
|
|
385
|
+
user: User;
|
|
386
|
+
}>>;
|
|
385
387
|
/**
|
|
386
388
|
* Vérifie et décode les claims d'un JWT.
|
|
387
389
|
*
|
|
@@ -420,8 +422,8 @@ declare class AuthService extends BaseService {
|
|
|
420
422
|
* Met à jour l'utilisateur connecté (métadonnées, mot de passe…) et émet `USER_UPDATED`. Un changement d'e-mail ne prend effet qu'après confirmation par `verifyOtp({ type: 'email_change' })`.
|
|
421
423
|
*/
|
|
422
424
|
updateUser(req: UpdateUserRequest): Promise<AuraResponse<User>>;
|
|
423
|
-
/** Envoie un e-mail de réinitialisation du mot de passe. */
|
|
424
|
-
resetPasswordForEmail(
|
|
425
|
+
/** Envoie un e-mail de réinitialisation du mot de passe (accepte un email sous forme de chaîne ou un objet PasswordResetRequest). */
|
|
426
|
+
resetPasswordForEmail(emailOrReq: string | PasswordResetRequest): Promise<AuraResponse<{
|
|
425
427
|
message: string;
|
|
426
428
|
}>>;
|
|
427
429
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -381,7 +381,9 @@ declare class AuthService extends BaseService {
|
|
|
381
381
|
* (`skipAuthRefresh`, aucun refresh ni retry-401 sur le store). Le backend
|
|
382
382
|
* applique l'isolation projet native : un token d'un AUTRE projet → 403.
|
|
383
383
|
*/
|
|
384
|
-
getUser(jwt?: string): Promise<AuraResponse<User
|
|
384
|
+
getUser(jwt?: string): Promise<AuraResponse<User & {
|
|
385
|
+
user: User;
|
|
386
|
+
}>>;
|
|
385
387
|
/**
|
|
386
388
|
* Vérifie et décode les claims d'un JWT.
|
|
387
389
|
*
|
|
@@ -420,8 +422,8 @@ declare class AuthService extends BaseService {
|
|
|
420
422
|
* Met à jour l'utilisateur connecté (métadonnées, mot de passe…) et émet `USER_UPDATED`. Un changement d'e-mail ne prend effet qu'après confirmation par `verifyOtp({ type: 'email_change' })`.
|
|
421
423
|
*/
|
|
422
424
|
updateUser(req: UpdateUserRequest): Promise<AuraResponse<User>>;
|
|
423
|
-
/** Envoie un e-mail de réinitialisation du mot de passe. */
|
|
424
|
-
resetPasswordForEmail(
|
|
425
|
+
/** Envoie un e-mail de réinitialisation du mot de passe (accepte un email sous forme de chaîne ou un objet PasswordResetRequest). */
|
|
426
|
+
resetPasswordForEmail(emailOrReq: string | PasswordResetRequest): Promise<AuraResponse<{
|
|
425
427
|
message: string;
|
|
426
428
|
}>>;
|
|
427
429
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1123,13 +1123,26 @@ var AuthService = class extends BaseService {
|
|
|
1123
1123
|
* applique l'isolation projet native : un token d'un AUTRE projet → 403.
|
|
1124
1124
|
*/
|
|
1125
1125
|
async getUser(jwt) {
|
|
1126
|
+
let res;
|
|
1126
1127
|
if (jwt !== void 0) {
|
|
1127
|
-
|
|
1128
|
+
res = await this.request("GET", `${this.prefix}/user`, void 0, {
|
|
1128
1129
|
authToken: jwt,
|
|
1129
1130
|
skipAuthRefresh: true
|
|
1130
1131
|
});
|
|
1132
|
+
} else {
|
|
1133
|
+
res = await this.request("GET", `${this.prefix}/user`);
|
|
1134
|
+
}
|
|
1135
|
+
if (res.data && typeof res.data === "object") {
|
|
1136
|
+
const userObj = res.data;
|
|
1137
|
+
Object.defineProperty(userObj, "user", {
|
|
1138
|
+
get() {
|
|
1139
|
+
return userObj;
|
|
1140
|
+
},
|
|
1141
|
+
enumerable: false,
|
|
1142
|
+
configurable: true
|
|
1143
|
+
});
|
|
1131
1144
|
}
|
|
1132
|
-
return
|
|
1145
|
+
return res;
|
|
1133
1146
|
}
|
|
1134
1147
|
/**
|
|
1135
1148
|
* Vérifie et décode les claims d'un JWT.
|
|
@@ -1294,9 +1307,10 @@ var AuthService = class extends BaseService {
|
|
|
1294
1307
|
return res;
|
|
1295
1308
|
}
|
|
1296
1309
|
// -- Password recovery ------------------------------------------------------
|
|
1297
|
-
/** Envoie un e-mail de réinitialisation du mot de passe. */
|
|
1298
|
-
async resetPasswordForEmail(
|
|
1299
|
-
|
|
1310
|
+
/** Envoie un e-mail de réinitialisation du mot de passe (accepte un email sous forme de chaîne ou un objet PasswordResetRequest). */
|
|
1311
|
+
async resetPasswordForEmail(emailOrReq) {
|
|
1312
|
+
const body = typeof emailOrReq === "string" ? { email: emailOrReq } : emailOrReq;
|
|
1313
|
+
return this.request("POST", `${this.prefix}/forgot-password`, body);
|
|
1300
1314
|
}
|
|
1301
1315
|
/**
|
|
1302
1316
|
* Change le mot de passe de l'utilisateur connecté. Le serveur révoque toutes ses sessions : le SDK vide la session locale et émet `SIGNED_OUT`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurabase/auth",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Service d'authentification du SDK Aurabase (sessions, OAuth/PKCE, MFA, magic link, OTP, admin)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"author": "Aurabase",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "git+https://github.com/
|
|
34
|
+
"url": "git+https://github.com/Aurabase-cloud/Aurabase.git",
|
|
35
35
|
"directory": "aurabase-js/packages/auth"
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://aurabase.cloud",
|
|
38
38
|
"bugs": {
|
|
39
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/Aurabase-cloud/Aurabase/issues"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"aurabase",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"authentication"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@aurabase/core": "0.6.
|
|
49
|
+
"@aurabase/core": "0.6.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "20.14.15",
|