@coreiam/auth 1.0.392-beta.4 → 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.
@@ -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>;
@@ -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
  }
@@ -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>;
@@ -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.4",
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": {