@solidxai/core 0.1.13-beta.19 → 0.1.13-beta.20

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +584 -0
  2. package/dist/constants/error-messages.d.ts +7 -0
  3. package/dist/constants/error-messages.d.ts.map +1 -1
  4. package/dist/constants/error-messages.js +7 -0
  5. package/dist/constants/error-messages.js.map +1 -1
  6. package/dist/constants/success-messages.d.ts +3 -0
  7. package/dist/constants/success-messages.d.ts.map +1 -1
  8. package/dist/constants/success-messages.js +3 -0
  9. package/dist/constants/success-messages.js.map +1 -1
  10. package/dist/controllers/mpin-authentication.controller.d.ts +44 -0
  11. package/dist/controllers/mpin-authentication.controller.d.ts.map +1 -0
  12. package/dist/controllers/mpin-authentication.controller.js +102 -0
  13. package/dist/controllers/mpin-authentication.controller.js.map +1 -0
  14. package/dist/dtos/change-mpin.dto.d.ts +6 -0
  15. package/dist/dtos/change-mpin.dto.d.ts.map +1 -0
  16. package/dist/dtos/change-mpin.dto.js +39 -0
  17. package/dist/dtos/change-mpin.dto.js.map +1 -0
  18. package/dist/dtos/mpin-login.dto.d.ts +5 -0
  19. package/dist/dtos/mpin-login.dto.d.ts.map +1 -0
  20. package/dist/dtos/mpin-login.dto.js +33 -0
  21. package/dist/dtos/mpin-login.dto.js.map +1 -0
  22. package/dist/dtos/setup-mpin.dto.d.ts +7 -0
  23. package/dist/dtos/setup-mpin.dto.d.ts.map +1 -0
  24. package/dist/dtos/setup-mpin.dto.js +47 -0
  25. package/dist/dtos/setup-mpin.dto.js.map +1 -0
  26. package/dist/entities/user-device-credential.entity.d.ts +18 -0
  27. package/dist/entities/user-device-credential.entity.d.ts.map +1 -0
  28. package/dist/entities/user-device-credential.entity.js +91 -0
  29. package/dist/entities/user-device-credential.entity.js.map +1 -0
  30. package/dist/helpers/solid-core-error-codes-provider.service.d.ts.map +1 -1
  31. package/dist/helpers/solid-core-error-codes-provider.service.js +45 -0
  32. package/dist/helpers/solid-core-error-codes-provider.service.js.map +1 -1
  33. package/dist/index.d.ts +6 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +6 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/repository/user-device-credential.repository.d.ts +12 -0
  38. package/dist/repository/user-device-credential.repository.d.ts.map +1 -0
  39. package/dist/repository/user-device-credential.repository.js +34 -0
  40. package/dist/repository/user-device-credential.repository.js.map +1 -0
  41. package/dist/seeders/seed-data/solid-core-metadata.json +158 -0
  42. package/dist/services/mpin.service.d.ts +67 -0
  43. package/dist/services/mpin.service.d.ts.map +1 -0
  44. package/dist/services/mpin.service.js +282 -0
  45. package/dist/services/mpin.service.js.map +1 -0
  46. package/dist/services/settings/default-settings-provider.service.d.ts +120 -0
  47. package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
  48. package/dist/services/settings/default-settings-provider.service.js +66 -0
  49. package/dist/services/settings/default-settings-provider.service.js.map +1 -1
  50. package/dist/solid-core.module.d.ts.map +1 -1
  51. package/dist/solid-core.module.js +8 -0
  52. package/dist/solid-core.module.js.map +1 -1
  53. package/package.json +1 -1
  54. package/postman/mpin.postman_collection.json +1045 -0
  55. package/src/constants/error-messages.ts +14 -0
  56. package/src/constants/success-messages.ts +5 -0
  57. package/src/controllers/mpin-authentication.controller.ts +67 -0
  58. package/src/dtos/change-mpin.dto.ts +18 -0
  59. package/src/dtos/mpin-login.dto.ts +24 -0
  60. package/src/dtos/setup-mpin.dto.ts +51 -0
  61. package/src/entities/user-device-credential.entity.ts +130 -0
  62. package/src/helpers/solid-core-error-codes-provider.service.ts +53 -0
  63. package/src/index.ts +6 -0
  64. package/src/repository/user-device-credential.repository.ts +17 -0
  65. package/src/seeders/seed-data/solid-core-metadata.json +158 -0
  66. package/src/services/mpin.service.ts +447 -0
  67. package/src/services/settings/default-settings-provider.service.ts +71 -0
  68. package/src/solid-core.module.ts +8 -0
@@ -127,6 +127,20 @@ export const ERROR_MESSAGES = {
127
127
 
128
128
  DEFAULT_REGEX_PATTERN_NOT_MATCHING_ERROR_MSG: 'Invalid regex pattern.',
129
129
 
130
+ // MPIN errors.
131
+ // MPIN_INVALID is deliberately shared by "wrong MPIN" and "unknown handle",
132
+ // so a failed sign-in never reveals whether the credential handle was real.
133
+ // MPIN_REVOKED is separate and is returned for any attempt against a
134
+ // deactivated credential - it discloses nothing useful, since a dead
135
+ // credential grants no capability, and it lets the client stop retrying.
136
+ MPIN_INVALID: 'Invalid MPIN.',
137
+ MPIN_LOCKED: 'MPIN sign-in is temporarily locked due to repeated failed attempts.',
138
+ MPIN_REVOKED: 'MPIN sign-in has been disabled for this device. Please sign in normally.',
139
+ MPIN_NOT_ENABLED: 'MPIN sign-in is not enabled.',
140
+ MPIN_FORMAT_INVALID: 'MPIN does not meet the required format.',
141
+ MPIN_TOO_PREDICTABLE: 'MPIN is too easy to guess. Avoid repeated or sequential digits.',
142
+ MPIN_CREDENTIAL_NOT_FOUND: 'MPIN device credential not found.',
143
+
130
144
  PERMISSION_MESSAGES: {
131
145
  insertMany: (model?: string) =>
132
146
  `You do not have permission to import ${model ?? 'these'} records.`,
@@ -6,6 +6,11 @@ export const SUCCESS_MESSAGES = {
6
6
  LOGOUT_SUCCESS: 'Logged out successfully',
7
7
  USER_REGISTERED: 'User registered successfully.',
8
8
 
9
+ // MPIN messages
10
+ MPIN_SETUP_SUCCESS: 'MPIN set up successfully.',
11
+ MPIN_CHANGED_SUCCESS: 'MPIN changed successfully.',
12
+ MPIN_DEVICE_REVOKED: 'MPIN sign-in removed for this device.',
13
+
9
14
  // CRUD service messages
10
15
  RECORD_RECOVERED: 'Record successfully recovered',
11
16
  SELECTED_RECORDS_RECOVERED: 'Selected records successfully recovered',
@@ -0,0 +1,67 @@
1
+ import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, ParseIntPipe, Post } from '@nestjs/common';
2
+ import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
3
+ import { ActiveUser } from '../decorators/active-user.decorator';
4
+ import { Public } from '../decorators/public.decorator';
5
+ import { ChangeMpinDto } from '../dtos/change-mpin.dto';
6
+ import { MpinLoginDto } from '../dtos/mpin-login.dto';
7
+ import { SetupMpinDto } from '../dtos/setup-mpin.dto';
8
+ import { ActiveUserData } from '../interfaces/active-user-data.interface';
9
+ import { MpinService } from '../services/mpin.service';
10
+
11
+ /**
12
+ * There is deliberately no public "is MPIN set up for this identifier" route.
13
+ * That would reintroduce exactly the user-enumeration oracle the opaque
14
+ * credential handle removes. The client decides whether to show the MPIN
15
+ * screen from the presence of its own stored handle.
16
+ */
17
+ @Controller('iam/mpin')
18
+ @ApiTags('Solid Core')
19
+ export class MpinAuthenticationController {
20
+ constructor(private readonly mpinService: MpinService) { }
21
+
22
+ @ApiBearerAuth('jwt')
23
+ @Post('setup')
24
+ @HttpCode(HttpStatus.OK)
25
+ setup(
26
+ @Body() setupMpinDto: SetupMpinDto,
27
+ @ActiveUser() activeUser: ActiveUserData,
28
+ ) {
29
+ return this.mpinService.setupMpin(activeUser, setupMpinDto);
30
+ }
31
+
32
+ @ApiBearerAuth('jwt')
33
+ @Post('change')
34
+ @HttpCode(HttpStatus.OK)
35
+ change(
36
+ @Body() changeMpinDto: ChangeMpinDto,
37
+ @ActiveUser() activeUser: ActiveUserData,
38
+ ) {
39
+ return this.mpinService.changeMpin(activeUser, changeMpinDto);
40
+ }
41
+
42
+ // Public by necessity - the caller has no session yet. The credential
43
+ // handle is unguessable, so this carries no enumeration surface.
44
+ @Public()
45
+ @Post('login')
46
+ @HttpCode(HttpStatus.OK)
47
+ login(@Body() mpinLoginDto: MpinLoginDto) {
48
+ return this.mpinService.loginWithMpin(mpinLoginDto);
49
+ }
50
+
51
+ @ApiBearerAuth('jwt')
52
+ @Get('devices')
53
+ listDevices(@ActiveUser() activeUser: ActiveUserData) {
54
+ return this.mpinService.listDevices(activeUser);
55
+ }
56
+
57
+ // By row id, never by credential handle, so the management UI never has to
58
+ // hold the secret.
59
+ @ApiBearerAuth('jwt')
60
+ @Delete('devices/:id')
61
+ revokeDevice(
62
+ @Param('id', ParseIntPipe) id: number,
63
+ @ActiveUser() activeUser: ActiveUserData,
64
+ ) {
65
+ return this.mpinService.revokeDevice(activeUser, id);
66
+ }
67
+ }
@@ -0,0 +1,18 @@
1
+ import { IsNotEmpty, IsString, MaxLength } from 'class-validator';
2
+
3
+ export class ChangeMpinDto {
4
+ @IsNotEmpty()
5
+ @IsString()
6
+ @MaxLength(128)
7
+ credentialRef: string;
8
+
9
+ @IsNotEmpty()
10
+ @IsString()
11
+ @MaxLength(32)
12
+ currentMpin: string;
13
+
14
+ @IsNotEmpty()
15
+ @IsString()
16
+ @MaxLength(32)
17
+ newMpin: string;
18
+ }
@@ -0,0 +1,24 @@
1
+ import { IsNotEmpty, IsString, MaxLength } from 'class-validator';
2
+
3
+ /**
4
+ * Deliberately carries no identifier - no mobile, email or username.
5
+ *
6
+ * `credentialRef` is a server-issued 256-bit handle that already points at a
7
+ * single credential row, and therefore at a single user. That is what removes
8
+ * the user-enumeration surface a public login route would otherwise have: an
9
+ * attacker cannot probe "does this phone number have MPIN?" because there is
10
+ * nowhere to put a phone number.
11
+ */
12
+ export class MpinLoginDto {
13
+ // Bounded so a pathological payload never reaches the regex test or the
14
+ // hash comparison. The handle is always 64 hex characters.
15
+ @IsNotEmpty()
16
+ @IsString()
17
+ @MaxLength(128)
18
+ credentialRef: string;
19
+
20
+ @IsNotEmpty()
21
+ @IsString()
22
+ @MaxLength(32)
23
+ mpin: string;
24
+ }
@@ -0,0 +1,51 @@
1
+ import { IsNotEmpty, IsOptional, IsString, IsUUID, Matches, MaxLength } from 'class-validator';
2
+
3
+ export class SetupMpinDto {
4
+ /**
5
+ * Stable identifier for the physical device, generated once by the client.
6
+ * Validated as a UUID before it ever reaches a cache key or a bucket name,
7
+ * so it cannot smuggle delimiters into the keyspace.
8
+ */
9
+ @IsUUID()
10
+ deviceId: string;
11
+
12
+ /**
13
+ * A string, not a number, even though it looks like digits.
14
+ *
15
+ * A numeric MPIN cannot carry a leading zero: JSON forbids leading zeros in
16
+ * number literals, so a client serialising `012345` numerically emits
17
+ * `12345` and the server stores a five-digit MPIN the user never chose -
18
+ * which still satisfies the default `^\d{4,6}$` and so raises no error.
19
+ * `mpinRegex` is also tenant-configurable and may permit non-digits.
20
+ *
21
+ * Note this cannot be enforced here: the global ValidationPipe runs with
22
+ * `enableImplicitConversion`, so a numeric payload is coerced to a string
23
+ * before @IsString() sees it. Clients must send a quoted JSON string; that
24
+ * requirement is documented in the mobile integration guide.
25
+ *
26
+ * Length and shape are checked server-side against `mpinRegex`, since that
27
+ * setting is the single authority. This only bounds the input.
28
+ */
29
+ @IsNotEmpty()
30
+ @IsString()
31
+ @MaxLength(32)
32
+ mpin: string;
33
+
34
+ /**
35
+ * Rendered in a device-management list, so it is bounded here rather than
36
+ * trusting every consuming UI to escape it.
37
+ */
38
+ @IsOptional()
39
+ @IsString()
40
+ @MaxLength(64)
41
+ @Matches(/^[\w\s.'()-]*$/, {
42
+ message: 'deviceName may contain only letters, numbers, spaces and . \' ( ) - _',
43
+ })
44
+ deviceName?: string;
45
+
46
+ @IsOptional()
47
+ @IsString()
48
+ @MaxLength(32)
49
+ @Matches(/^[\w.-]*$/, { message: 'platform may contain only letters, numbers and . - _' })
50
+ platform?: string;
51
+ }
@@ -0,0 +1,130 @@
1
+ import { Exclude, Expose } from "class-transformer";
2
+ import { CommonEntity } from "src/entities/common.entity";
3
+ import { Column, Entity, Index, ManyToOne } from "typeorm";
4
+ import { User } from "./user.entity";
5
+
6
+ /**
7
+ * A per-device MPIN credential.
8
+ *
9
+ * Login presents `credentialRef` (a server-issued opaque handle) plus the MPIN.
10
+ * The handle - not a mobile number or email - is what identifies the account,
11
+ * which is why the login route needs no identifier and offers no user
12
+ * enumeration surface.
13
+ */
14
+ @Entity("ss_user_device_credential")
15
+ // Non-unique: one physical device may legitimately hold credentials for
16
+ // several accounts, and each account setup mints its own row.
17
+ @Index(["user", "deviceId"])
18
+ @Exclude()
19
+ export class UserDeviceCredential extends CommonEntity {
20
+
21
+ // SHA-256 of the opaque handle, and the login lookup key. Never exposed:
22
+ // the raw handle is returned to the client once at setup and never stored.
23
+ // SHA-256 rather than bcrypt because the handle is 256 bits of randomness -
24
+ // there is nothing to brute-force, so a slow hash would only add latency.
25
+ // Same treatment as UserApiKey.hashedKey.
26
+ @Index({ unique: true })
27
+ @Column()
28
+ hashedCredentialRef: string;
29
+
30
+ // bcrypt hash of the MPIN, via HashingService. Never exposed - same
31
+ // treatment as User.password. Slow hashing is warranted here: a 4-6 digit
32
+ // secret is exactly the low-entropy case bcrypt exists for.
33
+ @Column()
34
+ hashedMpin: string;
35
+
36
+ // Mirrors User.passwordScheme / passwordSchemeVersion so
37
+ // HashingService.needsRehash can upgrade the hash on a successful login.
38
+ @Column()
39
+ mpinScheme: string;
40
+
41
+ /**
42
+ * The hashing *policy* version this row was hashed under - not a version of
43
+ * MPIN itself. It comes from `HashingService.currentVersion()`, which
44
+ * `BcryptService` currently returns as **2**, so freshly created rows read
45
+ * 2, exactly as `ss_user.password_scheme_version` does.
46
+ *
47
+ * It matters because `BcryptService.normalize` applies the configured
48
+ * pepper only when `version >= 2`. Storing the version per row means an
49
+ * older hash still verifies after the policy changes: `compare()` uses the
50
+ * version the row was written with, and `needsRehash()` upgrades it on the
51
+ * next successful login.
52
+ *
53
+ * The `default: 1` is inherited from the `User` precedent and is never
54
+ * reached, since every write path sets this explicitly. Note it would be
55
+ * *wrong* if it ever were: a row hashed at 2 but recorded as 1 would be
56
+ * compared without the pepper and could never authenticate.
57
+ */
58
+ @Column({ default: 1 })
59
+ mpinSchemeVersion: number;
60
+
61
+ // Client-supplied, stable for the physical device. Used for grouping and
62
+ // the device-management UI only - never a lookup key. Deliberately NOT
63
+ // unique: several accounts on one device share a deviceId.
64
+ @Expose()
65
+ @Column()
66
+ deviceId: string;
67
+
68
+ /**
69
+ * Human-readable natural key - `<username>-<deviceId>` - unique per row.
70
+ *
71
+ * Neither column alone can serve as the model's user key: `deviceId` is
72
+ * shared by every account on a device, and `deviceName` is nullable.
73
+ * Combining them is unique in both directions - one user across many
74
+ * devices, and many users on one device.
75
+ *
76
+ * Populated by MpinService rather than declared as a `computed` field in
77
+ * the metadata manifest. Computed fields are evaluated by
78
+ * ComputedFieldCrudManager on the generic CRUD path (`crud.service.ts`),
79
+ * which this service bypasses by writing through the repository directly,
80
+ * so a computed declaration would silently leave this null. It is also
81
+ * beyond ConcatComputedFieldProvider, which resolves `dto[field]` flatly
82
+ * within one model and cannot reach `username` across the user relation.
83
+ */
84
+ @Expose()
85
+ @Index({ unique: true })
86
+ @Column()
87
+ credentialKey: string;
88
+
89
+ @Expose()
90
+ @Column({ nullable: true })
91
+ deviceName: string;
92
+
93
+ @Expose()
94
+ @Column({ nullable: true })
95
+ platform: string;
96
+
97
+ // Revocation is a soft-delete: the row survives so that a correct MPIN can
98
+ // be answered with "this device was removed" rather than a baffling
99
+ // "incorrect MPIN". Only active rows count towards mpinMaxDevicesPerUser.
100
+ @Expose()
101
+ @Column({ default: true })
102
+ isActive: boolean;
103
+
104
+ // Cumulative, and reset only on a successful login - never when a lockout
105
+ // expires. That is what makes the second threshold detectable without a
106
+ // separate lockout counter.
107
+ @Expose()
108
+ @Column({ default: 0 })
109
+ failedAttempts: number;
110
+
111
+ @Expose()
112
+ @Column({ nullable: true })
113
+ lockedUntil: Date;
114
+
115
+ @Expose()
116
+ @Column({ nullable: true })
117
+ lastUsedAt: Date;
118
+
119
+ // Deliberately no inverse property on User. Nothing needs
120
+ // `user.deviceCredentials`, and leaving the most widely referenced entity
121
+ // in the system untouched keeps this feature purely additive.
122
+ //
123
+ // `nullable: false` because TypeORM makes relations nullable by default,
124
+ // which would let a credential exist with no owner. Such a row could never
125
+ // authenticate - loginWithMpin rejects it - so it would simply be dead
126
+ // data, but the database should refuse it outright. This also keeps the
127
+ // column honest against the metadata manifest, which declares it required.
128
+ @ManyToOne(() => User, { nullable: false })
129
+ user: User;
130
+ }
@@ -32,6 +32,59 @@ export class SolidCoreErrorCodesProvider implements IErrorCodeProvider {
32
32
  httpStatus: 401,
33
33
  },
34
34
  },
35
+ // MPIN rules sit above the generic session rules so that an MPIN
36
+ // failure is never reported as a session problem. The three codes
37
+ // drive three different client behaviours: retry, wait, and
38
+ // discard-the-handle.
39
+ {
40
+ code: 'solidx-mpin-locked',
41
+ priority: 120,
42
+ match: (txt) => txt.includes(ERROR_MESSAGES.MPIN_LOCKED.toLowerCase()),
43
+ meta: {
44
+ message: ERROR_MESSAGES.MPIN_LOCKED,
45
+ httpStatus: 401,
46
+ },
47
+ },
48
+ {
49
+ code: 'solidx-mpin-revoked',
50
+ priority: 120,
51
+ match: (txt) => txt.includes(ERROR_MESSAGES.MPIN_REVOKED.toLowerCase()),
52
+ meta: {
53
+ message: ERROR_MESSAGES.MPIN_REVOKED,
54
+ httpStatus: 401,
55
+ },
56
+ },
57
+ {
58
+ code: 'solidx-mpin-invalid',
59
+ priority: 120,
60
+ match: (txt) => txt.includes(ERROR_MESSAGES.MPIN_INVALID.toLowerCase()),
61
+ meta: {
62
+ message: ERROR_MESSAGES.MPIN_INVALID,
63
+ httpStatus: 401,
64
+ },
65
+ },
66
+ // Setup-time rejections. Distinct codes so the client can say
67
+ // "choose a less predictable PIN" rather than parsing a message.
68
+ // Safe to distinguish: both occur only on bearer-authenticated
69
+ // routes, so neither discloses anything.
70
+ {
71
+ code: 'solidx-mpin-too-predictable',
72
+ priority: 120,
73
+ match: (txt) => txt.includes(ERROR_MESSAGES.MPIN_TOO_PREDICTABLE.toLowerCase()),
74
+ meta: {
75
+ message: ERROR_MESSAGES.MPIN_TOO_PREDICTABLE,
76
+ httpStatus: 400,
77
+ },
78
+ },
79
+ {
80
+ code: 'solidx-mpin-format-invalid',
81
+ priority: 120,
82
+ match: (txt) => txt.includes(ERROR_MESSAGES.MPIN_FORMAT_INVALID.toLowerCase()),
83
+ meta: {
84
+ message: ERROR_MESSAGES.MPIN_FORMAT_INVALID,
85
+ httpStatus: 400,
86
+ },
87
+ },
35
88
  {
36
89
  code: 'solidx-mcp-server-unavailable',
37
90
  priority: 100,
package/src/index.ts CHANGED
@@ -160,6 +160,12 @@ export * from './entities/role-metadata.entity'
160
160
  export * from './entities/sms-template.entity'
161
161
  export * from './entities/user.entity'
162
162
  export * from './entities/user-api-key.entity'
163
+ export * from './entities/user-device-credential.entity'
164
+ export * from './repository/user-device-credential.repository'
165
+ export * from './services/mpin.service'
166
+ export * from './dtos/setup-mpin.dto'
167
+ export * from './dtos/change-mpin.dto'
168
+ export * from './dtos/mpin-login.dto'
163
169
  export * from './entities/view-metadata.entity'
164
170
  export * from './entities/setting.entity'
165
171
  export * from './entities/saved-filters.entity'
@@ -0,0 +1,17 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { UserDeviceCredential } from 'src/entities/user-device-credential.entity';
3
+ import { RequestContextService } from 'src/services/request-context.service';
4
+ import { DataSource } from 'typeorm';
5
+ import { SecurityRuleRepository } from './security-rule.repository';
6
+ import { SolidBaseRepository } from './solid-base.repository';
7
+
8
+ @Injectable()
9
+ export class UserDeviceCredentialRepository extends SolidBaseRepository<UserDeviceCredential> {
10
+ constructor(
11
+ readonly dataSource: DataSource,
12
+ readonly requestContextService: RequestContextService,
13
+ readonly securityRuleRepository: SecurityRuleRepository,
14
+ ) {
15
+ super(UserDeviceCredential, dataSource, requestContextService, securityRuleRepository);
16
+ }
17
+ }
@@ -2360,6 +2360,164 @@
2360
2360
  }
2361
2361
  ]
2362
2362
  },
2363
+ {
2364
+ "singularName": "userDeviceCredential",
2365
+ "tableName": "ss_user_device_credential",
2366
+ "pluralName": "userDeviceCredentials",
2367
+ "displayName": "User Device Credential",
2368
+ "description": "Per-device MPIN credentials",
2369
+ "dataSource": "default",
2370
+ "dataSourceType": "postgres",
2371
+ "userKeyFieldUserKey": "credentialKey",
2372
+ "isSystem": true,
2373
+ "fields": [
2374
+ {
2375
+ "name": "credentialKey",
2376
+ "displayName": "Credential Key",
2377
+ "description": "Natural key: <username>-<deviceId>. Populated by MpinService, not by the computed-field pipeline.",
2378
+ "type": "shortText",
2379
+ "length": 512,
2380
+ "required": true,
2381
+ "unique": true,
2382
+ "index": true,
2383
+ "private": false,
2384
+ "encrypt": false,
2385
+ "isUserKey": true,
2386
+ "isSystem": true
2387
+ },
2388
+ {
2389
+ "name": "hashedCredentialRef",
2390
+ "displayName": "Hashed Credential Ref",
2391
+ "type": "shortText",
2392
+ "length": 512,
2393
+ "required": true,
2394
+ "unique": true,
2395
+ "index": true,
2396
+ "private": true,
2397
+ "encrypt": false,
2398
+ "isSystem": true
2399
+ },
2400
+ {
2401
+ "name": "hashedMpin",
2402
+ "displayName": "Hashed MPIN",
2403
+ "type": "shortText",
2404
+ "length": 512,
2405
+ "required": true,
2406
+ "unique": false,
2407
+ "index": false,
2408
+ "private": true,
2409
+ "encrypt": false,
2410
+ "isSystem": true
2411
+ },
2412
+ {
2413
+ "name": "mpinScheme",
2414
+ "displayName": "MPIN Scheme",
2415
+ "type": "selectionStatic",
2416
+ "required": true,
2417
+ "private": false,
2418
+ "encrypt": false,
2419
+ "isSystem": true,
2420
+ "selectionStaticValues": [
2421
+ "bcrypt:bcrypt"
2422
+ ]
2423
+ },
2424
+ {
2425
+ "name": "mpinSchemeVersion",
2426
+ "displayName": "MPIN Scheme Version",
2427
+ "type": "int",
2428
+ "required": true,
2429
+ "private": false,
2430
+ "encrypt": false,
2431
+ "defaultValue": "1",
2432
+ "isSystem": true
2433
+ },
2434
+ {
2435
+ "name": "deviceId",
2436
+ "displayName": "Device Id",
2437
+ "type": "shortText",
2438
+ "length": 512,
2439
+ "required": true,
2440
+ "unique": false,
2441
+ "index": true,
2442
+ "private": false,
2443
+ "encrypt": false,
2444
+ "isSystem": true
2445
+ },
2446
+ {
2447
+ "name": "deviceName",
2448
+ "displayName": "Device Name",
2449
+ "type": "shortText",
2450
+ "length": 512,
2451
+ "required": false,
2452
+ "unique": false,
2453
+ "index": false,
2454
+ "private": false,
2455
+ "encrypt": false,
2456
+ "isSystem": true
2457
+ },
2458
+ {
2459
+ "name": "platform",
2460
+ "displayName": "Platform",
2461
+ "type": "shortText",
2462
+ "length": 512,
2463
+ "required": false,
2464
+ "unique": false,
2465
+ "index": false,
2466
+ "private": false,
2467
+ "encrypt": false,
2468
+ "isSystem": true
2469
+ },
2470
+ {
2471
+ "name": "isActive",
2472
+ "displayName": "Is Active",
2473
+ "type": "boolean",
2474
+ "required": true,
2475
+ "unique": false,
2476
+ "index": false,
2477
+ "private": false,
2478
+ "encrypt": false,
2479
+ "defaultValue": "true",
2480
+ "isSystem": true
2481
+ },
2482
+ {
2483
+ "name": "failedAttempts",
2484
+ "displayName": "Failed Attempts",
2485
+ "type": "int",
2486
+ "required": true,
2487
+ "private": false,
2488
+ "encrypt": false,
2489
+ "defaultValue": "0",
2490
+ "isSystem": true
2491
+ },
2492
+ {
2493
+ "name": "lockedUntil",
2494
+ "displayName": "Locked Until",
2495
+ "type": "datetime",
2496
+ "required": false,
2497
+ "private": false,
2498
+ "encrypt": false,
2499
+ "isSystem": true
2500
+ },
2501
+ {
2502
+ "name": "lastUsedAt",
2503
+ "displayName": "Last Used At",
2504
+ "type": "datetime",
2505
+ "required": false,
2506
+ "private": false,
2507
+ "encrypt": false,
2508
+ "isSystem": true
2509
+ },
2510
+ {
2511
+ "name": "user",
2512
+ "displayName": "User",
2513
+ "type": "relation",
2514
+ "required": true,
2515
+ "private": false,
2516
+ "encrypt": false,
2517
+ "isSystem": true
2518
+ }
2519
+ ]
2520
+ },
2363
2521
  {
2364
2522
  "singularName": "userActivityHistory",
2365
2523
  "tableName": "ss_user_activity_history",