-
Notifications
You must be signed in to change notification settings - Fork 452
Expand file tree
/
Copy pathconstants.ts
More file actions
103 lines (94 loc) · 2.95 KB
/
constants.ts
File metadata and controls
103 lines (94 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
export const API_URL = 'https://api.clerk.com';
export const API_VERSION = 'v1';
export const USER_AGENT = `${PACKAGE_NAME}@${PACKAGE_VERSION}`;
export const MAX_CACHE_LAST_UPDATED_AT_SECONDS = 5 * 60;
export const SUPPORTED_BAPI_VERSION = '2025-11-10';
const Attributes = {
AuthToken: '__clerkAuthToken',
AuthSignature: '__clerkAuthSignature',
AuthStatus: '__clerkAuthStatus',
AuthReason: '__clerkAuthReason',
AuthMessage: '__clerkAuthMessage',
ClerkUrl: '__clerkUrl',
} as const;
const Cookies = {
Session: '__session',
Refresh: '__refresh',
ClientUat: '__client_uat',
Handshake: '__clerk_handshake',
DevBrowser: '__clerk_db_jwt',
RedirectCount: '__clerk_redirect_count',
HandshakeNonce: '__clerk_handshake_nonce',
} as const;
const QueryParameters = {
ClerkSynced: '__clerk_synced',
SuffixedCookies: 'suffixed_cookies',
ClerkRedirectUrl: '__clerk_redirect_url',
// use the reference to Cookies to indicate that it's the same value
DevBrowser: Cookies.DevBrowser,
Handshake: Cookies.Handshake,
HandshakeHelp: '__clerk_help',
LegacyDevBrowser: '__dev_session',
HandshakeReason: '__clerk_hs_reason',
HandshakeNonce: Cookies.HandshakeNonce,
HandshakeFormat: 'format',
Session: '__session',
} as const;
const Headers = {
Accept: 'accept',
AuthMessage: 'x-clerk-auth-message',
Authorization: 'authorization',
AuthReason: 'x-clerk-auth-reason',
AuthSignature: 'x-clerk-auth-signature',
AuthStatus: 'x-clerk-auth-status',
AuthToken: 'x-clerk-auth-token',
CacheControl: 'cache-control',
ClerkRedirectTo: 'x-clerk-redirect-to',
ClerkRequestData: 'x-clerk-request-data',
ClerkUrl: 'x-clerk-clerk-url',
CloudFrontForwardedProto: 'cloudfront-forwarded-proto',
ContentType: 'content-type',
ContentSecurityPolicy: 'content-security-policy',
ContentSecurityPolicyReportOnly: 'content-security-policy-report-only',
EnableDebug: 'x-clerk-debug',
CfConnectingIp: 'cf-connecting-ip',
ForwardedFor: 'x-forwarded-for',
ForwardedHost: 'x-forwarded-host',
ForwardedPort: 'x-forwarded-port',
ForwardedProto: 'x-forwarded-proto',
Host: 'host',
RealIp: 'x-real-ip',
Location: 'location',
Nonce: 'x-nonce',
Origin: 'origin',
Referrer: 'referer',
SecFetchDest: 'sec-fetch-dest',
SecFetchSite: 'sec-fetch-site',
UserAgent: 'user-agent',
ReportingEndpoints: 'reporting-endpoints',
} as const;
const ContentTypes = {
Json: 'application/json',
} as const;
/**
* Sync status values for the __clerk_synced query parameter.
* Used to coordinate satellite domain authentication flows.
*/
export const ClerkSyncStatus = {
/** Not synced - satellite needs handshake after returning from primary sign-in */
NeedsSync: 'false',
/** Sync completed - prevents re-sync loop after handshake completes */
Completed: 'true',
} as const;
/**
* @internal
*/
export const constants = {
Attributes,
Cookies,
Headers,
ContentTypes,
QueryParameters,
ClerkSyncStatus,
} as const;
export type Constants = typeof constants;