node-opcua-role-set-common 2.174.0 → 2.175.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,5 +1,20 @@
1
+ /**
2
+ * @module node-opcua-role-set-common
3
+ *
4
+ * User management store (OPC 10000-18 §5) — provides the local user list and
5
+ * password lifecycle used by the `UserName` identity criteria.
6
+ *
7
+ * The store implements the behaviour of the AddUser / ModifyUser / RemoveUser
8
+ * / ChangePassword Methods and the password policy (PasswordLength range and
9
+ * the password-option requirements). Passwords are never stored in clear: each
10
+ * is kept as a self-describing PHC credential string (scrypt by default; other
11
+ * schemes such as bcrypt coexist and are migrated on login — see
12
+ * {@link HasherRegistry}). Credential operations are **async** so an external
13
+ * verifier (LDAP/argon2) can be plugged in without another interface change.
14
+ */
1
15
  import { type StatusCode } from "node-opcua-status-code";
2
16
  import { UserConfigurationMask } from "node-opcua-types";
17
+ import { type HasherRegistry } from "./password_hasher.js";
3
18
  /**
4
19
  * Password requirements (OPC 10000-18 §5.2.1-2: PasswordLength range and
5
20
  * PasswordOptionsMask). A length of 0 means "no limit".
@@ -19,10 +34,24 @@ export interface UserRecord {
19
34
  description: string;
20
35
  }
21
36
  /**
22
- * Persisted user record — includes the salted scrypt hash (base64), never the
23
- * clear password. Suitable for storing in the consolidated archive.
37
+ * Persisted user record (archive v2) — the credential is a self-describing PHC
38
+ * string (e.g. `$scrypt$…` / `$2b$…`), never a clear password. Suitable for
39
+ * storing in the consolidated archive.
24
40
  */
25
41
  export interface SerializedUserRecord {
42
+ userName: string;
43
+ /** PHC / modular-crypt credential string (scheme self-described by its prefix). */
44
+ credential: string;
45
+ userConfiguration: UserConfigurationMask;
46
+ description: string;
47
+ }
48
+ /**
49
+ * Legacy (archive v1) persisted record — raw scrypt `salt`+`hash` (base64).
50
+ * Accepted by {@link IUserManagementStore.importUsers} and read-migrated to a
51
+ * `$scrypt$…` {@link SerializedUserRecord} credential, so old archives keep
52
+ * working with **no forced password resets**.
53
+ */
54
+ export interface LegacySerializedUserRecord {
26
55
  userName: string;
27
56
  salt: string;
28
57
  hash: string;
@@ -45,18 +74,48 @@ export interface ModifyUserOptions {
45
74
  description?: string;
46
75
  }
47
76
  export interface IUserManagementStore {
48
- addUser(userName: string, password: string, userConfiguration: UserConfigurationMask, description: string): StatusCode;
49
- modifyUser(userName: string, options: ModifyUserOptions, callerUserName?: string): StatusCode;
77
+ addUser(userName: string, password: string, userConfiguration: UserConfigurationMask, description: string): Promise<StatusCode>;
78
+ modifyUser(userName: string, options: ModifyUserOptions, callerUserName?: string): Promise<StatusCode>;
50
79
  removeUser(userName: string, callerUserName?: string): StatusCode;
51
- changePassword(userName: string, oldPassword: string, newPassword: string): StatusCode;
52
- authenticate(userName: string, password: string): AuthenticationResult;
80
+ changePassword(userName: string, oldPassword: string, newPassword: string): Promise<StatusCode>;
81
+ authenticate(userName: string, password: string): Promise<AuthenticationResult>;
53
82
  getUsers(): UserRecord[];
54
83
  hasUser(userName: string): boolean;
55
- /** Export every user (with salted hash) for persistence. Optional: only stores that support persistence. */
84
+ /** Export every user (with its PHC credential) for persistence. Optional: only stores that support persistence. */
56
85
  exportUsers?(): SerializedUserRecord[];
57
- /** Load persisted users (with salted hash), replacing any existing entry of the same name. */
58
- importUsers?(records: SerializedUserRecord[]): void;
86
+ /** Load persisted users (v2 credential or legacy v1 salt+hash), replacing any existing entry of the same name. */
87
+ importUsers?(records: readonly (SerializedUserRecord | LegacySerializedUserRecord)[]): void;
88
+ /**
89
+ * Optional: register a callback fired when a credential is transparently
90
+ * re-hashed during {@link authenticate} (upgrade-on-login), so a persistence
91
+ * layer can flush the new hash.
92
+ */
93
+ setOnCredentialUpgraded?(fn: (userName: string) => void): void;
59
94
  }
95
+ /**
96
+ * Produce a {@link SerializedUserRecord} (scrypt PHC credential) from a
97
+ * clear-text password — **offline**, without a store.
98
+ *
99
+ * Use this to keep clear-text passwords out of version control / config: run it
100
+ * once at deploy time and commit only the returned record, then seed it through
101
+ * `importUsers` (or `createRoleBasedSecurity`'s `passwordHash`). The record is
102
+ * interchangeable with what {@link InMemoryUserManagementStore.exportUsers}
103
+ * produces, so `authenticate` accepts the original clear-text password.
104
+ */
105
+ export declare function serializeUser(userName: string, password: string, options?: {
106
+ userConfiguration?: UserConfigurationMask;
107
+ description?: string;
108
+ }): Promise<SerializedUserRecord>;
109
+ /**
110
+ * Wrap an **already-hashed** PHC credential string (e.g. a legacy `$2b$…`
111
+ * bcrypt hash) into a {@link SerializedUserRecord} — no clear text, no
112
+ * re-hashing. The credential is verified by whichever registered scheme owns
113
+ * its prefix, and (for non-default schemes) upgraded on next login.
114
+ */
115
+ export declare function credentialRecord(userName: string, credential: string, options?: {
116
+ userConfiguration?: UserConfigurationMask;
117
+ description?: string;
118
+ }): SerializedUserRecord;
60
119
  /**
61
120
  * In-memory implementation of {@link IUserManagementStore}.
62
121
  *
@@ -65,19 +124,29 @@ export interface IUserManagementStore {
65
124
  export declare class InMemoryUserManagementStore implements IUserManagementStore {
66
125
  private readonly _users;
67
126
  private readonly _policy;
68
- constructor(policy?: PasswordPolicy);
127
+ private readonly _registry;
128
+ private _onCredentialUpgraded?;
129
+ constructor(policy?: PasswordPolicy, options?: {
130
+ registry?: HasherRegistry;
131
+ });
69
132
  get policy(): PasswordPolicy;
133
+ setOnCredentialUpgraded(fn: (userName: string) => void): void;
70
134
  hasUser(userName: string): boolean;
71
135
  getUsers(): UserRecord[];
72
136
  exportUsers(): SerializedUserRecord[];
73
- importUsers(records: SerializedUserRecord[]): void;
74
- addUser(userName: string, password: string, userConfiguration: UserConfigurationMask, description: string): StatusCode;
75
- modifyUser(userName: string, options: ModifyUserOptions, callerUserName?: string): StatusCode;
137
+ importUsers(records: readonly (SerializedUserRecord | LegacySerializedUserRecord)[]): void;
138
+ addUser(userName: string, password: string, userConfiguration: UserConfigurationMask, description: string): Promise<StatusCode>;
139
+ modifyUser(userName: string, options: ModifyUserOptions, callerUserName?: string): Promise<StatusCode>;
76
140
  removeUser(userName: string, callerUserName?: string): StatusCode;
77
- changePassword(userName: string, oldPassword: string, newPassword: string): StatusCode;
78
- authenticate(userName: string, password: string): AuthenticationResult;
141
+ changePassword(userName: string, oldPassword: string, newPassword: string): Promise<StatusCode>;
142
+ authenticate(userName: string, password: string): Promise<AuthenticationResult>;
79
143
  /** Validate a candidate password against the configured policy. */
80
144
  isPasswordValid(password: string): boolean;
81
- private hashPassword;
82
- private verify;
83
145
  }
146
+ /**
147
+ * Validate a UserConfigurationMask combination (OPC 10000-18 §5.2.3):
148
+ * MustChangePassword is invalid when NoChangeByUser is also set.
149
+ *
150
+ * @returns a `Bad_ConfigurationError` StatusCode, or `null` if valid.
151
+ */
152
+ export declare function validateUserConfiguration(mask: UserConfigurationMask): StatusCode | null;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InMemoryUserManagementStore = void 0;
4
+ exports.serializeUser = serializeUser;
5
+ exports.credentialRecord = credentialRecord;
6
+ exports.validateUserConfiguration = validateUserConfiguration;
4
7
  /**
5
8
  * @module node-opcua-role-set-common
6
9
  *
@@ -9,13 +12,54 @@ exports.InMemoryUserManagementStore = void 0;
9
12
  *
10
13
  * The store implements the behaviour of the AddUser / ModifyUser / RemoveUser
11
14
  * / ChangePassword Methods and the password policy (PasswordLength range and
12
- * the password-option requirements). Passwords are never stored in clear:
13
- * each is salted and hashed with scrypt.
15
+ * the password-option requirements). Passwords are never stored in clear: each
16
+ * is kept as a self-describing PHC credential string (scrypt by default; other
17
+ * schemes such as bcrypt coexist and are migrated on login — see
18
+ * {@link HasherRegistry}). Credential operations are **async** so an external
19
+ * verifier (LDAP/argon2) can be plugged in without another interface change.
14
20
  */
15
- const node_crypto_1 = require("node:crypto");
16
21
  const node_opcua_status_code_1 = require("node-opcua-status-code");
17
22
  const node_opcua_types_1 = require("node-opcua-types");
23
+ const password_hasher_js_1 = require("./password_hasher.js");
18
24
  const has = (mask, bit) => (mask & bit) === bit;
25
+ /** A record is legacy (v1) when it carries raw `salt`+`hash` instead of a `credential`. */
26
+ function isLegacyRecord(r) {
27
+ return typeof r.credential !== "string";
28
+ }
29
+ /** Shared default scrypt hasher used by the offline {@link serializeUser} helper. */
30
+ const offlineScrypt = new password_hasher_js_1.ScryptHasher();
31
+ /**
32
+ * Produce a {@link SerializedUserRecord} (scrypt PHC credential) from a
33
+ * clear-text password — **offline**, without a store.
34
+ *
35
+ * Use this to keep clear-text passwords out of version control / config: run it
36
+ * once at deploy time and commit only the returned record, then seed it through
37
+ * `importUsers` (or `createRoleBasedSecurity`'s `passwordHash`). The record is
38
+ * interchangeable with what {@link InMemoryUserManagementStore.exportUsers}
39
+ * produces, so `authenticate` accepts the original clear-text password.
40
+ */
41
+ async function serializeUser(userName, password, options) {
42
+ return {
43
+ userName,
44
+ credential: await offlineScrypt.hash(password),
45
+ userConfiguration: options?.userConfiguration ?? node_opcua_types_1.UserConfigurationMask.None,
46
+ description: options?.description ?? ""
47
+ };
48
+ }
49
+ /**
50
+ * Wrap an **already-hashed** PHC credential string (e.g. a legacy `$2b$…`
51
+ * bcrypt hash) into a {@link SerializedUserRecord} — no clear text, no
52
+ * re-hashing. The credential is verified by whichever registered scheme owns
53
+ * its prefix, and (for non-default schemes) upgraded on next login.
54
+ */
55
+ function credentialRecord(userName, credential, options) {
56
+ return {
57
+ userName,
58
+ credential,
59
+ userConfiguration: options?.userConfiguration ?? node_opcua_types_1.UserConfigurationMask.None,
60
+ description: options?.description ?? ""
61
+ };
62
+ }
19
63
  /**
20
64
  * In-memory implementation of {@link IUserManagementStore}.
21
65
  *
@@ -24,12 +68,18 @@ const has = (mask, bit) => (mask & bit) === bit;
24
68
  class InMemoryUserManagementStore {
25
69
  _users = new Map();
26
70
  _policy;
27
- constructor(policy) {
71
+ _registry;
72
+ _onCredentialUpgraded;
73
+ constructor(policy, options) {
28
74
  this._policy = policy ?? {};
75
+ this._registry = options?.registry ?? (0, password_hasher_js_1.defaultHasherRegistry)();
29
76
  }
30
77
  get policy() {
31
78
  return this._policy;
32
79
  }
80
+ setOnCredentialUpgraded(fn) {
81
+ this._onCredentialUpgraded = fn;
82
+ }
33
83
  hasUser(userName) {
34
84
  return this._users.has(userName);
35
85
  }
@@ -43,24 +93,25 @@ class InMemoryUserManagementStore {
43
93
  exportUsers() {
44
94
  return [...this._users.values()].map((u) => ({
45
95
  userName: u.userName,
46
- salt: u.salt.toString("base64"),
47
- hash: u.hash.toString("base64"),
96
+ credential: u.credential,
48
97
  userConfiguration: u.userConfiguration,
49
98
  description: u.description
50
99
  }));
51
100
  }
52
101
  importUsers(records) {
53
102
  for (const r of records) {
103
+ // v1 archives stored raw scrypt salt+hash — migrate to a $scrypt$ PHC
104
+ // credential on read (lossless: same algorithm and parameters).
105
+ const credential = isLegacyRecord(r) ? (0, password_hasher_js_1.scryptPhc)(r.salt, r.hash) : r.credential;
54
106
  this._users.set(r.userName, {
55
107
  userName: r.userName,
56
- salt: Buffer.from(r.salt, "base64"),
57
- hash: Buffer.from(r.hash, "base64"),
108
+ credential,
58
109
  userConfiguration: r.userConfiguration,
59
110
  description: r.description
60
111
  });
61
112
  }
62
113
  }
63
- addUser(userName, password, userConfiguration, description) {
114
+ async addUser(userName, password, userConfiguration, description) {
64
115
  if (this._users.has(userName)) {
65
116
  return node_opcua_status_code_1.StatusCodes.BadAlreadyExists;
66
117
  }
@@ -71,10 +122,11 @@ class InMemoryUserManagementStore {
71
122
  if (!this.isPasswordValid(password)) {
72
123
  return node_opcua_status_code_1.StatusCodes.BadOutOfRange;
73
124
  }
74
- this._users.set(userName, { userName, ...this.hashPassword(password), userConfiguration, description });
125
+ const credential = await this._registry.hash(password);
126
+ this._users.set(userName, { userName, credential, userConfiguration, description });
75
127
  return node_opcua_status_code_1.StatusCodes.Good;
76
128
  }
77
- modifyUser(userName, options, callerUserName) {
129
+ async modifyUser(userName, options, callerUserName) {
78
130
  const user = this._users.get(userName);
79
131
  if (!user) {
80
132
  return node_opcua_status_code_1.StatusCodes.BadNotFound;
@@ -100,9 +152,7 @@ class InMemoryUserManagementStore {
100
152
  }
101
153
  // All checks passed — apply the changes
102
154
  if (options.modifyPassword) {
103
- const { salt, hash } = this.hashPassword(options.password ?? "");
104
- user.salt = salt;
105
- user.hash = hash;
155
+ user.credential = await this._registry.hash(options.password ?? "");
106
156
  }
107
157
  if (options.modifyUserConfiguration) {
108
158
  user.userConfiguration = nextConfig;
@@ -126,7 +176,7 @@ class InMemoryUserManagementStore {
126
176
  this._users.delete(userName);
127
177
  return node_opcua_status_code_1.StatusCodes.Good;
128
178
  }
129
- changePassword(userName, oldPassword, newPassword) {
179
+ async changePassword(userName, oldPassword, newPassword) {
130
180
  const user = this._users.get(userName);
131
181
  // Unknown user is treated as an invalid old password (§5.2.8)
132
182
  if (!user) {
@@ -135,7 +185,7 @@ class InMemoryUserManagementStore {
135
185
  if (has(user.userConfiguration, node_opcua_types_1.UserConfigurationMask.NoChangeByUser)) {
136
186
  return node_opcua_status_code_1.StatusCodes.BadNotSupported;
137
187
  }
138
- if (!this.verify(user, oldPassword)) {
188
+ if (!(await this._registry.verify(oldPassword, user.credential))) {
139
189
  return node_opcua_status_code_1.StatusCodes.BadIdentityTokenInvalid;
140
190
  }
141
191
  if (oldPassword === newPassword) {
@@ -144,22 +194,26 @@ class InMemoryUserManagementStore {
144
194
  if (!this.isPasswordValid(newPassword)) {
145
195
  return node_opcua_status_code_1.StatusCodes.BadOutOfRange;
146
196
  }
147
- const { salt, hash } = this.hashPassword(newPassword);
148
- user.salt = salt;
149
- user.hash = hash;
197
+ user.credential = await this._registry.hash(newPassword);
150
198
  // A successful change clears the MustChangePassword flag (§5.2.8)
151
199
  user.userConfiguration &= ~node_opcua_types_1.UserConfigurationMask.MustChangePassword;
152
200
  return node_opcua_status_code_1.StatusCodes.Good;
153
201
  }
154
- authenticate(userName, password) {
202
+ async authenticate(userName, password) {
155
203
  const user = this._users.get(userName);
156
204
  // A disabled user behaves like a user that does not exist (§5.2.3)
157
205
  if (!user || has(user.userConfiguration, node_opcua_types_1.UserConfigurationMask.Disabled)) {
158
206
  return { statusCode: node_opcua_status_code_1.StatusCodes.BadUserAccessDenied, mustChangePassword: false };
159
207
  }
160
- if (!this.verify(user, password)) {
208
+ if (!(await this._registry.verify(password, user.credential))) {
161
209
  return { statusCode: node_opcua_status_code_1.StatusCodes.BadUserAccessDenied, mustChangePassword: false };
162
210
  }
211
+ // Upgrade-on-login: transparently re-hash a legacy/drifted credential with
212
+ // the default scheme (e.g. bcrypt → scrypt) now that we hold the clear text.
213
+ if (this._registry.needsRehash(user.credential)) {
214
+ user.credential = await this._registry.hash(password);
215
+ this._onCredentialUpgraded?.(userName);
216
+ }
163
217
  if (has(user.userConfiguration, node_opcua_types_1.UserConfigurationMask.MustChangePassword)) {
164
218
  return { statusCode: node_opcua_status_code_1.StatusCodes.GoodPasswordChangeRequired, mustChangePassword: true };
165
219
  }
@@ -182,15 +236,6 @@ class InMemoryUserManagementStore {
182
236
  return false;
183
237
  return true;
184
238
  }
185
- hashPassword(password) {
186
- const salt = (0, node_crypto_1.randomBytes)(16);
187
- const hash = (0, node_crypto_1.scryptSync)(password, salt, 64);
188
- return { salt, hash };
189
- }
190
- verify(user, password) {
191
- const candidate = (0, node_crypto_1.scryptSync)(password, user.salt, 64);
192
- return candidate.length === user.hash.length && (0, node_crypto_1.timingSafeEqual)(candidate, user.hash);
193
- }
194
239
  }
195
240
  exports.InMemoryUserManagementStore = InMemoryUserManagementStore;
196
241
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"user_management_store.js","sourceRoot":"","sources":["../source/user_management_store.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,6CAAuE;AACvE,mEAAsE;AACtE,uDAAyD;AAyEzD,MAAM,GAAG,GAAG,CAAC,IAA2B,EAAE,GAA0B,EAAW,EAAE,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC;AAEvG;;;;GAIG;AACH,MAAa,2BAA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CAAC,kBAAkB,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,wCAAqB,CAAC,cAAc,CAAC,EAAE,CAAC;QACzG,OAAO,oCAAW,CAAC,qBAAqB,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-role-set-common",
3
- "version": "2.174.0",
3
+ "version": "2.175.1",
4
4
  "description": "pure nodejs OPCUA SDK - role-set common types and identity stores (OPC 10000-18)",
5
5
  "scripts": {
6
6
  "build": "tsc -b",
@@ -16,17 +16,18 @@
16
16
  "npm": ">=10.x"
17
17
  },
18
18
  "dependencies": {
19
- "node-opcua-basic-types": "2.174.0",
20
- "node-opcua-binary-stream": "2.173.0",
21
- "node-opcua-constants": "2.174.0",
19
+ "bcryptjs": "3.0.3",
20
+ "node-opcua-basic-types": "2.175.1",
21
+ "node-opcua-binary-stream": "2.175.1",
22
+ "node-opcua-constants": "2.175.1",
22
23
  "node-opcua-crypto": "5.3.6",
23
- "node-opcua-nodeid": "2.174.0",
24
- "node-opcua-status-code": "2.173.0",
25
- "node-opcua-types": "2.174.0",
26
- "node-opcua-variant": "2.174.0"
24
+ "node-opcua-nodeid": "2.175.1",
25
+ "node-opcua-status-code": "2.175.1",
26
+ "node-opcua-types": "2.175.1",
27
+ "node-opcua-variant": "2.175.1"
27
28
  },
28
29
  "devDependencies": {
29
- "node-opcua-leak-detector": "2.172.0"
30
+ "node-opcua-leak-detector": "2.175.1"
30
31
  },
31
32
  "author": "Etienne Rossignon",
32
33
  "license": "MIT",
@@ -43,7 +44,7 @@
43
44
  "internet of things"
44
45
  ],
45
46
  "homepage": "http://node-opcua.github.io/",
46
- "gitHead": "064029878247adf2fa5d14a8124e1930431e2428",
47
+ "gitHead": "7c0416a09c7fd83a034b4de3dc8197dff84b8ad8",
47
48
  "files": [
48
49
  "dist",
49
50
  "source"
package/source/archive.ts CHANGED
@@ -25,9 +25,15 @@ import { BinaryStream } from "node-opcua-binary-stream";
25
25
  import { decodeIdentityStore, encodeIdentityStore, identityStoreBinaryStoreSize } from "./binary_persistence.js";
26
26
  import type { IIdentityMappingStore } from "./identity_mapping_store.js";
27
27
  import type { SerializedRoleRestriction } from "./role_restriction_store.js";
28
- import type { SerializedUserRecord } from "./user_management_store.js";
28
+ import type { LegacySerializedUserRecord, SerializedUserRecord } from "./user_management_store.js";
29
29
 
30
- export const ROLE_SET_ARCHIVE_VERSION = 1;
30
+ /**
31
+ * v1: users stored as raw scrypt `{salt, hash}`.
32
+ * v2: users stored as a self-describing PHC `credential` string (scrypt/bcrypt/…).
33
+ * v1 archives are still read (records are migrated on import); v2 archives are
34
+ * rejected by a v1 reader via the version check.
35
+ */
36
+ export const ROLE_SET_ARCHIVE_VERSION = 2;
31
37
 
32
38
  /** Persisted definition of a custom Role (so its GUID NodeId survives a restart). */
33
39
  export interface PersistedCustomRole {
@@ -43,8 +49,12 @@ export interface RoleSetArchive {
43
49
  identities?: string;
44
50
  roles?: PersistedCustomRole[];
45
51
  restrictions?: SerializedRoleRestriction[];
46
- /** UserManagement users with salted scrypt hashes (never clear passwords). */
47
- users?: SerializedUserRecord[];
52
+ /**
53
+ * UserManagement users, credentials only (never clear passwords). v2 writes
54
+ * PHC {@link SerializedUserRecord}s; v1 archives are read as
55
+ * {@link LegacySerializedUserRecord}s and migrated on import.
56
+ */
57
+ users?: (SerializedUserRecord | LegacySerializedUserRecord)[];
48
58
  }
49
59
 
50
60
  /** Encode the identity store as a base64 string (reuses the binary encoder). */
@@ -100,6 +100,18 @@ export class InMemoryIdentityMappingStore implements IIdentityMappingStore {
100
100
  }
101
101
  }
102
102
 
103
+ function isAnonymous(token: unknown): token is AnonymousIdentityToken {
104
+ return token instanceof AnonymousIdentityToken;
105
+ }
106
+
107
+ function isUserName(token: unknown): token is UserNameIdentityToken {
108
+ return token instanceof UserNameIdentityToken;
109
+ }
110
+
111
+ function isX509(token: unknown): token is X509IdentityToken {
112
+ return token instanceof X509IdentityToken;
113
+ }
114
+
103
115
  /**
104
116
  * Check if a single identity mapping rule matches a user identity token.
105
117
  *
@@ -111,31 +123,31 @@ export class InMemoryIdentityMappingStore implements IIdentityMappingStore {
111
123
  function matchesRule(rule: IdentityMappingRuleType, token: AnyUserIdentityToken): boolean {
112
124
  switch (rule.criteriaType) {
113
125
  case IdentityCriteriaType.Anonymous:
114
- return token instanceof AnonymousIdentityToken;
126
+ return isAnonymous(token);
115
127
 
116
128
  case IdentityCriteriaType.AuthenticatedUser:
117
- return !(token instanceof AnonymousIdentityToken);
129
+ return !isAnonymous(token);
118
130
 
119
131
  case IdentityCriteriaType.UserName:
120
- return token instanceof UserNameIdentityToken && token.userName === rule.criteria;
132
+ return isUserName(token) && (token as any).userName === rule.criteria;
121
133
 
122
134
  case IdentityCriteriaType.Thumbprint: {
123
- if (!(token instanceof X509IdentityToken) || !token.certificateData) {
135
+ if (!isX509(token) || !(token as any).certificateData) {
124
136
  return false;
125
137
  }
126
- const certBuffer = token.certificateData instanceof Buffer ? token.certificateData : Buffer.from(token.certificateData);
138
+ const certBuffer = (token as any).certificateData instanceof Buffer ? (token as any).certificateData : Buffer.from((token as any).certificateData);
127
139
  const thumbprint = makeSHA1Thumbprint(certBuffer).toString("hex").toUpperCase();
128
140
  const expected = (rule.criteria ?? "").toUpperCase().replace(/[\s:]/g, "");
129
141
  return thumbprint === expected;
130
142
  }
131
143
 
132
144
  case IdentityCriteriaType.X509Subject: {
133
- if (!(token instanceof X509IdentityToken) || !token.certificateData) {
145
+ if (!isX509(token) || !(token as any).certificateData) {
134
146
  return false;
135
147
  }
136
148
  try {
137
149
  const certBuffer =
138
- token.certificateData instanceof Buffer ? token.certificateData : Buffer.from(token.certificateData);
150
+ (token as any).certificateData instanceof Buffer ? (token as any).certificateData : Buffer.from((token as any).certificateData);
139
151
  const info = exploreCertificate(certBuffer);
140
152
  const subject = info.tbsCertificate.subject ?? {};
141
153
  return matchX509Subject(rule.criteria ?? "", subject);
package/source/index.ts CHANGED
@@ -22,6 +22,14 @@ export {
22
22
  } from "./binary_persistence.js";
23
23
  export type { AnyUserIdentityToken, IIdentityMappingStore } from "./identity_mapping_store.js";
24
24
  export { InMemoryIdentityMappingStore } from "./in_memory_store.js";
25
+ export {
26
+ BcryptHasher,
27
+ defaultHasherRegistry,
28
+ HasherRegistry,
29
+ type PasswordHasher,
30
+ ScryptHasher,
31
+ scryptPhc
32
+ } from "./password_hasher.js";
25
33
  export {
26
34
  applicationComplies,
27
35
  deserializeRestrictions,
@@ -37,12 +45,16 @@ export {
37
45
  } from "./role_restriction_store.js";
38
46
  export {
39
47
  type AuthenticationResult,
48
+ credentialRecord,
40
49
  InMemoryUserManagementStore,
41
50
  type IUserManagementStore,
51
+ type LegacySerializedUserRecord,
42
52
  type ModifyUserOptions,
43
53
  type PasswordPolicy,
44
54
  type SerializedUserRecord,
45
- type UserRecord
55
+ serializeUser,
56
+ type UserRecord,
57
+ validateUserConfiguration
46
58
  } from "./user_management_store.js";
47
59
  export { WellKnownRoleIds, WellKnownRoles } from "./well_known_role_ids.js";
48
60
  export {