@digitaldefiance/suite-core-lib 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +296 -0
- package/dist/backup-code-string.d.ts +26 -0
- package/dist/backup-code-string.d.ts.map +1 -0
- package/dist/backup-code-string.js +72 -0
- package/dist/backup-code-string.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +15 -0
- package/dist/constants.js.map +1 -0
- package/dist/enumerations/account-status.d.ts +18 -0
- package/dist/enumerations/account-status.d.ts.map +1 -0
- package/dist/enumerations/account-status.js +22 -0
- package/dist/enumerations/account-status.js.map +1 -0
- package/dist/enumerations/email-token-type.d.ts +25 -0
- package/dist/enumerations/email-token-type.d.ts.map +1 -0
- package/dist/enumerations/email-token-type.js +29 -0
- package/dist/enumerations/email-token-type.js.map +1 -0
- package/dist/enumerations/index.d.ts +5 -0
- package/dist/enumerations/index.d.ts.map +1 -0
- package/dist/enumerations/index.js +21 -0
- package/dist/enumerations/index.js.map +1 -0
- package/dist/enumerations/role.d.ts +6 -0
- package/dist/enumerations/role.d.ts.map +1 -0
- package/dist/enumerations/role.js +10 -0
- package/dist/enumerations/role.js.map +1 -0
- package/dist/enumerations/suite-core-string-key.d.ts +23 -0
- package/dist/enumerations/suite-core-string-key.d.ts.map +1 -0
- package/dist/enumerations/suite-core-string-key.js +31 -0
- package/dist/enumerations/suite-core-string-key.js.map +1 -0
- package/dist/errors/account-locked.d.ts +6 -0
- package/dist/errors/account-locked.d.ts.map +1 -0
- package/dist/errors/account-locked.js +13 -0
- package/dist/errors/account-locked.js.map +1 -0
- package/dist/errors/account-status.d.ts +8 -0
- package/dist/errors/account-status.d.ts.map +1 -0
- package/dist/errors/account-status.js +31 -0
- package/dist/errors/account-status.js.map +1 -0
- package/dist/errors/generic-validation.d.ts +5 -0
- package/dist/errors/generic-validation.d.ts.map +1 -0
- package/dist/errors/generic-validation.js +11 -0
- package/dist/errors/generic-validation.js.map +1 -0
- package/dist/errors/index.d.ts +8 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +24 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/invalid-backup-code.d.ts +4 -0
- package/dist/errors/invalid-backup-code.d.ts.map +1 -0
- package/dist/errors/invalid-backup-code.js +11 -0
- package/dist/errors/invalid-backup-code.js.map +1 -0
- package/dist/errors/user-not-found.d.ts +6 -0
- package/dist/errors/user-not-found.d.ts.map +1 -0
- package/dist/errors/user-not-found.js +16 -0
- package/dist/errors/user-not-found.js.map +1 -0
- package/dist/errors/username-email-required.d.ts +6 -0
- package/dist/errors/username-email-required.d.ts.map +1 -0
- package/dist/errors/username-email-required.js +16 -0
- package/dist/errors/username-email-required.js.map +1 -0
- package/dist/errors/username-in-use.d.ts +6 -0
- package/dist/errors/username-in-use.d.ts.map +1 -0
- package/dist/errors/username-in-use.js +16 -0
- package/dist/errors/username-in-use.js.map +1 -0
- package/dist/i18n-setup.d.ts +33 -0
- package/dist/i18n-setup.d.ts.map +1 -0
- package/dist/i18n-setup.js +269 -0
- package/dist/i18n-setup.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/backup-code-consts.d.ts +16 -0
- package/dist/interfaces/backup-code-consts.d.ts.map +1 -0
- package/dist/interfaces/backup-code-consts.js +3 -0
- package/dist/interfaces/backup-code-consts.js.map +1 -0
- package/dist/interfaces/backup-code.d.ts +7 -0
- package/dist/interfaces/backup-code.d.ts.map +1 -0
- package/dist/interfaces/backup-code.js +3 -0
- package/dist/interfaces/backup-code.js.map +1 -0
- package/dist/interfaces/bases/email-token.d.ts +33 -0
- package/dist/interfaces/bases/email-token.d.ts.map +1 -0
- package/dist/interfaces/bases/email-token.js +3 -0
- package/dist/interfaces/bases/email-token.js.map +1 -0
- package/dist/interfaces/bases/index.d.ts +8 -0
- package/dist/interfaces/bases/index.d.ts.map +1 -0
- package/dist/interfaces/bases/index.js +24 -0
- package/dist/interfaces/bases/index.js.map +1 -0
- package/dist/interfaces/bases/mnemonic.d.ts +11 -0
- package/dist/interfaces/bases/mnemonic.d.ts.map +1 -0
- package/dist/interfaces/bases/mnemonic.js +3 -0
- package/dist/interfaces/bases/mnemonic.js.map +1 -0
- package/dist/interfaces/bases/role.d.ts +32 -0
- package/dist/interfaces/bases/role.d.ts.map +1 -0
- package/dist/interfaces/bases/role.js +3 -0
- package/dist/interfaces/bases/role.js.map +1 -0
- package/dist/interfaces/bases/token-role.d.ts +8 -0
- package/dist/interfaces/bases/token-role.d.ts.map +1 -0
- package/dist/interfaces/bases/token-role.js +3 -0
- package/dist/interfaces/bases/token-role.js.map +1 -0
- package/dist/interfaces/bases/used-direct-login-token.d.ts +6 -0
- package/dist/interfaces/bases/used-direct-login-token.d.ts.map +1 -0
- package/dist/interfaces/bases/used-direct-login-token.js +3 -0
- package/dist/interfaces/bases/used-direct-login-token.js.map +1 -0
- package/dist/interfaces/bases/user-role.d.ts +16 -0
- package/dist/interfaces/bases/user-role.d.ts.map +1 -0
- package/dist/interfaces/bases/user-role.js +3 -0
- package/dist/interfaces/bases/user-role.js.map +1 -0
- package/dist/interfaces/bases/user.d.ts +71 -0
- package/dist/interfaces/bases/user.d.ts.map +1 -0
- package/dist/interfaces/bases/user.js +3 -0
- package/dist/interfaces/bases/user.js.map +1 -0
- package/dist/interfaces/constants.d.ts +5 -0
- package/dist/interfaces/constants.d.ts.map +1 -0
- package/dist/interfaces/constants.js +3 -0
- package/dist/interfaces/constants.js.map +1 -0
- package/dist/interfaces/dto/email-token.d.ts +3 -0
- package/dist/interfaces/dto/email-token.d.ts.map +1 -0
- package/dist/interfaces/dto/email-token.js +3 -0
- package/dist/interfaces/dto/email-token.js.map +1 -0
- package/dist/interfaces/dto/index.d.ts +8 -0
- package/dist/interfaces/dto/index.d.ts.map +1 -0
- package/dist/interfaces/dto/index.js +24 -0
- package/dist/interfaces/dto/index.js.map +1 -0
- package/dist/interfaces/dto/mnemonic.d.ts +3 -0
- package/dist/interfaces/dto/mnemonic.d.ts.map +1 -0
- package/dist/interfaces/dto/mnemonic.js +3 -0
- package/dist/interfaces/dto/mnemonic.js.map +1 -0
- package/dist/interfaces/dto/request-user.d.ts +12 -0
- package/dist/interfaces/dto/request-user.d.ts.map +1 -0
- package/dist/interfaces/dto/request-user.js +3 -0
- package/dist/interfaces/dto/request-user.js.map +1 -0
- package/dist/interfaces/dto/role.d.ts +3 -0
- package/dist/interfaces/dto/role.d.ts.map +1 -0
- package/dist/interfaces/dto/role.js +3 -0
- package/dist/interfaces/dto/role.js.map +1 -0
- package/dist/interfaces/dto/token-role.d.ts +10 -0
- package/dist/interfaces/dto/token-role.d.ts.map +1 -0
- package/dist/interfaces/dto/token-role.js +3 -0
- package/dist/interfaces/dto/token-role.js.map +1 -0
- package/dist/interfaces/dto/user-role.d.ts +3 -0
- package/dist/interfaces/dto/user-role.d.ts.map +1 -0
- package/dist/interfaces/dto/user-role.js +3 -0
- package/dist/interfaces/dto/user-role.js.map +1 -0
- package/dist/interfaces/dto/user.d.ts +3 -0
- package/dist/interfaces/dto/user.d.ts.map +1 -0
- package/dist/interfaces/dto/user.js +3 -0
- package/dist/interfaces/dto/user.js.map +1 -0
- package/dist/interfaces/has-creation.d.ts +7 -0
- package/dist/interfaces/has-creation.d.ts.map +1 -0
- package/dist/interfaces/has-creation.js +3 -0
- package/dist/interfaces/has-creation.js.map +1 -0
- package/dist/interfaces/has-creator.d.ts +7 -0
- package/dist/interfaces/has-creator.d.ts.map +1 -0
- package/dist/interfaces/has-creator.js +3 -0
- package/dist/interfaces/has-creator.js.map +1 -0
- package/dist/interfaces/has-id.d.ts +4 -0
- package/dist/interfaces/has-id.d.ts.map +1 -0
- package/dist/interfaces/has-id.js +3 -0
- package/dist/interfaces/has-id.js.map +1 -0
- package/dist/interfaces/has-soft-delete.d.ts +7 -0
- package/dist/interfaces/has-soft-delete.d.ts.map +1 -0
- package/dist/interfaces/has-soft-delete.js +3 -0
- package/dist/interfaces/has-soft-delete.js.map +1 -0
- package/dist/interfaces/has-soft-deleter.d.ts +7 -0
- package/dist/interfaces/has-soft-deleter.d.ts.map +1 -0
- package/dist/interfaces/has-soft-deleter.js +3 -0
- package/dist/interfaces/has-soft-deleter.js.map +1 -0
- package/dist/interfaces/has-timestamp-owners.d.ts +5 -0
- package/dist/interfaces/has-timestamp-owners.d.ts.map +1 -0
- package/dist/interfaces/has-timestamp-owners.js +3 -0
- package/dist/interfaces/has-timestamp-owners.js.map +1 -0
- package/dist/interfaces/has-timestamps.d.ts +6 -0
- package/dist/interfaces/has-timestamps.d.ts.map +1 -0
- package/dist/interfaces/has-timestamps.js +3 -0
- package/dist/interfaces/has-timestamps.js.map +1 -0
- package/dist/interfaces/has-updater.d.ts +7 -0
- package/dist/interfaces/has-updater.d.ts.map +1 -0
- package/dist/interfaces/has-updater.js +3 -0
- package/dist/interfaces/has-updater.js.map +1 -0
- package/dist/interfaces/has-updates.d.ts +4 -0
- package/dist/interfaces/has-updates.d.ts.map +1 -0
- package/dist/interfaces/has-updates.js +3 -0
- package/dist/interfaces/has-updates.js.map +1 -0
- package/dist/interfaces/index.d.ts +15 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +31 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/models/email-token.d.ts +6 -0
- package/dist/interfaces/models/email-token.d.ts.map +1 -0
- package/dist/interfaces/models/email-token.js +3 -0
- package/dist/interfaces/models/email-token.js.map +1 -0
- package/dist/interfaces/models/index.d.ts +9 -0
- package/dist/interfaces/models/index.d.ts.map +1 -0
- package/dist/interfaces/models/index.js +25 -0
- package/dist/interfaces/models/index.js.map +1 -0
- package/dist/interfaces/models/mnemonic.d.ts +6 -0
- package/dist/interfaces/models/mnemonic.d.ts.map +1 -0
- package/dist/interfaces/models/mnemonic.js +3 -0
- package/dist/interfaces/models/mnemonic.js.map +1 -0
- package/dist/interfaces/models/role.d.ts +6 -0
- package/dist/interfaces/models/role.d.ts.map +1 -0
- package/dist/interfaces/models/role.js +3 -0
- package/dist/interfaces/models/role.js.map +1 -0
- package/dist/interfaces/models/token-role.d.ts +11 -0
- package/dist/interfaces/models/token-role.d.ts.map +1 -0
- package/dist/interfaces/models/token-role.js +3 -0
- package/dist/interfaces/models/token-role.js.map +1 -0
- package/dist/interfaces/models/used-direct-login-token.d.ts +11 -0
- package/dist/interfaces/models/used-direct-login-token.d.ts.map +1 -0
- package/dist/interfaces/models/used-direct-login-token.js +3 -0
- package/dist/interfaces/models/used-direct-login-token.js.map +1 -0
- package/dist/interfaces/models/user-role.d.ts +11 -0
- package/dist/interfaces/models/user-role.d.ts.map +1 -0
- package/dist/interfaces/models/user-role.js +3 -0
- package/dist/interfaces/models/user-role.js.map +1 -0
- package/dist/interfaces/models/user.d.ts +12 -0
- package/dist/interfaces/models/user.d.ts.map +1 -0
- package/dist/interfaces/models/user.js +3 -0
- package/dist/interfaces/models/user.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Digital Defiance
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# @digitaldefiance/suite-core-lib
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40digitaldefiance%2Fsuite-core-lib)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](http://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
A library that provides higher-level primitives for the cornerstone of a comprehensive, cryptographically-secure user management system and node express server with service framework built with **@digitaldefiance/ecies-lib** and **@digitaldefiance/node-ecies-lib** encryption. This library serves as the foundational building blocks for the **node-ecies** project and **node-express-suite** packages, which together form a complete full-stack framework ecosystem.
|
|
8
|
+
|
|
9
|
+
## 🚀 Framework Ecosystem
|
|
10
|
+
|
|
11
|
+
`@digitaldefiance/suiite-core-lib` provides the **core primitives and abstractions** that power:
|
|
12
|
+
|
|
13
|
+
- user accounts and authentication
|
|
14
|
+
- user to user and user to server encryption
|
|
15
|
+
- zero-knowledge proof authentication
|
|
16
|
+
- role-based access control (RBAC)
|
|
17
|
+
- multi-language internationalization (i18n)
|
|
18
|
+
|
|
19
|
+
## 📦 Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @digitaldefiance/suiite-core-lib
|
|
23
|
+
# or
|
|
24
|
+
yarn add @digitaldefiance/suiite-core-lib
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 🌍 Internationalization
|
|
28
|
+
|
|
29
|
+
Built-in support for **5 languages** with the new plugin-based i18n architecture:
|
|
30
|
+
|
|
31
|
+
- **English** (US/UK)
|
|
32
|
+
- **French**
|
|
33
|
+
- **Spanish**
|
|
34
|
+
- **Mandarin Chinese**
|
|
35
|
+
- **Ukrainian**
|
|
36
|
+
|
|
37
|
+
All error messages, validation text, and user-facing strings are fully localized and extensible.
|
|
38
|
+
|
|
39
|
+
## 🏗️ Architecture Overview
|
|
40
|
+
|
|
41
|
+
### Type-Safe Interfaces
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import {
|
|
45
|
+
IFrontendUser,
|
|
46
|
+
IBackendUser,
|
|
47
|
+
AccountStatus,
|
|
48
|
+
Role,
|
|
49
|
+
CoreLanguage
|
|
50
|
+
} from '@digitaldefiance/suiite-core-lib';
|
|
51
|
+
|
|
52
|
+
// Frontend-optimized user interface (string IDs)
|
|
53
|
+
interface AppUser extends IFrontendUser<'en'> {
|
|
54
|
+
_id: string;
|
|
55
|
+
siteLanguage: 'en';
|
|
56
|
+
accountStatus: AccountStatus;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Backend database interface (ObjectId support)
|
|
60
|
+
interface DatabaseUser extends IBackendUser<'en'> {
|
|
61
|
+
_id: Types.ObjectId;
|
|
62
|
+
createdBy: Types.ObjectId;
|
|
63
|
+
updatedBy: Types.ObjectId;
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Secure Backup Code System
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { BackupCodeString, Constants } from '@digitaldefiance/suiite-core-lib';
|
|
71
|
+
|
|
72
|
+
// Generate cryptographically secure backup codes
|
|
73
|
+
const backupCodes = BackupCodeString.generateBackupCodes();
|
|
74
|
+
console.log(backupCodes.length); // 10 (configurable via Constants.BACKUP_CODES.Count)
|
|
75
|
+
|
|
76
|
+
// Each code is formatted for user display
|
|
77
|
+
const code = new BackupCodeString('deadbeefcafebabefeedface01234567');
|
|
78
|
+
console.log(code.value); // "dead-beef-cafe-babe-feed-face-0123-4567"
|
|
79
|
+
|
|
80
|
+
// Multiple secure encoding formats
|
|
81
|
+
console.log(code.valueAsHexString); // Hex-encoded UTF-8 bytes
|
|
82
|
+
console.log(code.valueAsBase64String); // Base64-encoded
|
|
83
|
+
console.log(code.valueAsUint8Array); // Raw byte array
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Localized Error Handling
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import {
|
|
90
|
+
UserNotFoundError,
|
|
91
|
+
UsernameInUseError,
|
|
92
|
+
AccountLockedError,
|
|
93
|
+
CoreLanguage
|
|
94
|
+
} from '@digitaldefiance/suiite-core-lib';
|
|
95
|
+
|
|
96
|
+
// Errors with automatic localization
|
|
97
|
+
throw new UserNotFoundError(CoreLanguage.French);
|
|
98
|
+
// "Compte utilisateur introuvable"
|
|
99
|
+
|
|
100
|
+
throw new UsernameInUseError(CoreLanguage.Spanish);
|
|
101
|
+
// "El nombre de usuario ya está en uso"
|
|
102
|
+
|
|
103
|
+
throw new AccountLockedError(CoreLanguage.German);
|
|
104
|
+
// "Konto ist von einem Administrator gesperrt"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 🎯 How Frameworks Use These Primitives
|
|
108
|
+
|
|
109
|
+
The **@digitaldefiance/node-express-suite** package builds upon these primitives to create full framework components:
|
|
110
|
+
|
|
111
|
+
### Express.js Framework Usage
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// node-express-suite uses these primitives internally
|
|
115
|
+
import {
|
|
116
|
+
IFrontendUser,
|
|
117
|
+
AccountStatus,
|
|
118
|
+
BackupCodeString,
|
|
119
|
+
UserNotFoundError,
|
|
120
|
+
CoreLanguage
|
|
121
|
+
} from '@digitaldefiance/suiite-core-lib';
|
|
122
|
+
|
|
123
|
+
// Framework middleware validates using our primitives
|
|
124
|
+
function validateBackupCode(userInput: string, storedCodes: IBackupCode[]) {
|
|
125
|
+
try {
|
|
126
|
+
const inputCode = new BackupCodeString(userInput);
|
|
127
|
+
return storedCodes.some(stored =>
|
|
128
|
+
BackupCodeString.normalizeCode(inputCode.value) === stored.encrypted
|
|
129
|
+
);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
if (error instanceof InvalidBackupCodeError) {
|
|
132
|
+
// Framework handles localized error response
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Frontend Framework Integration
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// Frontend frameworks consume our type-safe interfaces
|
|
144
|
+
import { IFrontendUser, AccountStatus } from '@digitaldefiance/suiite-core-lib';
|
|
145
|
+
|
|
146
|
+
// React/Vue/Angular components use our interfaces
|
|
147
|
+
interface UserProfileProps {
|
|
148
|
+
user: IFrontendUser<'en' | 'fr' | 'es'>;
|
|
149
|
+
onStatusChange: (status: AccountStatus) => void;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Type safety ensures consistent data flow
|
|
153
|
+
function updateUserStatus(user: IFrontendUser<string>, status: AccountStatus) {
|
|
154
|
+
return {
|
|
155
|
+
...user,
|
|
156
|
+
accountStatus: status,
|
|
157
|
+
updatedAt: new Date().toISOString()
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Database Layer Integration
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// node-express-suite database layers use our models
|
|
166
|
+
import { IBackendUser, IUserRoleBase } from '@digitaldefiance/suiite-core-lib';
|
|
167
|
+
import { Types } from 'mongoose';
|
|
168
|
+
|
|
169
|
+
// Framework database schemas implement our interfaces
|
|
170
|
+
const userSchema = new mongoose.Schema<IBackendUser<'en'>>({
|
|
171
|
+
_id: { type: Types.ObjectId, required: true },
|
|
172
|
+
username: { type: String, required: true, unique: true },
|
|
173
|
+
email: { type: String, required: true, unique: true },
|
|
174
|
+
accountStatus: {
|
|
175
|
+
type: String,
|
|
176
|
+
enum: Object.values(AccountStatus),
|
|
177
|
+
default: AccountStatus.PendingEmailVerification
|
|
178
|
+
},
|
|
179
|
+
// ... rest of the schema matches our interface
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 🔧 Advanced Configuration
|
|
184
|
+
|
|
185
|
+
### Custom Model Extensions
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { BaseModelName, ExtendedModelName } from '@digitaldefiance/suite-core-lib';
|
|
189
|
+
|
|
190
|
+
// Extend the base models for your application
|
|
191
|
+
enum CustomModels {
|
|
192
|
+
Organization = 'Organization',
|
|
193
|
+
Subscription = 'Subscription',
|
|
194
|
+
AuditLog = 'AuditLog'
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
type AppModelName = ExtendedModelName<typeof CustomModels>;
|
|
198
|
+
// Includes: User, Role, EmailToken, Mnemonic, UserRole, Organization, Subscription, AuditLog
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Email Token Types
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import { EmailTokenType } from '@digitaldefiance/suiite-core-lib';
|
|
205
|
+
|
|
206
|
+
// Built-in token types for common workflows
|
|
207
|
+
const tokenTypes = [
|
|
208
|
+
EmailTokenType.AccountVerification, // Email confirmation
|
|
209
|
+
EmailTokenType.PasswordReset, // Password reset flow
|
|
210
|
+
EmailTokenType.LoginRequest, // Passwordless login
|
|
211
|
+
EmailTokenType.PrivateKeyRequest, // Key recovery
|
|
212
|
+
EmailTokenType.MnemonicRecoveryRequest // Mnemonic recovery
|
|
213
|
+
];
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Account Status Management
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import { AccountStatus } from '@digitaldefiance/suiite-core-lib';
|
|
220
|
+
|
|
221
|
+
// Granular account state control
|
|
222
|
+
switch (user.accountStatus) {
|
|
223
|
+
case AccountStatus.PendingEmailVerification:
|
|
224
|
+
// Send verification email
|
|
225
|
+
break;
|
|
226
|
+
case AccountStatus.Active:
|
|
227
|
+
// Full access granted
|
|
228
|
+
break;
|
|
229
|
+
case AccountStatus.AdminLock:
|
|
230
|
+
// Requires admin intervention
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Framework Integration (Built by Other Projects)
|
|
236
|
+
|
|
237
|
+
The **@digitaldefiance/node-ecies** and **@digitaldefiance/node-express-suite** packages use these primitives to build:
|
|
238
|
+
|
|
239
|
+
- **Complete Express.js framework** with middleware, routes, and database integration
|
|
240
|
+
- **Frontend framework adapters** for React, Vue, Angular, and Svelte
|
|
241
|
+
- **Mobile and desktop SDKs** for React Native, Flutter, Electron, and Tauri
|
|
242
|
+
- **DevOps and deployment tools** with Docker, Kubernetes, and CI/CD integration
|
|
243
|
+
|
|
244
|
+
## 🧪 Testing & Quality
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Run the comprehensive test suite
|
|
248
|
+
yarn test
|
|
249
|
+
|
|
250
|
+
# 104 tests covering:
|
|
251
|
+
# ✅ Type safety and interface validation
|
|
252
|
+
# ✅ Cryptographic security functions
|
|
253
|
+
# ✅ Multi-language localization
|
|
254
|
+
# ✅ Error handling and edge cases
|
|
255
|
+
# ✅ Integration scenarios
|
|
256
|
+
# ✅ Performance benchmarks
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## 🤝 Contributing
|
|
260
|
+
|
|
261
|
+
We welcome contributions to help build the future of secure user management! Areas where we need help:
|
|
262
|
+
|
|
263
|
+
- **Frontend component libraries** for popular frameworks
|
|
264
|
+
- **Additional language translations** and localization
|
|
265
|
+
- **Performance optimizations** and benchmarking
|
|
266
|
+
- **Documentation** and example applications
|
|
267
|
+
- **Security auditing** and penetration testing
|
|
268
|
+
|
|
269
|
+
## 📄 License
|
|
270
|
+
|
|
271
|
+
MIT © [Digital Defiance](https://github.com/digitaldefiance)
|
|
272
|
+
|
|
273
|
+
## 🔗 Ecosystem Projects
|
|
274
|
+
|
|
275
|
+
### Foundation Libraries (This Package Uses)
|
|
276
|
+
|
|
277
|
+
- [`@digitaldefiance/ecies-lib`](https://www.npmjs.com/package/@digitaldefiance/ecies-lib) - ECIES encryption foundation
|
|
278
|
+
- [`@digitaldefiance/i18n-lib`](https://www.npmjs.com/package/@digitaldefiance/i18n-lib) - Plugin-based internationalization
|
|
279
|
+
- [`@digitaldefiance/node-ecies-lib`](https://www.npmjs.com/package/@digitaldefiance/node-ecies-lib) - Node.js crypto utilities
|
|
280
|
+
|
|
281
|
+
### Framework Projects (That Use This Package)
|
|
282
|
+
|
|
283
|
+
- **i18n-lib** - Internationalization framework with plugin support
|
|
284
|
+
- **node-ecies** - Cryptographic framework and security protocols
|
|
285
|
+
- **node-express-suite** - Complete Express.js framework with authentication, database integration, and API generation
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
**Building user management primitives?** Start with `@digitaldefiance/suite-core-lib` for type-safe, secure, and internationalized user system foundations. For complete frameworks, check out the **node-ecies** and **node-express-suite** projects! 🚀
|
|
290
|
+
|
|
291
|
+
## ChangeLog
|
|
292
|
+
|
|
293
|
+
## v1.0.0: Initial release of user system package
|
|
294
|
+
|
|
295
|
+
- Sun Oct 12 2025 13:26:37 GMT-0700 (Pacific Daylight Time)
|
|
296
|
+
- Initial release of `@digitaldefiance/suite-core-lib` with core user management primitives, type-safe interfaces, secure backup code system, localized error handling, and multi-language support.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SecureString } from '@digitaldefiance/ecies-lib';
|
|
2
|
+
export declare class BackupCodeString extends SecureString {
|
|
3
|
+
private readonly _normalizedCode;
|
|
4
|
+
constructor(code: string);
|
|
5
|
+
get value(): string;
|
|
6
|
+
get notNullValue(): string;
|
|
7
|
+
get valueAsHexString(): string;
|
|
8
|
+
get valueAsBase64String(): string;
|
|
9
|
+
get valueAsUint8Array(): Uint8Array;
|
|
10
|
+
/**
|
|
11
|
+
* Format a 32-char normalized code into display form (8 groups of 4).
|
|
12
|
+
* Does not restrict characters beyond grouping.
|
|
13
|
+
*/
|
|
14
|
+
static formatBackupCode(code: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Normalize user-entered code: remove spaces and hyphens, lowercase, and trim.
|
|
17
|
+
*/
|
|
18
|
+
static normalizeCode(input: string): string;
|
|
19
|
+
static generateBackupCode(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Generate the configured number of backup codes.
|
|
22
|
+
* Note: If generation alphabet/length is controlled elsewhere, prefer that path.
|
|
23
|
+
*/
|
|
24
|
+
static generateBackupCodes(): Array<BackupCodeString>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=backup-code-string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-code-string.d.ts","sourceRoot":"","sources":["../src/backup-code-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;gBAE7B,IAAI,EAAE,MAAM;IASxB,IAAoB,KAAK,IAAI,MAAM,CAElC;IAED,IAAoB,YAAY,IAAI,MAAM,CAEzC;IAED,IAAoB,gBAAgB,IAAI,MAAM,CAO7C;IAED,IAAoB,mBAAmB,IAAI,MAAM,CAKhD;IAED,IAAoB,iBAAiB,IAAI,UAAU,CAKlD;IAED;;;OAGG;WACW,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIpD;;OAEG;WACW,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;WAIpC,kBAAkB,IAAI,MAAM;IAU1C;;;OAGG;WACW,mBAAmB,IAAI,KAAK,CAAC,gBAAgB,CAAC;CAO7D"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackupCodeString = void 0;
|
|
4
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const invalid_backup_code_1 = require("./errors/invalid-backup-code");
|
|
7
|
+
class BackupCodeString extends ecies_lib_1.SecureString {
|
|
8
|
+
constructor(code) {
|
|
9
|
+
const normalizedCode = BackupCodeString.normalizeCode(code);
|
|
10
|
+
if (!constants_1.Constants.BACKUP_CODES.NormalizedHexRegex.test(normalizedCode)) {
|
|
11
|
+
throw new invalid_backup_code_1.InvalidBackupCodeError();
|
|
12
|
+
}
|
|
13
|
+
super(normalizedCode);
|
|
14
|
+
this._normalizedCode = normalizedCode;
|
|
15
|
+
}
|
|
16
|
+
get value() {
|
|
17
|
+
return this.notNullValue;
|
|
18
|
+
}
|
|
19
|
+
get notNullValue() {
|
|
20
|
+
return BackupCodeString.formatBackupCode(this._normalizedCode);
|
|
21
|
+
}
|
|
22
|
+
get valueAsHexString() {
|
|
23
|
+
const formattedValue = BackupCodeString.formatBackupCode(this._normalizedCode);
|
|
24
|
+
return new TextEncoder().encode(formattedValue).reduce((str, byte) => {
|
|
25
|
+
return str + byte.toString(16).padStart(2, '0');
|
|
26
|
+
}, '');
|
|
27
|
+
}
|
|
28
|
+
get valueAsBase64String() {
|
|
29
|
+
const formattedValue = BackupCodeString.formatBackupCode(this._normalizedCode);
|
|
30
|
+
return btoa(formattedValue);
|
|
31
|
+
}
|
|
32
|
+
get valueAsUint8Array() {
|
|
33
|
+
const formattedValue = BackupCodeString.formatBackupCode(this._normalizedCode);
|
|
34
|
+
return new TextEncoder().encode(formattedValue);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Format a 32-char normalized code into display form (8 groups of 4).
|
|
38
|
+
* Does not restrict characters beyond grouping.
|
|
39
|
+
*/
|
|
40
|
+
static formatBackupCode(code) {
|
|
41
|
+
const groups = code.match(/.{1,4}/g) ?? [code];
|
|
42
|
+
return groups.join('-');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Normalize user-entered code: remove spaces and hyphens, lowercase, and trim.
|
|
46
|
+
*/
|
|
47
|
+
static normalizeCode(input) {
|
|
48
|
+
return input.replace(/[\s-]/g, '').toLowerCase().trim();
|
|
49
|
+
}
|
|
50
|
+
static generateBackupCode() {
|
|
51
|
+
const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
52
|
+
const rnd = crypto.getRandomValues(new Uint8Array(32));
|
|
53
|
+
let raw = '';
|
|
54
|
+
for (let j = 0; j < 32; j++) {
|
|
55
|
+
raw += alphabet[rnd[j] % alphabet.length];
|
|
56
|
+
}
|
|
57
|
+
return raw;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Generate the configured number of backup codes.
|
|
61
|
+
* Note: If generation alphabet/length is controlled elsewhere, prefer that path.
|
|
62
|
+
*/
|
|
63
|
+
static generateBackupCodes() {
|
|
64
|
+
const codes = [];
|
|
65
|
+
for (let i = 0; i < constants_1.Constants.BACKUP_CODES.Count; i++) {
|
|
66
|
+
codes.push(new BackupCodeString(BackupCodeString.generateBackupCode()));
|
|
67
|
+
}
|
|
68
|
+
return codes;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.BackupCodeString = BackupCodeString;
|
|
72
|
+
//# sourceMappingURL=backup-code-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-code-string.js","sourceRoot":"","sources":["../src/backup-code-string.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,oBAOjB,CAAC;AAEX,eAAO,MAAM,SAAS,EAAE,UAEvB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Constants = exports.BACKUP_CODES = void 0;
|
|
4
|
+
exports.BACKUP_CODES = {
|
|
5
|
+
/**
|
|
6
|
+
* How many backup codes to generate for users
|
|
7
|
+
*/
|
|
8
|
+
Count: 10,
|
|
9
|
+
NormalizedHexRegex: /^[a-z0-9]{32}$/, // exactly 32 lowercase alphanumeric chars
|
|
10
|
+
DisplayRegex: /^([a-z0-9]{4}-){7}[a-z0-9]{4}$/, // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx
|
|
11
|
+
};
|
|
12
|
+
exports.Constants = {
|
|
13
|
+
BACKUP_CODES: exports.BACKUP_CODES,
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAGa,QAAA,YAAY,GAAyB;IAChD;;OAEG;IACH,KAAK,EAAE,EAAW;IAClB,kBAAkB,EAAE,gBAAgB,EAAE,0CAA0C;IAChF,YAAY,EAAE,gCAAgC,EAAE,0CAA0C;CAClF,CAAC;AAEE,QAAA,SAAS,GAAe;IACnC,YAAY,EAAZ,oBAAY;CACb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values for the status of an account.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum AccountStatus {
|
|
5
|
+
/**
|
|
6
|
+
* The user has not verified their email address
|
|
7
|
+
*/
|
|
8
|
+
PendingEmailVerification = "PendingEmailVerification",
|
|
9
|
+
/**
|
|
10
|
+
* The user has verified their email address
|
|
11
|
+
*/
|
|
12
|
+
Active = "Active",
|
|
13
|
+
/**
|
|
14
|
+
* The user has been locked by an admin
|
|
15
|
+
*/
|
|
16
|
+
AdminLock = "AdminLock"
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=account-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-status.d.ts","sourceRoot":"","sources":["../../src/enumerations/account-status.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa;IACvB;;OAEG;IACH,wBAAwB,6BAA6B;IACrD;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,SAAS,cAAc;CACxB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Values for the status of an account.
|
|
6
|
+
*/
|
|
7
|
+
var AccountStatus;
|
|
8
|
+
(function (AccountStatus) {
|
|
9
|
+
/**
|
|
10
|
+
* The user has not verified their email address
|
|
11
|
+
*/
|
|
12
|
+
AccountStatus["PendingEmailVerification"] = "PendingEmailVerification";
|
|
13
|
+
/**
|
|
14
|
+
* The user has verified their email address
|
|
15
|
+
*/
|
|
16
|
+
AccountStatus["Active"] = "Active";
|
|
17
|
+
/**
|
|
18
|
+
* The user has been locked by an admin
|
|
19
|
+
*/
|
|
20
|
+
AccountStatus["AdminLock"] = "AdminLock";
|
|
21
|
+
})(AccountStatus || (exports.AccountStatus = AccountStatus = {}));
|
|
22
|
+
//# sourceMappingURL=account-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-status.js","sourceRoot":"","sources":["../../src/enumerations/account-status.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,aAaX;AAbD,WAAY,aAAa;IACvB;;OAEG;IACH,sEAAqD,CAAA;IACrD;;OAEG;IACH,kCAAiB,CAAA;IACjB;;OAEG;IACH,wCAAuB,CAAA;AACzB,CAAC,EAbW,aAAa,6BAAb,aAAa,QAaxB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum EmailTokenType {
|
|
2
|
+
/**
|
|
3
|
+
* A token for verifying an account
|
|
4
|
+
*/
|
|
5
|
+
AccountVerification = "AccountVerification",
|
|
6
|
+
/**
|
|
7
|
+
* A token for resetting a password
|
|
8
|
+
*/
|
|
9
|
+
PasswordReset = "PasswordReset",
|
|
10
|
+
/**
|
|
11
|
+
* Requests a login link
|
|
12
|
+
*/
|
|
13
|
+
LoginRequest = "LoginRequest",
|
|
14
|
+
/**
|
|
15
|
+
* Request encrypted private key blob for a user
|
|
16
|
+
* (requires username/email)
|
|
17
|
+
*/
|
|
18
|
+
PrivateKeyRequest = "PrivateKeyRequest",
|
|
19
|
+
/**
|
|
20
|
+
* Request encrypted mnemonic blob for a user
|
|
21
|
+
* (requires private key)
|
|
22
|
+
*/
|
|
23
|
+
MnemonicRecoveryRequest = "MnemonicRecoveryRequest"
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=email-token-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-token-type.d.ts","sourceRoot":"","sources":["../../src/enumerations/email-token-type.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB;;OAEG;IACH,mBAAmB,wBAAwB;IAC3C;;OAEG;IACH,aAAa,kBAAkB;IAC/B;;OAEG;IACH,YAAY,iBAAiB;IAC7B;;;OAGG;IACH,iBAAiB,sBAAsB;IACvC;;;OAGG;IACH,uBAAuB,4BAA4B;CACpD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailTokenType = void 0;
|
|
4
|
+
var EmailTokenType;
|
|
5
|
+
(function (EmailTokenType) {
|
|
6
|
+
/**
|
|
7
|
+
* A token for verifying an account
|
|
8
|
+
*/
|
|
9
|
+
EmailTokenType["AccountVerification"] = "AccountVerification";
|
|
10
|
+
/**
|
|
11
|
+
* A token for resetting a password
|
|
12
|
+
*/
|
|
13
|
+
EmailTokenType["PasswordReset"] = "PasswordReset";
|
|
14
|
+
/**
|
|
15
|
+
* Requests a login link
|
|
16
|
+
*/
|
|
17
|
+
EmailTokenType["LoginRequest"] = "LoginRequest";
|
|
18
|
+
/**
|
|
19
|
+
* Request encrypted private key blob for a user
|
|
20
|
+
* (requires username/email)
|
|
21
|
+
*/
|
|
22
|
+
EmailTokenType["PrivateKeyRequest"] = "PrivateKeyRequest";
|
|
23
|
+
/**
|
|
24
|
+
* Request encrypted mnemonic blob for a user
|
|
25
|
+
* (requires private key)
|
|
26
|
+
*/
|
|
27
|
+
EmailTokenType["MnemonicRecoveryRequest"] = "MnemonicRecoveryRequest";
|
|
28
|
+
})(EmailTokenType || (exports.EmailTokenType = EmailTokenType = {}));
|
|
29
|
+
//# sourceMappingURL=email-token-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-token-type.js","sourceRoot":"","sources":["../../src/enumerations/email-token-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAuBX;AAvBD,WAAY,cAAc;IACxB;;OAEG;IACH,6DAA2C,CAAA;IAC3C;;OAEG;IACH,iDAA+B,CAAA;IAC/B;;OAEG;IACH,+CAA6B,CAAA;IAC7B;;;OAGG;IACH,yDAAuC,CAAA;IACvC;;;OAGG;IACH,qEAAmD,CAAA;AACrD,CAAC,EAvBW,cAAc,8BAAd,cAAc,QAuBzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/enumerations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account-status"), exports);
|
|
18
|
+
__exportStar(require("./email-token-type"), exports);
|
|
19
|
+
__exportStar(require("./role"), exports);
|
|
20
|
+
__exportStar(require("./suite-core-string-key"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enumerations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,qDAAmC;AACnC,yCAAuB;AACvB,0DAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/enumerations/role.ts"],"names":[],"mappings":"AAAA,oBAAY,IAAI;IACd,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Role = void 0;
|
|
4
|
+
var Role;
|
|
5
|
+
(function (Role) {
|
|
6
|
+
Role["Admin"] = "Admin";
|
|
7
|
+
Role["Member"] = "Member";
|
|
8
|
+
Role["System"] = "System";
|
|
9
|
+
})(Role || (exports.Role = Role = {}));
|
|
10
|
+
//# sourceMappingURL=role.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.js","sourceRoot":"","sources":["../../src/enumerations/role.ts"],"names":[],"mappings":";;;AAAA,IAAY,IAIX;AAJD,WAAY,IAAI;IACd,uBAAe,CAAA;IACf,yBAAiB,CAAA;IACjB,yBAAiB,CAAA;AACnB,CAAC,EAJW,IAAI,oBAAJ,IAAI,QAIf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum SuiteCoreStringKey {
|
|
2
|
+
Validation_UsernameInUse = "Validation_UsernameInUse",
|
|
3
|
+
Validation_EmailInUse = "Validation_EmailInUse",
|
|
4
|
+
Validation_InvalidUsername = "Validation_InvalidUsername",
|
|
5
|
+
Validation_InvalidEmail = "Validation_InvalidEmail",
|
|
6
|
+
Validation_PasswordTooWeak = "Validation_PasswordTooWeak",
|
|
7
|
+
Validation_InvalidCredentials = "Validation_InvalidCredentials",
|
|
8
|
+
Validation_UsernameOrEmailRequired = "Validation_UsernameOrEmailRequired",
|
|
9
|
+
Auth_UserNotFound = "Auth_UserNotFound",
|
|
10
|
+
Auth_AccountLocked = "Auth_AccountLocked",
|
|
11
|
+
Auth_TokenExpired = "Auth_TokenExpired",
|
|
12
|
+
Auth_InvalidToken = "Auth_InvalidToken",
|
|
13
|
+
Auth_InsufficientPermissions = "Auth_InsufficientPermissions",
|
|
14
|
+
User_CreationFailed = "User_CreationFailed",
|
|
15
|
+
User_UpdateFailed = "User_UpdateFailed",
|
|
16
|
+
User_DeletionFailed = "User_DeletionFailed",
|
|
17
|
+
User_NotFound = "User_NotFound",
|
|
18
|
+
User_AlreadyExists = "User_AlreadyExists",
|
|
19
|
+
Error_AccountStatus_Active = "Error_AccountStatus_Active",
|
|
20
|
+
Error_AccountStatus_AdminLock = "Error_AccountStatus_AdminLock",
|
|
21
|
+
Error_AccountStatus_PendingEmailVerification = "Error_AccountStatus_PendingEmailVerification"
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=suite-core-string-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite-core-string-key.d.ts","sourceRoot":"","sources":["../../src/enumerations/suite-core-string-key.ts"],"names":[],"mappings":"AAAA,oBAAY,kBAAkB;IAE5B,wBAAwB,6BAA6B;IACrD,qBAAqB,0BAA0B;IAC/C,0BAA0B,+BAA+B;IACzD,uBAAuB,4BAA4B;IACnD,0BAA0B,+BAA+B;IACzD,6BAA6B,kCAAkC;IAC/D,kCAAkC,uCAAuC;IAGzE,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,4BAA4B,iCAAiC;IAG7D,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,mBAAmB,wBAAwB;IAC3C,aAAa,kBAAkB;IAC/B,kBAAkB,uBAAuB;IAGzC,0BAA0B,+BAA+B;IACzD,6BAA6B,kCAAkC;IAC/D,4CAA4C,iDAAiD;CAC9F"}
|