@logto/schemas 1.37.1 → 1.39.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/alterations/1.38.0-1772615848-add-oidc-model-instances-grant-id-partial-index.ts +26 -0
- package/alterations/1.38.0-1772619963-tune-oidc-model-instances-autovacuum.ts +28 -0
- package/alterations/1.38.0-1772621060-add-oidc-model-instances-grant-account-id-index.ts +26 -0
- package/alterations/1.39.0-1774752400-add-delete-account-url.ts +20 -0
- package/alterations/1.39.0-1774770686-add-account-center-custom-css.ts +20 -0
- package/alterations/1.39.0-1776502301-add-sign-up-profile-fields.ts +20 -0
- package/alterations-js/1.38.0-1772615848-add-oidc-model-instances-grant-id-partial-index.js +22 -0
- package/alterations-js/1.38.0-1772619963-tune-oidc-model-instances-autovacuum.js +24 -0
- package/alterations-js/1.38.0-1772621060-add-oidc-model-instances-grant-account-id-index.js +22 -0
- package/alterations-js/1.39.0-1774752400-add-delete-account-url.js +16 -0
- package/alterations-js/1.39.0-1774770686-add-account-center-custom-css.js +16 -0
- package/alterations-js/1.39.0-1776502301-add-sign-up-profile-fields.js +16 -0
- package/lib/consts/cookie.d.ts +1 -0
- package/lib/consts/cookie.js +1 -0
- package/lib/consts/experience.d.ts +1 -0
- package/lib/consts/experience.js +1 -0
- package/lib/consts/oidc.d.ts +3 -0
- package/lib/consts/oidc.js +3 -0
- package/lib/consts/system.d.ts +4 -0
- package/lib/consts/system.js +4 -0
- package/lib/db-entries/account-center.d.ts +9 -1
- package/lib/db-entries/account-center.js +8 -0
- package/lib/db-entries/sign-in-experience.d.ts +6 -2
- package/lib/db-entries/sign-in-experience.js +5 -1
- package/lib/foundations/jsonb-types/account-centers.d.ts +1 -0
- package/lib/foundations/jsonb-types/account-centers.js +8 -0
- package/lib/foundations/jsonb-types/oidc-module.d.ts +26 -7
- package/lib/foundations/jsonb-types/oidc-module.js +16 -1
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +36 -6
- package/lib/foundations/jsonb-types/sign-in-experience.js +10 -2
- package/lib/seeds/application.d.ts +3 -1
- package/lib/seeds/application.js +26 -1
- package/lib/types/alteration.d.ts +5 -0
- package/lib/types/application.d.ts +14 -2
- package/lib/types/connector.d.ts +8 -0
- package/lib/types/consent.d.ts +11 -3
- package/lib/types/consent.js +2 -1
- package/lib/types/custom-profile-fields.d.ts +7 -13
- package/lib/types/custom-profile-fields.js +6 -13
- package/lib/types/log/interaction.d.ts +4 -2
- package/lib/types/log/interaction.js +2 -0
- package/lib/types/log/token.d.ts +5 -3
- package/lib/types/log/token.js +2 -0
- package/lib/types/logto-config/index.d.ts +331 -15
- package/lib/types/logto-config/index.js +28 -4
- package/lib/types/logto-config/index.test.d.ts +1 -0
- package/lib/types/logto-config/index.test.js +29 -0
- package/lib/types/logto-config/jwt-customizer.d.ts +787 -253
- package/lib/types/logto-config/jwt-customizer.js +8 -3
- package/lib/types/logto-config/jwt-customizer.test.js +14 -2
- package/lib/types/oidc-config.d.ts +2 -1
- package/lib/types/oidc-config.js +1 -0
- package/lib/types/onboarding.d.ts +93 -1
- package/lib/types/onboarding.js +22 -1
- package/lib/types/sign-in-experience.d.ts +15 -4
- package/lib/types/user-logto-config.d.ts +49 -0
- package/lib/types/user-logto-config.js +19 -0
- package/lib/types/user-sessions.d.ts +712 -112
- package/lib/types/user-sessions.js +33 -2
- package/lib/types/verification-records/verification-type.d.ts +1 -1
- package/lib/types/verification-records/verification-type.js +1 -1
- package/lib/types/verification-records/web-authn-verification.d.ts +11 -11
- package/lib/types/verification-records/web-authn-verification.js +3 -3
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/oidc-private-key.d.ts +88 -0
- package/lib/utils/oidc-private-key.js +163 -0
- package/lib/utils/oidc-private-key.test.d.ts +1 -0
- package/lib/utils/oidc-private-key.test.js +128 -0
- package/package.json +9 -8
- package/tables/account_centers.sql +4 -0
- package/tables/oidc_model_instances.sql +16 -0
- package/tables/sign_in_experiences.sql +2 -0
|
@@ -18,6 +18,7 @@ export var LogtoOidcConfigKey;
|
|
|
18
18
|
(function (LogtoOidcConfigKey) {
|
|
19
19
|
LogtoOidcConfigKey["PrivateKeys"] = "oidc.privateKeys";
|
|
20
20
|
LogtoOidcConfigKey["CookieKeys"] = "oidc.cookieKeys";
|
|
21
|
+
LogtoOidcConfigKey["Session"] = "oidc.session";
|
|
21
22
|
})(LogtoOidcConfigKey || (LogtoOidcConfigKey = {}));
|
|
22
23
|
/**
|
|
23
24
|
* Logto supported signing key algorithms for OIDC private keys that sign JWT tokens.
|
|
@@ -32,9 +33,23 @@ export const oidcConfigKeyGuard = z.object({
|
|
|
32
33
|
value: z.string(),
|
|
33
34
|
createdAt: z.number(),
|
|
34
35
|
});
|
|
36
|
+
export var OidcSigningKeyStatus;
|
|
37
|
+
(function (OidcSigningKeyStatus) {
|
|
38
|
+
OidcSigningKeyStatus["Next"] = "Next";
|
|
39
|
+
OidcSigningKeyStatus["Current"] = "Current";
|
|
40
|
+
OidcSigningKeyStatus["Previous"] = "Previous";
|
|
41
|
+
})(OidcSigningKeyStatus || (OidcSigningKeyStatus = {}));
|
|
42
|
+
export const oidcPrivateKeyGuard = oidcConfigKeyGuard.extend({
|
|
43
|
+
status: z.nativeEnum(OidcSigningKeyStatus).optional(),
|
|
44
|
+
});
|
|
45
|
+
export const oidcSessionConfigGuard = z.object({
|
|
46
|
+
ttl: z.number().int().min(1).max(31_536_000).optional(),
|
|
47
|
+
});
|
|
35
48
|
export const logtoOidcConfigGuard = Object.freeze({
|
|
36
|
-
[LogtoOidcConfigKey.PrivateKeys]:
|
|
49
|
+
[LogtoOidcConfigKey.PrivateKeys]: oidcPrivateKeyGuard.array(),
|
|
37
50
|
[LogtoOidcConfigKey.CookieKeys]: oidcConfigKeyGuard.array(),
|
|
51
|
+
// Session config is optional, if not set, it will fallback to default value in core.
|
|
52
|
+
[LogtoOidcConfigKey.Session]: oidcSessionConfigGuard.nullish().transform((data) => data ?? {}),
|
|
38
53
|
});
|
|
39
54
|
export var LogtoJwtTokenKey;
|
|
40
55
|
(function (LogtoJwtTokenKey) {
|
|
@@ -90,6 +105,10 @@ export const extendedIdTokenClaimsGuard = z.enum(extendedIdTokenClaims);
|
|
|
90
105
|
export const idTokenConfigGuard = z.object({
|
|
91
106
|
enabledExtendedClaims: extendedIdTokenClaimsGuard.array().optional(),
|
|
92
107
|
});
|
|
108
|
+
export const signingKeyRotationStateGuard = z.object({
|
|
109
|
+
tenantCacheExpiresAt: z.number().optional(),
|
|
110
|
+
signingKeyRotationAt: z.number().optional(),
|
|
111
|
+
});
|
|
93
112
|
export var LogtoTenantConfigKey;
|
|
94
113
|
(function (LogtoTenantConfigKey) {
|
|
95
114
|
LogtoTenantConfigKey["AdminConsole"] = "adminConsole";
|
|
@@ -98,12 +117,15 @@ export var LogtoTenantConfigKey;
|
|
|
98
117
|
LogtoTenantConfigKey["SessionNotFoundRedirectUrl"] = "sessionNotFoundRedirectUrl";
|
|
99
118
|
/** ID token configuration for extended claims. */
|
|
100
119
|
LogtoTenantConfigKey["IdToken"] = "idToken";
|
|
120
|
+
/** Tenant-scoped rotation state for staged private signing key activation. */
|
|
121
|
+
LogtoTenantConfigKey["SigningKeyRotationState"] = "signingKeyRotationState";
|
|
101
122
|
})(LogtoTenantConfigKey || (LogtoTenantConfigKey = {}));
|
|
102
123
|
export const logtoTenantConfigGuard = Object.freeze({
|
|
103
124
|
[LogtoTenantConfigKey.AdminConsole]: adminConsoleDataGuard,
|
|
104
125
|
[LogtoTenantConfigKey.CloudConnection]: cloudConnectionDataGuard,
|
|
105
126
|
[LogtoTenantConfigKey.SessionNotFoundRedirectUrl]: z.object({ url: z.string() }),
|
|
106
127
|
[LogtoTenantConfigKey.IdToken]: idTokenConfigGuard,
|
|
128
|
+
[LogtoTenantConfigKey.SigningKeyRotationState]: signingKeyRotationStateGuard,
|
|
107
129
|
});
|
|
108
130
|
export const logtoConfigKeys = Object.freeze([
|
|
109
131
|
...Object.values(LogtoOidcConfigKey),
|
|
@@ -115,6 +137,8 @@ export const logtoConfigGuards = Object.freeze({
|
|
|
115
137
|
...jwtCustomizerConfigGuard,
|
|
116
138
|
...logtoTenantConfigGuard,
|
|
117
139
|
});
|
|
118
|
-
export const oidcConfigKeysResponseGuard = oidcConfigKeyGuard
|
|
119
|
-
.
|
|
120
|
-
|
|
140
|
+
export const oidcConfigKeysResponseGuard = oidcConfigKeyGuard.omit({ value: true }).merge(z.object({
|
|
141
|
+
signingKeyAlgorithm: z.nativeEnum(SupportedSigningKeyAlgorithm).optional(),
|
|
142
|
+
status: z.nativeEnum(OidcSigningKeyStatus).optional(),
|
|
143
|
+
effectiveAt: z.number().optional(),
|
|
144
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { LogtoOidcConfigKey, LogtoTenantConfigKey, OidcSigningKeyStatus, logtoOidcConfigGuard, logtoTenantConfigGuard, oidcConfigKeysResponseGuard, } from './index.js';
|
|
3
|
+
describe('logto config guards', () => {
|
|
4
|
+
it('accepts legacy private keys without status', () => {
|
|
5
|
+
const privateKeys = [
|
|
6
|
+
{
|
|
7
|
+
id: 'key_1',
|
|
8
|
+
value: 'private-key-1',
|
|
9
|
+
createdAt: 1_710_000_000_000,
|
|
10
|
+
},
|
|
11
|
+
];
|
|
12
|
+
const result = logtoOidcConfigGuard[LogtoOidcConfigKey.PrivateKeys].safeParse(privateKeys);
|
|
13
|
+
expect(result.success).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
it('accepts signing key status in OIDC key responses', () => {
|
|
16
|
+
const result = oidcConfigKeysResponseGuard.safeParse({
|
|
17
|
+
id: 'key_1',
|
|
18
|
+
createdAt: 1_710_000_000_000,
|
|
19
|
+
status: OidcSigningKeyStatus.Current,
|
|
20
|
+
});
|
|
21
|
+
expect(result.success).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
it('accepts partial signing key rotation state', () => {
|
|
24
|
+
const result = logtoTenantConfigGuard[LogtoTenantConfigKey.SigningKeyRotationState].safeParse({
|
|
25
|
+
signingKeyRotationAt: 1_710_000_000_000,
|
|
26
|
+
});
|
|
27
|
+
expect(result.success).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
});
|