@logto/core-kit 2.1.1 → 2.2.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/lib/models/tenant.js +3 -3
- package/lib/scope.d.ts +8 -2
- package/lib/scope.js +8 -0
- package/package.json +2 -2
package/lib/models/tenant.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { generateStandardId
|
|
1
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
2
2
|
// Use lowercase letters for tenant IDs to improve compatibility
|
|
3
|
-
const generateTenantId =
|
|
4
|
-
export const createTenantMetadata = (databaseName, tenantId = generateTenantId(
|
|
3
|
+
const generateTenantId = () => generateStandardId(6);
|
|
4
|
+
export const createTenantMetadata = (databaseName, tenantId = generateTenantId()) => {
|
|
5
5
|
const parentRole = `logto_tenant_${databaseName}`;
|
|
6
6
|
const role = `logto_tenant_${databaseName}_${tenantId}`;
|
|
7
7
|
const password = generateStandardId(32);
|
package/lib/scope.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare enum ReservedScope {
|
|
|
2
2
|
OpenId = "openid",
|
|
3
3
|
OfflineAccess = "offline_access"
|
|
4
4
|
}
|
|
5
|
-
export type UserClaim = 'name' | 'picture' | 'username' | 'email' | 'email_verified' | 'phone_number' | 'phone_number_verified' | 'custom_data' | 'identities';
|
|
5
|
+
export type UserClaim = 'name' | 'picture' | 'username' | 'email' | 'email_verified' | 'phone_number' | 'phone_number_verified' | 'roles' | 'custom_data' | 'identities';
|
|
6
6
|
/**
|
|
7
7
|
* Scopes for ID Token and Userinfo Endpoint.
|
|
8
8
|
*/
|
|
@@ -36,7 +36,13 @@ export declare enum UserScope {
|
|
|
36
36
|
*
|
|
37
37
|
* See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
|
|
38
38
|
*/
|
|
39
|
-
Identities = "identities"
|
|
39
|
+
Identities = "identities",
|
|
40
|
+
/**
|
|
41
|
+
* Scope for user's roles.
|
|
42
|
+
*
|
|
43
|
+
* See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
|
|
44
|
+
*/
|
|
45
|
+
Roles = "roles"
|
|
40
46
|
}
|
|
41
47
|
/**
|
|
42
48
|
* Mapped claims that ID Token includes.
|
package/lib/scope.js
CHANGED
|
@@ -38,6 +38,12 @@ export var UserScope;
|
|
|
38
38
|
* See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
|
|
39
39
|
*/
|
|
40
40
|
UserScope["Identities"] = "identities";
|
|
41
|
+
/**
|
|
42
|
+
* Scope for user's roles.
|
|
43
|
+
*
|
|
44
|
+
* See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
|
|
45
|
+
*/
|
|
46
|
+
UserScope["Roles"] = "roles";
|
|
41
47
|
})(UserScope || (UserScope = {}));
|
|
42
48
|
/**
|
|
43
49
|
* Mapped claims that ID Token includes.
|
|
@@ -46,6 +52,7 @@ export const idTokenClaims = Object.freeze({
|
|
|
46
52
|
[UserScope.Profile]: ['name', 'picture', 'username'],
|
|
47
53
|
[UserScope.Email]: ['email', 'email_verified'],
|
|
48
54
|
[UserScope.Phone]: ['phone_number', 'phone_number_verified'],
|
|
55
|
+
[UserScope.Roles]: ['roles'],
|
|
49
56
|
[UserScope.CustomData]: [],
|
|
50
57
|
[UserScope.Identities]: [],
|
|
51
58
|
});
|
|
@@ -56,6 +63,7 @@ export const userinfoClaims = Object.freeze({
|
|
|
56
63
|
[UserScope.Profile]: [],
|
|
57
64
|
[UserScope.Email]: [],
|
|
58
65
|
[UserScope.Phone]: [],
|
|
66
|
+
[UserScope.Roles]: [],
|
|
59
67
|
[UserScope.CustomData]: ['custom_data'],
|
|
60
68
|
[UserScope.Identities]: ['identities'],
|
|
61
69
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/core-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
5
5
|
"homepage": "https://github.com/logto-io/toolkit#readme",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@logto/language-kit": "^1.0.0",
|
|
33
|
-
"@logto/shared": "^
|
|
33
|
+
"@logto/shared": "^3.0.0",
|
|
34
34
|
"color": "^4.2.3"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|