@breadstone/archipel-platform-authentication 0.0.21 → 0.0.23
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/README.md +3 -3
- package/package.json +17 -8
- package/src/AuthModule.js +5 -3
- package/src/contracts/IMfaSubjectUpdate.d.ts +1 -1
- package/src/contracts/IStoreSessionArgs.d.ts +1 -1
- package/src/env.js +4 -4
- package/src/mappers/SessionMappingProfile.d.ts +3 -3
- package/src/mappers/SessionMappingProfile.js +4 -4
- package/src/mfa/MfaService.js +1 -1
- package/src/services/SessionService.d.ts +2 -2
- package/src/services/SessionService.js +2 -2
- /package/src/mfa/{MfaTokens.d.ts → tokens/MfaTokens.d.ts} +0 -0
- /package/src/mfa/{MfaTokens.js → tokens/MfaTokens.js} +0 -0
package/README.md
CHANGED
|
@@ -35,9 +35,9 @@ import { AuthModule } from '@breadstone/archipel-platform-authentication';
|
|
|
35
35
|
mfaSubject: PrismaMfaSubjectAdapter,
|
|
36
36
|
sessionPersistence: PrismaSessionAdapter,
|
|
37
37
|
verificationSubject: PrismaVerificationAdapter,
|
|
38
|
-
challengeStore: RedisChallengeStore, // optional
|
|
39
|
-
socialAuth: PrismaSocialAuthAdapter, // optional
|
|
40
|
-
tokenEnricher: AppTokenEnricherAdapter, // optional
|
|
38
|
+
challengeStore: RedisChallengeStore, // optional - defaults to in-memory
|
|
39
|
+
socialAuth: PrismaSocialAuthAdapter, // optional - enables OAuth
|
|
40
|
+
tokenEnricher: AppTokenEnricherAdapter, // optional - enriches JWT claims
|
|
41
41
|
}),
|
|
42
42
|
],
|
|
43
43
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone/archipel-platform-authentication",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "JWT and OAuth authentication, MFA, session management, and email verification for NestJS applications.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -81,13 +81,11 @@
|
|
|
81
81
|
"README.md"
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@breadstone/archipel-platform-configuration": "0.0.
|
|
85
|
-
"@breadstone/archipel-platform-core": "0.0.
|
|
86
|
-
"@breadstone/archipel-platform-cryptography": "0.0.
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"passport-jwt": "4.0.1",
|
|
90
|
-
"passport-local": "1.0.0",
|
|
84
|
+
"@breadstone/archipel-platform-configuration": "0.0.23",
|
|
85
|
+
"@breadstone/archipel-platform-core": "0.0.23",
|
|
86
|
+
"@breadstone/archipel-platform-cryptography": "0.0.23",
|
|
87
|
+
"@breadstone/archipel-platform-mapping": "0.0.23",
|
|
88
|
+
"@breadstone/archipel-platform-resources": "0.0.23",
|
|
91
89
|
"tslib": "2.8.1"
|
|
92
90
|
},
|
|
93
91
|
"peerDependencies": {
|
|
@@ -99,9 +97,13 @@
|
|
|
99
97
|
"class-transformer": ">=0.5.0",
|
|
100
98
|
"class-validator": ">=0.14.0",
|
|
101
99
|
"express": ">=5.0.0",
|
|
100
|
+
"passport": ">=0.7.0",
|
|
102
101
|
"passport-apple": "^2.0.2",
|
|
102
|
+
"passport-custom": ">=1.1.0",
|
|
103
103
|
"passport-github2": "^0.1.12",
|
|
104
104
|
"passport-google-oauth20": "^2.0.0",
|
|
105
|
+
"passport-jwt": ">=4.0.0",
|
|
106
|
+
"passport-local": ">=1.0.0",
|
|
105
107
|
"passport-microsoft": "^2.1.0",
|
|
106
108
|
"rxjs": ">=7.0.0"
|
|
107
109
|
},
|
|
@@ -109,6 +111,9 @@
|
|
|
109
111
|
"passport-apple": {
|
|
110
112
|
"optional": true
|
|
111
113
|
},
|
|
114
|
+
"passport-custom": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
112
117
|
"passport-github2": {
|
|
113
118
|
"optional": true
|
|
114
119
|
},
|
|
@@ -135,6 +140,10 @@
|
|
|
135
140
|
"class-transformer": "0.5.1",
|
|
136
141
|
"class-validator": "0.15.1",
|
|
137
142
|
"express": "5.2.1",
|
|
143
|
+
"passport": "0.7.0",
|
|
144
|
+
"passport-custom": "1.1.1",
|
|
145
|
+
"passport-jwt": "4.0.1",
|
|
146
|
+
"passport-local": "1.0.0",
|
|
138
147
|
"rxjs": "7.8.2",
|
|
139
148
|
"vitest": "4.1.4"
|
|
140
149
|
}
|
package/src/AuthModule.js
CHANGED
|
@@ -6,7 +6,9 @@ exports.AuthModule = void 0;
|
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const archipel_platform_configuration_1 = require("@breadstone/archipel-platform-configuration");
|
|
8
8
|
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
9
|
+
const device_1 = require("@breadstone/archipel-platform-core/device");
|
|
9
10
|
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
11
|
+
const archipel_platform_mapping_1 = require("@breadstone/archipel-platform-mapping");
|
|
10
12
|
const common_1 = require("@nestjs/common");
|
|
11
13
|
const jwt_1 = require("@nestjs/jwt");
|
|
12
14
|
const passport_1 = require("@nestjs/passport");
|
|
@@ -32,7 +34,7 @@ const PushMfaChannel_1 = require("./mfa/channels/PushMfaChannel");
|
|
|
32
34
|
const SmsMfaChannel_1 = require("./mfa/channels/SmsMfaChannel");
|
|
33
35
|
const MfaEncryptionService_1 = require("./mfa/MfaEncryptionService");
|
|
34
36
|
const MfaService_1 = require("./mfa/MfaService");
|
|
35
|
-
const MfaTokens_1 = require("./mfa/MfaTokens");
|
|
37
|
+
const MfaTokens_1 = require("./mfa/tokens/MfaTokens");
|
|
36
38
|
const middlewares_1 = require("./middlewares");
|
|
37
39
|
const SessionSerializer_1 = require("./serializer/SessionSerializer");
|
|
38
40
|
const AuthTokenService_1 = require("./services/AuthTokenService");
|
|
@@ -119,7 +121,7 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
119
121
|
};
|
|
120
122
|
},
|
|
121
123
|
}),
|
|
122
|
-
|
|
124
|
+
archipel_platform_mapping_1.MappingModule.withProfiles([SessionMappingProfile_1.SessionMappingProfile]),
|
|
123
125
|
],
|
|
124
126
|
providers: [
|
|
125
127
|
...portProviders,
|
|
@@ -143,7 +145,7 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
143
145
|
useFactory: (...channels) => channels,
|
|
144
146
|
inject: allMfaChannels,
|
|
145
147
|
},
|
|
146
|
-
|
|
148
|
+
device_1.DeviceParserService,
|
|
147
149
|
middlewares_1.LastActiveMiddleware,
|
|
148
150
|
archipel_platform_cryptography_1.BcryptService,
|
|
149
151
|
archipel_platform_cryptography_1.CryptoService,
|
package/src/env.js
CHANGED
|
@@ -112,7 +112,7 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
|
|
|
112
112
|
required: true,
|
|
113
113
|
description: 'Lifetime of email-verification JWTs.',
|
|
114
114
|
},
|
|
115
|
-
// MFA
|
|
115
|
+
// MFA - General
|
|
116
116
|
{
|
|
117
117
|
key: exports.AUTH_MFA_ENCRYPTION_KEY,
|
|
118
118
|
required: true,
|
|
@@ -135,7 +135,7 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
|
|
|
135
135
|
required: true,
|
|
136
136
|
description: 'Issuer name shown in authenticator apps for TOTP MFA.',
|
|
137
137
|
},
|
|
138
|
-
// MFA
|
|
138
|
+
// MFA - SMS
|
|
139
139
|
{
|
|
140
140
|
key: exports.AUTH_MFA_SMS_CODE_TTL,
|
|
141
141
|
required: false,
|
|
@@ -148,7 +148,7 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
|
|
|
148
148
|
defaultValue: '30s',
|
|
149
149
|
description: 'Min interval between SMS resends.',
|
|
150
150
|
},
|
|
151
|
-
// MFA
|
|
151
|
+
// MFA - Email
|
|
152
152
|
{
|
|
153
153
|
key: exports.AUTH_MFA_EMAIL_CODE_TTL,
|
|
154
154
|
required: false,
|
|
@@ -161,7 +161,7 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
|
|
|
161
161
|
defaultValue: '30s',
|
|
162
162
|
description: 'Min interval between email resends.',
|
|
163
163
|
},
|
|
164
|
-
// MFA
|
|
164
|
+
// MFA - Push
|
|
165
165
|
{
|
|
166
166
|
key: exports.AUTH_MFA_PUSH_CODE_TTL,
|
|
167
167
|
required: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMappingBuilder, MappingProfileBase } from '@breadstone/archipel-platform-
|
|
1
|
+
import { IMappingBuilder, MappingProfileBase } from '@breadstone/archipel-platform-mapping';
|
|
2
2
|
import type { ISessionRecord } from '../contracts/ISessionRecord';
|
|
3
3
|
import { SessionResponse } from '../models/responses/SessionResponse';
|
|
4
4
|
interface ISessionMappingInput {
|
|
@@ -10,13 +10,13 @@ interface ISessionMappingInput {
|
|
|
10
10
|
*
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
|
-
export declare const SESSION_MAPPING_KEY: import("@breadstone/archipel-platform-
|
|
13
|
+
export declare const SESSION_MAPPING_KEY: import("@breadstone/archipel-platform-mapping").IMappingKey<ISessionMappingInput, SessionResponse>;
|
|
14
14
|
/**
|
|
15
15
|
* Type-safe mapping key for Session entity list to response list transformation.
|
|
16
16
|
*
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
export declare const SESSION_LIST_MAPPING_KEY: import("@breadstone/archipel-platform-
|
|
19
|
+
export declare const SESSION_LIST_MAPPING_KEY: import("@breadstone/archipel-platform-mapping").IMappingKey<ISessionMappingInput[], SessionResponse[]>;
|
|
20
20
|
/**
|
|
21
21
|
* Mapping profile for Session entity to response transformations.
|
|
22
22
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SessionMappingProfile = exports.SESSION_LIST_MAPPING_KEY = exports.SESSION_MAPPING_KEY = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const
|
|
6
|
+
const archipel_platform_mapping_1 = require("@breadstone/archipel-platform-mapping");
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const SessionResponse_1 = require("../models/responses/SessionResponse");
|
|
9
9
|
/**
|
|
@@ -11,19 +11,19 @@ const SessionResponse_1 = require("../models/responses/SessionResponse");
|
|
|
11
11
|
*
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
exports.SESSION_MAPPING_KEY = (0,
|
|
14
|
+
exports.SESSION_MAPPING_KEY = (0, archipel_platform_mapping_1.createMappingKey)('session.entity-to-response');
|
|
15
15
|
/**
|
|
16
16
|
* Type-safe mapping key for Session entity list to response list transformation.
|
|
17
17
|
*
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
|
-
exports.SESSION_LIST_MAPPING_KEY = (0,
|
|
20
|
+
exports.SESSION_LIST_MAPPING_KEY = (0, archipel_platform_mapping_1.createMappingKey)('session.entity-list-to-response');
|
|
21
21
|
/**
|
|
22
22
|
* Mapping profile for Session entity to response transformations.
|
|
23
23
|
*
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
26
|
-
let SessionMappingProfile = class SessionMappingProfile extends
|
|
26
|
+
let SessionMappingProfile = class SessionMappingProfile extends archipel_platform_mapping_1.MappingProfileBase {
|
|
27
27
|
// #region Methods
|
|
28
28
|
/**
|
|
29
29
|
* Configure mappings for Session entity.
|
package/src/mfa/MfaService.js
CHANGED
|
@@ -9,7 +9,7 @@ const node_crypto_1 = require("node:crypto");
|
|
|
9
9
|
const MfaSubjectPort_1 = require("../contracts/MfaSubjectPort");
|
|
10
10
|
const MfaEncryptionService_1 = require("./MfaEncryptionService");
|
|
11
11
|
const MfaState_1 = require("./MfaState");
|
|
12
|
-
const MfaTokens_1 = require("./MfaTokens");
|
|
12
|
+
const MfaTokens_1 = require("./tokens/MfaTokens");
|
|
13
13
|
// #endregion
|
|
14
14
|
/**
|
|
15
15
|
* Orchestrates MFA channels, backup codes, and user preferences.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IDeviceInfo } from '@breadstone/archipel-platform-core';
|
|
2
|
-
import { MappingService } from '@breadstone/archipel-platform-
|
|
1
|
+
import type { IDeviceInfo } from '@breadstone/archipel-platform-core/device';
|
|
2
|
+
import { MappingService } from '@breadstone/archipel-platform-mapping';
|
|
3
3
|
import { SessionPersistencePort } from '../contracts/SessionPersistencePort';
|
|
4
4
|
import { SessionResponse } from '../models';
|
|
5
5
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SessionService = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const
|
|
6
|
+
const archipel_platform_mapping_1 = require("@breadstone/archipel-platform-mapping");
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const SessionPersistencePort_1 = require("../contracts/SessionPersistencePort");
|
|
9
9
|
const SessionMappingProfile_1 = require("../mappers/SessionMappingProfile");
|
|
@@ -118,6 +118,6 @@ let SessionService = class SessionService {
|
|
|
118
118
|
exports.SessionService = SessionService;
|
|
119
119
|
exports.SessionService = SessionService = tslib_1.__decorate([
|
|
120
120
|
(0, common_1.Injectable)(),
|
|
121
|
-
tslib_1.__metadata("design:paramtypes", [SessionPersistencePort_1.SessionPersistencePort,
|
|
121
|
+
tslib_1.__metadata("design:paramtypes", [SessionPersistencePort_1.SessionPersistencePort, archipel_platform_mapping_1.MappingService])
|
|
122
122
|
], SessionService);
|
|
123
123
|
//# sourceMappingURL=SessionService.js.map
|
|
File without changes
|
|
File without changes
|