@breadstone/archipel-platform-authentication 0.0.9 → 0.0.11

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/env.js +38 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breadstone/archipel-platform-authentication",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
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,8 +81,8 @@
81
81
  "README.md"
82
82
  ],
83
83
  "dependencies": {
84
- "@breadstone/archipel-platform-core": "0.0.9",
85
- "@breadstone/archipel-platform-cryptography": "0.0.9",
84
+ "@breadstone/archipel-platform-core": "0.0.11",
85
+ "@breadstone/archipel-platform-cryptography": "0.0.11",
86
86
  "passport": "0.7.0",
87
87
  "passport-custom": "1.1.1",
88
88
  "passport-jwt": "4.0.1",
package/src/env.js CHANGED
@@ -4,18 +4,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = exports.SEED_ANONYMOUS_USERNAME = exports.AUTH_GITHUB_SCOPE = exports.AUTH_GITHUB_CALLBACK_URL = exports.AUTH_GITHUB_CLIENT_SECRET = exports.AUTH_GITHUB_CLIENT_ID = exports.AUTH_APPLE_SCOPE = exports.AUTH_APPLE_CALLBACK_URL = exports.AUTH_APPLE_KEY_ID = exports.AUTH_APPLE_TEAM_ID = exports.AUTH_APPLE_CLIENT_ID = exports.AUTH_APPLE_PRIVATE_KEY = exports.AUTH_MICROSOFT_SCOPE = exports.AUTH_MICROSOFT_TENANT = exports.AUTH_MICROSOFT_CALLBACK_URL = exports.AUTH_MICROSOFT_CLIENT_SECRET = exports.AUTH_MICROSOFT_CLIENT_ID = exports.AUTH_GOOGLE_SCOPE = exports.AUTH_GOOGLE_CALLBACK_URL = exports.AUTH_GOOGLE_CLIENT_SECRET = exports.AUTH_GOOGLE_CLIENT_ID = exports.AUTH_MFA_PUSH_MIN_RESEND = exports.AUTH_MFA_PUSH_CODE_TTL = exports.AUTH_MFA_EMAIL_MIN_RESEND = exports.AUTH_MFA_EMAIL_CODE_TTL = exports.AUTH_MFA_SMS_MIN_RESEND = exports.AUTH_MFA_SMS_CODE_TTL = exports.AUTH_MFA_ISSUER = exports.AUTH_MFA_MAX_ATTEMPTS = exports.AUTH_MFA_CHALLENGE_EXPIRES_IN = exports.AUTH_MFA_ENCRYPTION_KEY = exports.AUTH_VERIFY_JWT_EXPIRES_IN = exports.AUTH_JWT_EXPIRES_IN = exports.AUTH_JWT_SECRET = void 0;
5
5
  const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
6
6
  // #endregion
7
- // ──────────────────────────────────────────────────────────────
8
- // JWT & Session
9
- // ──────────────────────────────────────────────────────────────
10
7
  /** Secret used to sign JWTs. */
11
8
  exports.AUTH_JWT_SECRET = (0, archipel_platform_core_1.createConfigKey)('AUTH_JWT_SECRET');
12
9
  /** Lifetime of access tokens (e.g. `'15m'`, `'1h'`). */
13
10
  exports.AUTH_JWT_EXPIRES_IN = (0, archipel_platform_core_1.createConfigKey)('AUTH_JWT_EXPIRES_IN');
14
11
  /** Lifetime of email-verification JWTs. */
15
12
  exports.AUTH_VERIFY_JWT_EXPIRES_IN = (0, archipel_platform_core_1.createConfigKey)('AUTH_VERIFY_JWT_EXPIRES_IN');
16
- // ──────────────────────────────────────────────────────────────
17
- // MFA — General
18
- // ──────────────────────────────────────────────────────────────
19
13
  /** AES encryption key used to encrypt MFA secrets at rest. */
20
14
  exports.AUTH_MFA_ENCRYPTION_KEY = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_ENCRYPTION_KEY');
21
15
  /** How long an MFA challenge stays valid (e.g. `'5m'`). */
@@ -24,30 +18,18 @@ exports.AUTH_MFA_CHALLENGE_EXPIRES_IN = (0, archipel_platform_core_1.createConfi
24
18
  exports.AUTH_MFA_MAX_ATTEMPTS = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_MAX_ATTEMPTS');
25
19
  /** Issuer name shown in authenticator apps for TOTP MFA. */
26
20
  exports.AUTH_MFA_ISSUER = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_ISSUER');
27
- // ──────────────────────────────────────────────────────────────
28
- // MFA — SMS Channel
29
- // ──────────────────────────────────────────────────────────────
30
21
  /** Time-to-live for SMS OTP codes (e.g. `'10m'`). */
31
22
  exports.AUTH_MFA_SMS_CODE_TTL = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_SMS_CODE_TTL');
32
23
  /** Minimum interval between SMS resend requests (e.g. `'30s'`). */
33
24
  exports.AUTH_MFA_SMS_MIN_RESEND = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_SMS_MIN_RESEND');
34
- // ──────────────────────────────────────────────────────────────
35
- // MFA — Email Channel
36
- // ──────────────────────────────────────────────────────────────
37
25
  /** Time-to-live for email OTP codes (e.g. `'10m'`). */
38
26
  exports.AUTH_MFA_EMAIL_CODE_TTL = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_EMAIL_CODE_TTL');
39
27
  /** Minimum interval between email OTP resend requests (e.g. `'30s'`). */
40
28
  exports.AUTH_MFA_EMAIL_MIN_RESEND = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_EMAIL_MIN_RESEND');
41
- // ──────────────────────────────────────────────────────────────
42
- // MFA — Push Channel
43
- // ──────────────────────────────────────────────────────────────
44
29
  /** Time-to-live for push OTP codes (e.g. `'10m'`). */
45
30
  exports.AUTH_MFA_PUSH_CODE_TTL = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_PUSH_CODE_TTL');
46
31
  /** Minimum interval between push OTP resend requests (e.g. `'30s'`). */
47
32
  exports.AUTH_MFA_PUSH_MIN_RESEND = (0, archipel_platform_core_1.createConfigKey)('AUTH_MFA_PUSH_MIN_RESEND');
48
- // ──────────────────────────────────────────────────────────────
49
- // OAuth — Google
50
- // ──────────────────────────────────────────────────────────────
51
33
  /** Google OAuth2 client ID. */
52
34
  exports.AUTH_GOOGLE_CLIENT_ID = (0, archipel_platform_core_1.createConfigKey)('AUTH_GOOGLE_CLIENT_ID');
53
35
  /** Google OAuth2 client secret. */
@@ -56,9 +38,6 @@ exports.AUTH_GOOGLE_CLIENT_SECRET = (0, archipel_platform_core_1.createConfigKey
56
38
  exports.AUTH_GOOGLE_CALLBACK_URL = (0, archipel_platform_core_1.createConfigKey)('AUTH_GOOGLE_CALLBACK_URL');
57
39
  /** Comma-separated list of Google OAuth scopes (e.g. `'email,profile'`). */
58
40
  exports.AUTH_GOOGLE_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_GOOGLE_SCOPE');
59
- // ──────────────────────────────────────────────────────────────
60
- // OAuth — Microsoft
61
- // ──────────────────────────────────────────────────────────────
62
41
  /** Microsoft OAuth2 client ID. */
63
42
  exports.AUTH_MICROSOFT_CLIENT_ID = (0, archipel_platform_core_1.createConfigKey)('AUTH_MICROSOFT_CLIENT_ID');
64
43
  /** Microsoft OAuth2 client secret. */
@@ -69,9 +48,6 @@ exports.AUTH_MICROSOFT_CALLBACK_URL = (0, archipel_platform_core_1.createConfigK
69
48
  exports.AUTH_MICROSOFT_TENANT = (0, archipel_platform_core_1.createConfigKey)('AUTH_MICROSOFT_TENANT');
70
49
  /** Comma-separated list of Microsoft OAuth scopes (e.g. `'user.read,mail.read'`). */
71
50
  exports.AUTH_MICROSOFT_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_MICROSOFT_SCOPE');
72
- // ──────────────────────────────────────────────────────────────
73
- // OAuth — Apple
74
- // ──────────────────────────────────────────────────────────────
75
51
  /** Apple Sign-In private key (PEM string). */
76
52
  exports.AUTH_APPLE_PRIVATE_KEY = (0, archipel_platform_core_1.createConfigKey)('AUTH_APPLE_PRIVATE_KEY');
77
53
  /** Apple Sign-In client (service) ID. */
@@ -84,9 +60,6 @@ exports.AUTH_APPLE_KEY_ID = (0, archipel_platform_core_1.createConfigKey)('AUTH_
84
60
  exports.AUTH_APPLE_CALLBACK_URL = (0, archipel_platform_core_1.createConfigKey)('AUTH_APPLE_CALLBACK_URL');
85
61
  /** Comma-separated list of Apple Sign-In scopes (e.g. `'name,email'`). */
86
62
  exports.AUTH_APPLE_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_APPLE_SCOPE');
87
- // ──────────────────────────────────────────────────────────────
88
- // OAuth — GitHub
89
- // ──────────────────────────────────────────────────────────────
90
63
  /** GitHub OAuth client ID. */
91
64
  exports.AUTH_GITHUB_CLIENT_ID = (0, archipel_platform_core_1.createConfigKey)('AUTH_GITHUB_CLIENT_ID');
92
65
  /** GitHub OAuth client secret. */
@@ -95,20 +68,26 @@ exports.AUTH_GITHUB_CLIENT_SECRET = (0, archipel_platform_core_1.createConfigKey
95
68
  exports.AUTH_GITHUB_CALLBACK_URL = (0, archipel_platform_core_1.createConfigKey)('AUTH_GITHUB_CALLBACK_URL');
96
69
  /** Comma-separated list of GitHub OAuth scopes (e.g. `'user:email,read:user'`). */
97
70
  exports.AUTH_GITHUB_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_GITHUB_SCOPE');
98
- // ──────────────────────────────────────────────────────────────
99
- // Seed / Misc
100
- // ──────────────────────────────────────────────────────────────
101
71
  /** Username used for the anonymous seed user. */
102
72
  exports.SEED_ANONYMOUS_USERNAME = (0, archipel_platform_core_1.createConfigKey)('SEED_ANONYMOUS_USERNAME');
103
- // ──────────────────────────────────────────────────────────────
104
- // Registry entries
105
- // ──────────────────────────────────────────────────────────────
106
73
  /** Core configuration entries required by `platform-authentication`. */
107
74
  exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
108
75
  // JWT & Session
109
- { key: exports.AUTH_JWT_SECRET, required: true, description: 'Secret used to sign JWTs.' },
110
- { key: exports.AUTH_JWT_EXPIRES_IN, required: true, description: 'Lifetime of access tokens.' },
111
- { key: exports.AUTH_VERIFY_JWT_EXPIRES_IN, required: true, description: 'Lifetime of email-verification JWTs.' },
76
+ {
77
+ key: exports.AUTH_JWT_SECRET,
78
+ required: true,
79
+ description: 'Secret used to sign JWTs.',
80
+ },
81
+ {
82
+ key: exports.AUTH_JWT_EXPIRES_IN,
83
+ required: true,
84
+ description: 'Lifetime of access tokens.',
85
+ },
86
+ {
87
+ key: exports.AUTH_VERIFY_JWT_EXPIRES_IN,
88
+ required: true,
89
+ description: 'Lifetime of email-verification JWTs.',
90
+ },
112
91
  // MFA — General
113
92
  {
114
93
  key: exports.AUTH_MFA_ENCRYPTION_KEY,
@@ -133,7 +112,12 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
133
112
  description: 'Issuer name shown in authenticator apps for TOTP MFA.',
134
113
  },
135
114
  // MFA — SMS
136
- { key: exports.AUTH_MFA_SMS_CODE_TTL, required: false, defaultValue: '10m', description: 'TTL for SMS OTP codes.' },
115
+ {
116
+ key: exports.AUTH_MFA_SMS_CODE_TTL,
117
+ required: false,
118
+ defaultValue: '10m',
119
+ description: 'TTL for SMS OTP codes.',
120
+ },
137
121
  {
138
122
  key: exports.AUTH_MFA_SMS_MIN_RESEND,
139
123
  required: false,
@@ -141,7 +125,12 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
141
125
  description: 'Min interval between SMS resends.',
142
126
  },
143
127
  // MFA — Email
144
- { key: exports.AUTH_MFA_EMAIL_CODE_TTL, required: false, defaultValue: '10m', description: 'TTL for email OTP codes.' },
128
+ {
129
+ key: exports.AUTH_MFA_EMAIL_CODE_TTL,
130
+ required: false,
131
+ defaultValue: '10m',
132
+ description: 'TTL for email OTP codes.',
133
+ },
145
134
  {
146
135
  key: exports.AUTH_MFA_EMAIL_MIN_RESEND,
147
136
  required: false,
@@ -149,7 +138,12 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
149
138
  description: 'Min interval between email resends.',
150
139
  },
151
140
  // MFA — Push
152
- { key: exports.AUTH_MFA_PUSH_CODE_TTL, required: false, defaultValue: '10m', description: 'TTL for push OTP codes.' },
141
+ {
142
+ key: exports.AUTH_MFA_PUSH_CODE_TTL,
143
+ required: false,
144
+ defaultValue: '10m',
145
+ description: 'TTL for push OTP codes.',
146
+ },
153
147
  {
154
148
  key: exports.AUTH_MFA_PUSH_MIN_RESEND,
155
149
  required: false,
@@ -157,6 +151,10 @@ exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = [
157
151
  description: 'Min interval between push resends.',
158
152
  },
159
153
  // Seed / Misc
160
- { key: exports.SEED_ANONYMOUS_USERNAME, required: true, description: 'Username for the anonymous seed user.' },
154
+ {
155
+ key: exports.SEED_ANONYMOUS_USERNAME,
156
+ required: true,
157
+ description: 'Username for the anonymous seed user.',
158
+ },
161
159
  ];
162
160
  //# sourceMappingURL=env.js.map