@camstack/core 0.1.35 → 0.1.36

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.
@@ -1 +1 @@
1
- {"version":3,"file":"local-auth.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/local-auth/local-auth.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAA2B,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACpF,OAAO,EAAE,SAAS,EAAoD,MAAM,iBAAiB,CAAA;AA6B7F,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,qBAAa,cAAe,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,WAAW,CAA2B;;cAI9B,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;cAiQ/C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5C;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"local-auth.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/local-auth/local-auth.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAA2B,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACpF,OAAO,EAAE,SAAS,EAAoD,MAAM,iBAAiB,CAAA;AA6B7F,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,qBAAa,cAAe,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,WAAW,CAA2B;;cAI9B,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;cAgR/C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5C;AAED,eAAe,cAAc,CAAA"}
@@ -7783,12 +7783,24 @@ var LocalAuthAddon = class extends _camstack_types.BaseAddon {
7783
7783
  const userMgmt = {
7784
7784
  listUsers: async () => {
7785
7785
  if (!this.userManager) return [];
7786
- return this.userManager.listAll();
7786
+ const users = await this.userManager.listAll();
7787
+ if (!this.totpManager) return users.map((u) => ({
7788
+ ...u,
7789
+ totpEnabled: false
7790
+ }));
7791
+ const statuses = await Promise.all(users.map((u) => this.totpManager.getStatus(u.id).catch(() => ({ enabled: false }))));
7792
+ return users.map((u, i) => ({
7793
+ ...u,
7794
+ totpEnabled: statuses[i]?.enabled ?? false
7795
+ }));
7787
7796
  },
7788
7797
  createUser: async (input) => {
7789
7798
  if (!this.userManager) throw new Error("User management not available");
7790
7799
  const { passwordHash: _, ...summary } = await this.userManager.create(input);
7791
- return summary;
7800
+ return {
7801
+ ...summary,
7802
+ totpEnabled: false
7803
+ };
7792
7804
  },
7793
7805
  updateUser: async (input) => {
7794
7806
  if (!this.userManager) throw new Error("User management not available");
@@ -7813,7 +7825,13 @@ var LocalAuthAddon = class extends _camstack_types.BaseAddon {
7813
7825
  },
7814
7826
  validateCredentials: async (input) => {
7815
7827
  if (!this.userManager) return null;
7816
- return await this.userManager.validateCredentials(input.username, input.password) ?? null;
7828
+ const user = await this.userManager.validateCredentials(input.username, input.password);
7829
+ if (!user) return null;
7830
+ const totpEnabled = this.totpManager ? (await this.totpManager.getStatus(user.id).catch(() => ({ enabled: false }))).enabled : false;
7831
+ return {
7832
+ ...user,
7833
+ totpEnabled
7834
+ };
7817
7835
  },
7818
7836
  listApiKeys: async () => {
7819
7837
  if (!this.apiKeyManager) return [];