nodecommons-esm-security 2.1.0 → 2.1.1

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,3 +1,4 @@
1
+ import { CommonsFixedDuration } from 'tscommons-esm-core';
1
2
  import { ICommonsSession } from 'tscommons-esm-session';
2
3
  import { CommonsSessionService } from './commons-session.service.mjs';
3
4
  type TEmptyObject = {
@@ -5,7 +6,7 @@ type TEmptyObject = {
5
6
  };
6
7
  export declare class CommonsSimpleSinglePwSessionService extends CommonsSessionService<TEmptyObject> {
7
8
  private password;
8
- constructor(password: string);
9
+ constructor(password: string, maximumLast?: CommonsFixedDuration);
9
10
  protected isEqual(_a: TEmptyObject, _b: TEmptyObject): boolean;
10
11
  protected isStillValid(_user: TEmptyObject): Promise<boolean>;
11
12
  authenticate(password: string): ICommonsSession<TEmptyObject> | undefined;
@@ -1,8 +1,8 @@
1
1
  import { CommonsSessionService } from './commons-session.service.mjs';
2
2
  export class CommonsSimpleSinglePwSessionService extends CommonsSessionService {
3
3
  password;
4
- constructor(password) {
5
- super(true);
4
+ constructor(password, maximumLast) {
5
+ super(true, maximumLast);
6
6
  this.password = password;
7
7
  }
8
8
  isEqual(_a, _b) {
@@ -1 +1 @@
1
- {"version":3,"file":"commons-simple-single-pw-session.service.mjs","sourceRoot":"","sources":["../../src/services/commons-simple-single-pw-session.service.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAItE,MAAM,OAAO,mCAAoC,SAAQ,qBAAmC;IAEjF;IADV,YACU,QAAgB;QAEzB,KAAK,CAAC,IAAI,CAAC,CAAC;QAFH,aAAQ,GAAR,QAAQ,CAAQ;IAG1B,CAAC;IAES,OAAO,CAAC,EAAgB,EAAE,EAAgB;QACnD,OAAO,IAAI,CAAC;IACb,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,KAAmB;QAC/C,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY,CAAC,QAAgB;QACnC,IAAI,QAAQ,KAAK,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAEjD,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;CACD"}
1
+ {"version":3,"file":"commons-simple-single-pw-session.service.mjs","sourceRoot":"","sources":["../../src/services/commons-simple-single-pw-session.service.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAItE,MAAM,OAAO,mCAAoC,SAAQ,qBAAmC;IAEjF;IADV,YACU,QAAgB,EACxB,WAAkC;QAEnC,KAAK,CACH,IAAI,EACJ,WAAW,CACZ,CAAC;QANO,aAAQ,GAAR,QAAQ,CAAQ;IAO1B,CAAC;IAES,OAAO,CAAC,EAAgB,EAAE,EAAgB;QACnD,OAAO,IAAI,CAAC;IACb,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,KAAmB;QAC/C,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY,CAAC,QAAgB;QACnC,IAAI,QAAQ,KAAK,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAEjD,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;CACD"}
@@ -1,10 +1,11 @@
1
+ import { CommonsFixedDuration } from 'tscommons-esm-core';
1
2
  import { ICommonsSession } from 'tscommons-esm-session';
2
3
  import { ICommonsUserPwHash } from '../interfaces/icommons-user-pw-hash.mjs';
3
4
  import { CommonsUserSessionService } from './commons-user-session.service.mjs';
4
5
  export declare class CommonsUserPwHashSessionService<T extends ICommonsUserPwHash> extends CommonsUserSessionService<T> {
5
6
  private pepper?;
6
7
  static generateSaltAndPepperPwHash(pw: string, salt: string, pepper?: string): string;
7
- constructor(pepper?: string | undefined, allowMultipleSessionsForSameUser?: boolean);
8
+ constructor(pepper?: string | undefined, allowMultipleSessionsForSameUser?: boolean, maximumLast?: CommonsFixedDuration);
8
9
  generatePwHash(pw: string, salt: string): string;
9
10
  authenticateWithPwHash(user: T, pw: string): ICommonsSession<T> | undefined;
10
11
  }
@@ -10,8 +10,8 @@ export class CommonsUserPwHashSessionService extends CommonsUserSessionService {
10
10
  ];
11
11
  return commonsHashSha256(components.join(''));
12
12
  }
13
- constructor(pepper, allowMultipleSessionsForSameUser = false) {
14
- super(allowMultipleSessionsForSameUser);
13
+ constructor(pepper, allowMultipleSessionsForSameUser = false, maximumLast) {
14
+ super(allowMultipleSessionsForSameUser, maximumLast);
15
15
  this.pepper = pepper;
16
16
  }
17
17
  generatePwHash(pw, salt) {
@@ -1 +1 @@
1
- {"version":3,"file":"commons-user-pw-hash-session.service.mjs","sourceRoot":"","sources":["../../src/services/commons-user-pw-hash-session.service.mts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,MAAM,OAAO,+BAA8D,SAAQ,yBAA4B;IAgBpG;IAfH,MAAM,CAAC,2BAA2B,CACvC,EAAU,EACV,IAAY,EACZ,MAAe;QAEhB,MAAM,UAAU,GAAa;YAC3B,IAAI;YACJ,MAAM,IAAI,EAAE;YACZ,EAAE;SACH,CAAC;QAEF,OAAO,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,YACU,MAAe,EACvB,mCAA4C,KAAK;QAElD,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAH/B,WAAM,GAAN,MAAM,CAAS;IAIzB,CAAC;IAEM,cAAc,CAAC,EAAU,EAAE,IAAY;QAC7C,OAAO,+BAA+B,CAAC,2BAA2B,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3F,CAAC;IAEM,sBAAsB,CAAC,IAAO,EAAE,EAAU;QAChD,MAAM,OAAO,GAAW,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3D,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC7B,6DAA6D;YAC7D,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACD"}
1
+ {"version":3,"file":"commons-user-pw-hash-session.service.mjs","sourceRoot":"","sources":["../../src/services/commons-user-pw-hash-session.service.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,MAAM,OAAO,+BAA8D,SAAQ,yBAA4B;IAgBpG;IAfH,MAAM,CAAC,2BAA2B,CACvC,EAAU,EACV,IAAY,EACZ,MAAe;QAEhB,MAAM,UAAU,GAAa;YAC3B,IAAI;YACJ,MAAM,IAAI,EAAE;YACZ,EAAE;SACH,CAAC;QAEF,OAAO,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,YACU,MAAe,EACvB,mCAA4C,KAAK,EACjD,WAAkC;QAEnC,KAAK,CACH,gCAAgC,EAChC,WAAW,CACZ,CAAC;QAPO,WAAM,GAAN,MAAM,CAAS;IAQzB,CAAC;IAEM,cAAc,CAAC,EAAU,EAAE,IAAY;QAC7C,OAAO,+BAA+B,CAAC,2BAA2B,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3F,CAAC;IAEM,sBAAsB,CAAC,IAAO,EAAE,EAAU;QAChD,MAAM,OAAO,GAAW,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3D,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAC7B,6DAA6D;YAC7D,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACD"}
@@ -1,8 +1,9 @@
1
+ import { CommonsFixedDuration } from 'tscommons-esm-core';
1
2
  import { ICommonsSession } from 'tscommons-esm-session';
2
3
  import { ICommonsUser } from 'tscommons-esm-session';
3
4
  import { CommonsSessionService } from './commons-session.service.mjs';
4
5
  export declare abstract class CommonsUserSessionService<T extends ICommonsUser> extends CommonsSessionService<T> {
5
- constructor(allowMultipleSessionsForSameUser?: boolean);
6
+ constructor(allowMultipleSessionsForSameUser?: boolean, maximumLast?: CommonsFixedDuration);
6
7
  protected isEqual(a: T, b: T): boolean;
7
8
  protected isStillValid(user: T): Promise<boolean>;
8
9
  authenticate(user: T): ICommonsSession<T> | undefined;
@@ -1,7 +1,7 @@
1
1
  import { CommonsSessionService } from './commons-session.service.mjs';
2
2
  export class CommonsUserSessionService extends CommonsSessionService {
3
- constructor(allowMultipleSessionsForSameUser = false) {
4
- super(allowMultipleSessionsForSameUser);
3
+ constructor(allowMultipleSessionsForSameUser = false, maximumLast) {
4
+ super(allowMultipleSessionsForSameUser, maximumLast);
5
5
  }
6
6
  isEqual(a, b) {
7
7
  if (a.username !== b.username)
@@ -1 +1 @@
1
- {"version":3,"file":"commons-user-session.service.mjs","sourceRoot":"","sources":["../../src/services/commons-user-session.service.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,OAAgB,yBAAkD,SAAQ,qBAAwB;IACvG,YACE,mCAA4C,KAAK;QAElD,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACzC,CAAC;IAES,OAAO,CAAC,CAAI,EAAE,CAAI;QAC3B,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAE5C,OAAO,IAAI,CAAC;IACb,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAO;QACnC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAEhC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY,CAAC,IAAO;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,yDAAyD;YAEzD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjB,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACD"}
1
+ {"version":3,"file":"commons-user-session.service.mjs","sourceRoot":"","sources":["../../src/services/commons-user-session.service.mts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,OAAgB,yBAAkD,SAAQ,qBAAwB;IACvG,YACE,mCAA4C,KAAK,EACjD,WAAkC;QAEnC,KAAK,CACH,gCAAgC,EAChC,WAAW,CACZ,CAAC;IACH,CAAC;IAES,OAAO,CAAC,CAAI,EAAE,CAAI;QAC3B,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAE5C,OAAO,IAAI,CAAC;IACb,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAO;QACnC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAEhC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,YAAY,CAAC,IAAO;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,yDAAyD;YAEzD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjB,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodecommons-esm-security",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "tsc": "./node_modules/typescript/bin/tsc",