/** * @overview Constants for Logto. Synchronized with `@logto/core-kit` package at hash `081094d`. */ /** Scopes that reserved by Logto, which will be added to the auth request automatically. */ export declare enum ReservedScope { OpenId = "openid", OfflineAccess = "offline_access" } /** Resources that reserved by Logto, which cannot be defined by users. */ export declare enum ReservedResource { /** * The resource for organization template per RFC 0001. * * @see {@link https://github.com/logto-io/rfcs | RFC 0001} for more details. */ Organization = "urn:logto:resource:organizations" } export type UserClaim = 'name' | 'picture' | 'username' | 'email' | 'email_verified' | 'phone_number' | 'phone_number_verified' | 'roles' | 'organizations' | 'organization_roles' | 'custom_data' | 'identities'; /** * Scopes for ID Token and Userinfo Endpoint. */ export declare enum UserScope { /** * Scope for basic user info. * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ Profile = "profile", /** * Scope for user email address. * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ Email = "email", /** * Scope for user phone number. * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ Phone = "phone", /** * Scope for user address. * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ Address = "address", /** * Scope for user's custom data. * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ CustomData = "custom_data", /** * Scope for user's social identity details. * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ Identities = "identities", /** * Scope for user's roles. * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ Roles = "roles", /** * Scope for user's organization IDs and perform organization token grant per [RFC 0001](https://github.com/logto-io/rfcs). * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ Organizations = "urn:logto:scope:organizations", /** * Scope for user's organization roles per [RFC 0001](https://github.com/logto-io/rfcs). * * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint. */ OrganizationRoles = "urn:logto:scope:organization_roles", /** * Scope for user's sessions. * * Only used for session management via account API. * Not included in user claims, even when the scope is requested, as it's not meant for ID token or userinfo endpoint. */ Sessions = "urn:logto:scope:sessions" } /** * Mapped claims that ID Token includes. */ export declare const idTokenClaims: Readonly>; /** * Additional claims that Userinfo Endpoint returns. */ export declare const userinfoClaims: Readonly>; export declare const userClaims: Readonly>; /** * The prefix of the URN (Uniform Resource Name) for the organization in Logto. * * @example * ``` * urn:logto:organization:123 // organization with ID 123 * ``` * @see {@link https://en.wikipedia.org/wiki/Uniform_Resource_Name | Uniform Resource Name} */ export declare const organizationUrnPrefix = "urn:logto:organization:"; /** * Build the URN (Uniform Resource Name) for the organization in Logto. * * @param organizationId The ID of the organization. * @returns The URN for the organization. * @see {@link organizationUrnPrefix} for the prefix of the URN. * @example * ```ts * buildOrganizationUrn('1') // returns 'urn:logto:organization:1' * ``` */ export declare const buildOrganizationUrn: (organizationId: string) => string; /** * Get the organization ID from the URN (Uniform Resource Name) for the organization in Logto. * * @param urn The URN for the organization. Must start with {@link organizationUrnPrefix}. * @returns The ID of the organization. * @throws {TypeError} If the URN is invalid. * @example * ```ts * getOrganizationIdFromUrn('1') // throws TypeError * getOrganizationIdFromUrn('urn:logto:organization:1') // returns '1' * ``` */ export declare const getOrganizationIdFromUrn: (urn: string) => string;