@idp.global/interfaces 1.0.1

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 (131) hide show
  1. package/changelog.md +16 -0
  2. package/dist_ts/00_commitinfo_data.d.ts +8 -0
  3. package/dist_ts/00_commitinfo_data.js +9 -0
  4. package/dist_ts/data/abusewindow.d.ts +13 -0
  5. package/dist_ts/data/abusewindow.js +2 -0
  6. package/dist_ts/data/activity.d.ts +16 -0
  7. package/dist_ts/data/activity.js +2 -0
  8. package/dist_ts/data/alert.d.ts +31 -0
  9. package/dist_ts/data/alert.js +2 -0
  10. package/dist_ts/data/alertrule.d.ts +19 -0
  11. package/dist_ts/data/alertrule.js +2 -0
  12. package/dist_ts/data/app.d.ts +86 -0
  13. package/dist_ts/data/app.js +2 -0
  14. package/dist_ts/data/appconnection.d.ts +16 -0
  15. package/dist_ts/data/appconnection.js +2 -0
  16. package/dist_ts/data/billingplan.d.ts +43 -0
  17. package/dist_ts/data/billingplan.js +2 -0
  18. package/dist_ts/data/device.d.ts +3 -0
  19. package/dist_ts/data/device.js +2 -0
  20. package/dist_ts/data/emailactiontoken.d.ts +11 -0
  21. package/dist_ts/data/emailactiontoken.js +2 -0
  22. package/dist_ts/data/index.d.ts +21 -0
  23. package/dist_ts/data/index.js +22 -0
  24. package/dist_ts/data/jwt.d.ts +38 -0
  25. package/dist_ts/data/jwt.js +2 -0
  26. package/dist_ts/data/loginsession.d.ts +38 -0
  27. package/dist_ts/data/loginsession.js +2 -0
  28. package/dist_ts/data/oidc.d.ts +248 -0
  29. package/dist_ts/data/oidc.js +5 -0
  30. package/dist_ts/data/organization.d.ts +11 -0
  31. package/dist_ts/data/organization.js +4 -0
  32. package/dist_ts/data/paddlecheckoutdata.d.ts +316 -0
  33. package/dist_ts/data/paddlecheckoutdata.js +2 -0
  34. package/dist_ts/data/passportchallenge.d.ts +68 -0
  35. package/dist_ts/data/passportchallenge.js +2 -0
  36. package/dist_ts/data/passportdevice.d.ts +34 -0
  37. package/dist_ts/data/passportdevice.js +2 -0
  38. package/dist_ts/data/passportnonce.d.ts +9 -0
  39. package/dist_ts/data/passportnonce.js +2 -0
  40. package/dist_ts/data/property.d.ts +10 -0
  41. package/dist_ts/data/property.js +3 -0
  42. package/dist_ts/data/registrationsession.d.ts +25 -0
  43. package/dist_ts/data/registrationsession.js +2 -0
  44. package/dist_ts/data/role.d.ts +28 -0
  45. package/dist_ts/data/role.js +2 -0
  46. package/dist_ts/data/user.d.ts +32 -0
  47. package/dist_ts/data/user.js +3 -0
  48. package/dist_ts/data/userinvitation.d.ts +45 -0
  49. package/dist_ts/data/userinvitation.js +2 -0
  50. package/dist_ts/index.d.ts +4 -0
  51. package/dist_ts/index.js +6 -0
  52. package/dist_ts/plugins.d.ts +4 -0
  53. package/dist_ts/plugins.js +7 -0
  54. package/dist_ts/request/admin.d.ts +100 -0
  55. package/dist_ts/request/admin.js +3 -0
  56. package/dist_ts/request/alert.d.ts +78 -0
  57. package/dist_ts/request/alert.js +3 -0
  58. package/dist_ts/request/apitoken.d.ts +1 -0
  59. package/dist_ts/request/apitoken.js +2 -0
  60. package/dist_ts/request/app.d.ts +48 -0
  61. package/dist_ts/request/app.js +3 -0
  62. package/dist_ts/request/authorization.d.ts +57 -0
  63. package/dist_ts/request/authorization.js +4 -0
  64. package/dist_ts/request/billingplan.d.ts +40 -0
  65. package/dist_ts/request/billingplan.js +3 -0
  66. package/dist_ts/request/index.d.ts +14 -0
  67. package/dist_ts/request/index.js +15 -0
  68. package/dist_ts/request/jwt.d.ts +63 -0
  69. package/dist_ts/request/jwt.js +3 -0
  70. package/dist_ts/request/login.d.ts +126 -0
  71. package/dist_ts/request/login.js +3 -0
  72. package/dist_ts/request/organization.d.ts +96 -0
  73. package/dist_ts/request/organization.js +3 -0
  74. package/dist_ts/request/passport.d.ts +169 -0
  75. package/dist_ts/request/passport.js +3 -0
  76. package/dist_ts/request/plan.d.ts +12 -0
  77. package/dist_ts/request/plan.js +3 -0
  78. package/dist_ts/request/registration.d.ts +65 -0
  79. package/dist_ts/request/registration.js +3 -0
  80. package/dist_ts/request/user.d.ts +101 -0
  81. package/dist_ts/request/user.js +3 -0
  82. package/dist_ts/request/userinvitation.d.ts +193 -0
  83. package/dist_ts/request/userinvitation.js +3 -0
  84. package/dist_ts/tags/index.d.ts +7 -0
  85. package/dist_ts/tags/index.js +2 -0
  86. package/license +21 -0
  87. package/package.json +57 -0
  88. package/readme.md +101 -0
  89. package/ts/00_commitinfo_data.ts +8 -0
  90. package/ts/data/abusewindow.ts +13 -0
  91. package/ts/data/activity.ts +36 -0
  92. package/ts/data/alert.ts +35 -0
  93. package/ts/data/alertrule.ts +22 -0
  94. package/ts/data/app.ts +99 -0
  95. package/ts/data/appconnection.ts +18 -0
  96. package/ts/data/billingplan.ts +47 -0
  97. package/ts/data/device.ts +3 -0
  98. package/ts/data/emailactiontoken.ts +12 -0
  99. package/ts/data/index.ts +21 -0
  100. package/ts/data/jwt.ts +43 -0
  101. package/ts/data/loginsession.ts +38 -0
  102. package/ts/data/oidc.ts +281 -0
  103. package/ts/data/organization.ts +14 -0
  104. package/ts/data/paddlecheckoutdata.ts +316 -0
  105. package/ts/data/passportchallenge.ts +80 -0
  106. package/ts/data/passportdevice.ts +46 -0
  107. package/ts/data/passportnonce.ts +9 -0
  108. package/ts/data/property.ts +12 -0
  109. package/ts/data/registrationsession.ts +31 -0
  110. package/ts/data/role.ts +33 -0
  111. package/ts/data/user.ts +36 -0
  112. package/ts/data/userinvitation.ts +58 -0
  113. package/ts/index.ts +6 -0
  114. package/ts/plugins.ts +9 -0
  115. package/ts/readme.md +133 -0
  116. package/ts/request/admin.ts +130 -0
  117. package/ts/request/alert.ts +113 -0
  118. package/ts/request/apitoken.ts +1 -0
  119. package/ts/request/app.ts +71 -0
  120. package/ts/request/authorization.ts +72 -0
  121. package/ts/request/billingplan.ts +55 -0
  122. package/ts/request/index.ts +14 -0
  123. package/ts/request/jwt.ts +79 -0
  124. package/ts/request/login.ts +181 -0
  125. package/ts/request/organization.ts +131 -0
  126. package/ts/request/passport.ts +227 -0
  127. package/ts/request/plan.ts +17 -0
  128. package/ts/request/registration.ts +90 -0
  129. package/ts/request/user.ts +142 -0
  130. package/ts/request/userinvitation.ts +248 -0
  131. package/ts/tags/index.ts +12 -0
@@ -0,0 +1,12 @@
1
+ export type TEmailActionTokenAction = 'emailLogin' | 'passwordReset';
2
+
3
+ export interface IEmailActionToken {
4
+ id: string;
5
+ data: {
6
+ email: string;
7
+ action: TEmailActionTokenAction;
8
+ tokenHash: string;
9
+ validUntil: number;
10
+ createdAt: number;
11
+ };
12
+ }
@@ -0,0 +1,21 @@
1
+ export * from './abusewindow.js';
2
+ export * from './activity.js';
3
+ export * from './alert.js';
4
+ export * from './alertrule.js';
5
+ export * from './app.js';
6
+ export * from './emailactiontoken.js';
7
+ export * from './oidc.js';
8
+ export * from './appconnection.js';
9
+ export * from './billingplan.js';
10
+ export * from './device.js';
11
+ export * from './jwt.js';
12
+ export * from './loginsession.js';
13
+ export * from './organization.js';
14
+ export * from './paddlecheckoutdata.js';
15
+ export * from './passportchallenge.js';
16
+ export * from './passportdevice.js';
17
+ export * from './passportnonce.js';
18
+ export * from './registrationsession.js';
19
+ export * from './role.js';
20
+ export * from './user.js';
21
+ export * from './userinvitation.js';
package/ts/data/jwt.ts ADDED
@@ -0,0 +1,43 @@
1
+ export type TLoginStatus = 'loggedIn' | 'loggedOut' | 'invalidated' | 'not found' | 'transfer';
2
+ export type TLoginAction = 'login' | 'logout' | 'manage';
3
+
4
+ export interface IJwt {
5
+ id: string;
6
+ blocked: boolean;
7
+ data: {
8
+ /**
9
+ * the user id of the jwt
10
+ */
11
+ userId: string;
12
+
13
+ /**
14
+ * the login session backing this jwt
15
+ */
16
+ sessionId?: string;
17
+
18
+ /**
19
+ * the latest point of
20
+ */
21
+ validUntil: number;
22
+ /**
23
+ * hold off from refreshing before
24
+ */
25
+ refreshFrom: number;
26
+ /**
27
+ * an interval in millis to recheck token invalidation
28
+ */
29
+ refreshEvery: number;
30
+
31
+ /**
32
+ * legacy field kept for compatibility with already-issued jwt documents
33
+ */
34
+ refreshToken?: string;
35
+
36
+ /**
37
+ * just for looks/debugging
38
+ */
39
+ justForLooks: {
40
+ validUntilIsoString: string;
41
+ };
42
+ };
43
+ }
@@ -0,0 +1,38 @@
1
+ export interface ILoginSession {
2
+ id: string;
3
+ data: {
4
+ userId: string | null;
5
+ validUntil: number;
6
+ invalidated: boolean;
7
+ /**
8
+ * legacy plaintext refresh token field kept so existing sessions can migrate on first use
9
+ */
10
+ refreshToken?: string | null;
11
+ refreshTokenHash?: string | null;
12
+ rotatedRefreshTokenHashes?: string[];
13
+ transferTokenHash?: string | null;
14
+ transferTokenExpiresAt?: number | null;
15
+ /**
16
+ * a device id that can be used to share the login session
17
+ * in different contexts on the same device
18
+ */
19
+ deviceId?: string | null;
20
+ /**
21
+ * Device metadata for session display
22
+ */
23
+ deviceInfo?: {
24
+ deviceName: string;
25
+ browser: string;
26
+ os: string;
27
+ ip: string;
28
+ } | null;
29
+ /**
30
+ * When this session was created
31
+ */
32
+ createdAt?: number;
33
+ /**
34
+ * Last time this session was active (e.g., refreshed)
35
+ */
36
+ lastActive?: number;
37
+ };
38
+ }
@@ -0,0 +1,281 @@
1
+ /**
2
+ * OIDC (OpenID Connect) data interfaces for third-party client support
3
+ */
4
+
5
+ /**
6
+ * Supported OIDC scopes
7
+ */
8
+ export type TOidcScope = 'openid' | 'profile' | 'email' | 'organizations' | 'roles';
9
+
10
+ /**
11
+ * Authorization code for OAuth 2.0 authorization code flow
12
+ */
13
+ export interface IAuthorizationCode {
14
+ id: string;
15
+ data: {
16
+ /** Hashed authorization code string */
17
+ codeHash: string;
18
+ /** OAuth client ID */
19
+ clientId: string;
20
+ /** User ID who authorized */
21
+ userId: string;
22
+ /** Scopes granted */
23
+ scopes: TOidcScope[];
24
+ /** Redirect URI used in authorization request */
25
+ redirectUri: string;
26
+ /** PKCE code challenge (S256 hashed) */
27
+ codeChallenge?: string;
28
+ /** PKCE code challenge method */
29
+ codeChallengeMethod?: 'S256';
30
+ /** Nonce from authorization request (for ID token) */
31
+ nonce?: string;
32
+ /** Expiration timestamp (10 minutes from creation) */
33
+ expiresAt: number;
34
+ /** Creation timestamp */
35
+ issuedAt: number;
36
+ /** Whether the code has been used (single-use) */
37
+ used: boolean;
38
+ };
39
+ }
40
+
41
+ /**
42
+ * OIDC Access Token (opaque or JWT)
43
+ */
44
+ export interface IOidcAccessToken {
45
+ id: string;
46
+ data: {
47
+ /** The access token string hash for storage */
48
+ tokenHash: string;
49
+ /** OAuth client ID */
50
+ clientId: string;
51
+ /** User ID */
52
+ userId: string;
53
+ /** Granted scopes */
54
+ scopes: TOidcScope[];
55
+ /** Expiration timestamp */
56
+ expiresAt: number;
57
+ /** Creation timestamp */
58
+ issuedAt: number;
59
+ };
60
+ }
61
+
62
+ /**
63
+ * OIDC Refresh Token
64
+ */
65
+ export interface IOidcRefreshToken {
66
+ id: string;
67
+ data: {
68
+ /** The refresh token string hash for storage */
69
+ tokenHash: string;
70
+ /** OAuth client ID */
71
+ clientId: string;
72
+ /** User ID */
73
+ userId: string;
74
+ /** Granted scopes */
75
+ scopes: TOidcScope[];
76
+ /** Expiration timestamp */
77
+ expiresAt: number;
78
+ /** Creation timestamp */
79
+ issuedAt: number;
80
+ /** Whether the token has been revoked */
81
+ revoked: boolean;
82
+ };
83
+ }
84
+
85
+ /**
86
+ * User consent record for an OAuth client
87
+ */
88
+ export interface IUserConsent {
89
+ id: string;
90
+ data: {
91
+ /** User who gave consent */
92
+ userId: string;
93
+ /** OAuth client ID */
94
+ clientId: string;
95
+ /** Scopes the user consented to */
96
+ scopes: TOidcScope[];
97
+ /** When consent was granted */
98
+ grantedAt: number;
99
+ /** When consent was last updated */
100
+ updatedAt: number;
101
+ };
102
+ }
103
+
104
+ /**
105
+ * OIDC Discovery Document (OpenID Provider Configuration)
106
+ */
107
+ export interface IOidcDiscoveryDocument {
108
+ issuer: string;
109
+ authorization_endpoint: string;
110
+ token_endpoint: string;
111
+ userinfo_endpoint: string;
112
+ jwks_uri: string;
113
+ revocation_endpoint: string;
114
+ scopes_supported: TOidcScope[];
115
+ response_types_supported: string[];
116
+ grant_types_supported: string[];
117
+ subject_types_supported: string[];
118
+ id_token_signing_alg_values_supported: string[];
119
+ token_endpoint_auth_methods_supported: string[];
120
+ code_challenge_methods_supported: string[];
121
+ claims_supported: string[];
122
+ }
123
+
124
+ /**
125
+ * JSON Web Key Set (JWKS) response
126
+ */
127
+ export interface IJwks {
128
+ keys: IJwk[];
129
+ }
130
+
131
+ /**
132
+ * JSON Web Key (RSA public key)
133
+ */
134
+ export interface IJwk {
135
+ kty: 'RSA';
136
+ use: 'sig';
137
+ alg: 'RS256';
138
+ kid: string;
139
+ n: string; // RSA modulus (base64url encoded)
140
+ e: string; // RSA exponent (base64url encoded)
141
+ }
142
+
143
+ /**
144
+ * ID Token claims (JWT payload)
145
+ */
146
+ export interface IIdTokenClaims {
147
+ /** Issuer (idp.global URL) */
148
+ iss: string;
149
+ /** Subject (user ID) */
150
+ sub: string;
151
+ /** Audience (client ID) */
152
+ aud: string;
153
+ /** Expiration time (Unix timestamp) */
154
+ exp: number;
155
+ /** Issued at (Unix timestamp) */
156
+ iat: number;
157
+ /** Authentication time (Unix timestamp) */
158
+ auth_time?: number;
159
+ /** Nonce (if provided in authorization request) */
160
+ nonce?: string;
161
+ /** Access token hash (for hybrid flows) */
162
+ at_hash?: string;
163
+
164
+ // Profile scope claims
165
+ name?: string;
166
+ preferred_username?: string;
167
+ picture?: string;
168
+
169
+ // Email scope claims
170
+ email?: string;
171
+ email_verified?: boolean;
172
+
173
+ // Custom claims for organizations scope
174
+ organizations?: IOrganizationClaim[];
175
+
176
+ // Custom claims for roles scope
177
+ roles?: string[];
178
+ app_roles?: string[];
179
+ app_permissions?: string[];
180
+ app_scopes?: string[];
181
+ }
182
+
183
+ /**
184
+ * Organization claim in ID token / userinfo
185
+ */
186
+ export interface IOrganizationClaim {
187
+ id: string;
188
+ name: string;
189
+ slug: string;
190
+ roles: string[];
191
+ }
192
+
193
+ /**
194
+ * UserInfo endpoint response
195
+ */
196
+ export interface IUserInfoResponse {
197
+ /** Subject (user ID) - always included */
198
+ sub: string;
199
+
200
+ // Profile scope
201
+ name?: string;
202
+ preferred_username?: string;
203
+ picture?: string;
204
+
205
+ // Email scope
206
+ email?: string;
207
+ email_verified?: boolean;
208
+
209
+ // Organizations scope (custom)
210
+ organizations?: IOrganizationClaim[];
211
+
212
+ // Roles scope (custom)
213
+ roles?: string[];
214
+ app_roles?: string[];
215
+ app_permissions?: string[];
216
+ app_scopes?: string[];
217
+ }
218
+
219
+ /**
220
+ * Token endpoint response
221
+ */
222
+ export interface ITokenResponse {
223
+ access_token: string;
224
+ token_type: 'Bearer';
225
+ expires_in: number;
226
+ refresh_token?: string;
227
+ id_token?: string;
228
+ scope: string;
229
+ }
230
+
231
+ /**
232
+ * Token endpoint error response
233
+ */
234
+ export interface ITokenErrorResponse {
235
+ error: 'invalid_request' | 'invalid_client' | 'invalid_grant' | 'unauthorized_client' | 'unsupported_grant_type' | 'invalid_scope';
236
+ error_description?: string;
237
+ error_uri?: string;
238
+ }
239
+
240
+ /**
241
+ * Authorization request parameters
242
+ */
243
+ export interface IAuthorizationRequest {
244
+ client_id: string;
245
+ redirect_uri: string;
246
+ response_type: 'code';
247
+ scope: string;
248
+ state: string;
249
+ code_challenge?: string;
250
+ code_challenge_method?: 'S256';
251
+ nonce?: string;
252
+ prompt?: 'none' | 'login' | 'consent';
253
+ }
254
+
255
+ /**
256
+ * Token request for authorization_code grant
257
+ */
258
+ export interface ITokenRequestAuthCode {
259
+ grant_type: 'authorization_code';
260
+ code: string;
261
+ redirect_uri: string;
262
+ client_id: string;
263
+ client_secret?: string;
264
+ code_verifier?: string;
265
+ }
266
+
267
+ /**
268
+ * Token request for refresh_token grant
269
+ */
270
+ export interface ITokenRequestRefresh {
271
+ grant_type: 'refresh_token';
272
+ refresh_token: string;
273
+ client_id: string;
274
+ client_secret?: string;
275
+ scope?: string;
276
+ }
277
+
278
+ /**
279
+ * Union type for token requests
280
+ */
281
+ export type ITokenRequest = ITokenRequestAuthCode | ITokenRequestRefresh;
@@ -0,0 +1,14 @@
1
+ import * as plugins from '../plugins.js';
2
+ import { type IBillingPlan } from './billingplan.js';
3
+ import { type IOrgRoleDefinition, type IRole } from './role.js';
4
+
5
+ export interface IOrganization {
6
+ id: string;
7
+ data: {
8
+ name: string;
9
+ slug: string;
10
+ billingPlanId: string;
11
+ roleIds: string[];
12
+ roleDefinitions?: IOrgRoleDefinition[];
13
+ };
14
+ }