@coreiam/auth 1.0.392-beta.3 → 1.0.392-beta.5
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/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +7 -0
- package/dist/nextjs/actions.d.ts +1 -0
- package/dist/nextjs/actions.js +11 -0
- package/package.json +14 -6
package/dist/core/index.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ export declare class CoreIAM {
|
|
|
136
136
|
loginWithCsrfProtection(identifier: string, password: string, incomingHeaders: Headers): Promise<Response>;
|
|
137
137
|
registerWithCsrfProtection(userData: any, incomingHeaders: Headers): Promise<Response>;
|
|
138
138
|
updateProfile(updateData: any, incomingHeaders: Headers): Promise<Response>;
|
|
139
|
+
changePassword(currentPassword: string, newPassword: string, incomingHeaders: Headers): Promise<Response>;
|
|
139
140
|
setupMfa(incomingHeaders: Headers): Promise<Response>;
|
|
140
141
|
verifyMfa(token: string, incomingHeaders: Headers): Promise<Response>;
|
|
141
142
|
disableMfa(incomingHeaders: Headers): Promise<Response>;
|
package/dist/core/index.js
CHANGED
|
@@ -365,6 +365,13 @@ class CoreIAM {
|
|
|
365
365
|
body: JSON.stringify(updateData),
|
|
366
366
|
}, incomingHeaders);
|
|
367
367
|
}
|
|
368
|
+
async changePassword(currentPassword, newPassword, incomingHeaders) {
|
|
369
|
+
return this.proxyWithCsrfProtection('/auth/password', {
|
|
370
|
+
method: 'PUT',
|
|
371
|
+
headers: { 'Content-Type': 'application/json' },
|
|
372
|
+
body: JSON.stringify({ currentPassword, newPassword }),
|
|
373
|
+
}, incomingHeaders);
|
|
374
|
+
}
|
|
368
375
|
async setupMfa(incomingHeaders) {
|
|
369
376
|
return this.proxyWithCsrfProtection('/auth/mfa/setup', { method: 'POST' }, incomingHeaders);
|
|
370
377
|
}
|
package/dist/nextjs/actions.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare function loginActionSdk(identifier: string, password: string): Pr
|
|
|
9
9
|
export declare function registerActionSdk(userData: any): Promise<AuthResult>;
|
|
10
10
|
export declare function logoutActionSdk(): Promise<AuthResult>;
|
|
11
11
|
export declare function updateProfileActionSdk(updateData: Record<string, any>): Promise<AuthResult>;
|
|
12
|
+
export declare function changePasswordActionSdk(currentPassword: string, newPassword: string): Promise<AuthResult>;
|
|
12
13
|
export declare function setupMfaActionSdk(): Promise<AuthResult>;
|
|
13
14
|
export declare function verifyMfaActionSdk(token: string): Promise<AuthResult>;
|
|
14
15
|
export declare function disableMfaActionSdk(): Promise<AuthResult>;
|
package/dist/nextjs/actions.js
CHANGED
|
@@ -99,6 +99,7 @@ exports.loginActionSdk = loginActionSdk;
|
|
|
99
99
|
exports.registerActionSdk = registerActionSdk;
|
|
100
100
|
exports.logoutActionSdk = logoutActionSdk;
|
|
101
101
|
exports.updateProfileActionSdk = updateProfileActionSdk;
|
|
102
|
+
exports.changePasswordActionSdk = changePasswordActionSdk;
|
|
102
103
|
exports.setupMfaActionSdk = setupMfaActionSdk;
|
|
103
104
|
exports.verifyMfaActionSdk = verifyMfaActionSdk;
|
|
104
105
|
exports.disableMfaActionSdk = disableMfaActionSdk;
|
|
@@ -291,6 +292,16 @@ async function updateProfileActionSdk(updateData) {
|
|
|
291
292
|
return { ok: false, status: 500, data: { error: 'Profile update failed' } };
|
|
292
293
|
}
|
|
293
294
|
}
|
|
295
|
+
async function changePasswordActionSdk(currentPassword, newPassword) {
|
|
296
|
+
const reqHeaders = await (0, headers_1.headers)();
|
|
297
|
+
try {
|
|
298
|
+
const response = await getIam().changePassword(currentPassword, newPassword, reqHeaders);
|
|
299
|
+
return { ok: response.ok, status: response.status, data: await response.json().catch(() => ({})) };
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
return { ok: false, status: 500, data: { error: 'Password change failed' } };
|
|
303
|
+
}
|
|
304
|
+
}
|
|
294
305
|
async function setupMfaActionSdk() {
|
|
295
306
|
const reqHeaders = await (0, headers_1.headers)();
|
|
296
307
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreiam/auth",
|
|
3
|
-
"version": "1.0.392-beta.
|
|
3
|
+
"version": "1.0.392-beta.5",
|
|
4
4
|
"main": "./dist/core/index.js",
|
|
5
5
|
"types": "./dist/core/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -23,6 +23,16 @@
|
|
|
23
23
|
"types": "./dist/express/index.d.ts",
|
|
24
24
|
"import": "./dist/express/index.js",
|
|
25
25
|
"require": "./dist/express/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./hono": {
|
|
28
|
+
"types": "./dist/hono/index.d.ts",
|
|
29
|
+
"import": "./dist/hono/index.js",
|
|
30
|
+
"require": "./dist/hono/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./ui": {
|
|
33
|
+
"types": "./dist/ui/buttons.d.ts",
|
|
34
|
+
"import": "./dist/ui/buttons.js",
|
|
35
|
+
"require": "./dist/ui/buttons.js"
|
|
26
36
|
}
|
|
27
37
|
},
|
|
28
38
|
"files": [
|
|
@@ -43,13 +53,11 @@
|
|
|
43
53
|
"vite",
|
|
44
54
|
"express"
|
|
45
55
|
],
|
|
46
|
-
"author": "
|
|
56
|
+
"author": "coreiam",
|
|
47
57
|
"license": "MIT",
|
|
48
58
|
"publishConfig": {
|
|
49
59
|
"access": "public"
|
|
50
60
|
},
|
|
51
|
-
"./hono": { "types": "./dist/hono/index.d.ts", "import": "./dist/hono/index.js", "require": "./dist/hono/index.js" },
|
|
52
|
-
"./ui": { "types": "./dist/ui/buttons.d.ts", "import": "./dist/ui/buttons.js", "require": "./dist/ui/buttons.js" },
|
|
53
61
|
"peerDependencies": {
|
|
54
62
|
"express": "^4.0.0 || ^5.0.0",
|
|
55
63
|
"next": ">=14",
|
|
@@ -66,8 +74,8 @@
|
|
|
66
74
|
"express": {
|
|
67
75
|
"optional": true
|
|
68
76
|
},
|
|
69
|
-
"hono": {
|
|
70
|
-
"optional": true
|
|
77
|
+
"hono": {
|
|
78
|
+
"optional": true
|
|
71
79
|
}
|
|
72
80
|
},
|
|
73
81
|
"devDependencies": {
|