@korajs/auth 1.0.0-beta.12 → 1.0.0-beta.14

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 (101) hide show
  1. package/README.md +52 -47
  2. package/dist/{create-org-session-RsDj9cl4.d.cts → create-org-session-ChFdulEM.d.cts} +211 -17
  3. package/dist/{create-org-session-RsDj9cl4.d.ts → create-org-session-ChFdulEM.d.ts} +211 -17
  4. package/dist/index.cjs +645 -150
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +27 -9
  7. package/dist/index.d.ts +27 -9
  8. package/dist/index.js +644 -150
  9. package/dist/index.js.map +1 -1
  10. package/dist/{operation-encryptor-DRmKNWpF.d.cts → operation-encryptor-DDdlb9bm.d.cts} +16 -0
  11. package/dist/{operation-encryptor-DRmKNWpF.d.ts → operation-encryptor-DDdlb9bm.d.ts} +16 -0
  12. package/dist/react.d.cts +2 -2
  13. package/dist/react.d.ts +2 -2
  14. package/dist/server.cjs +2880 -1667
  15. package/dist/server.cjs.map +1 -1
  16. package/dist/server.d.cts +810 -169
  17. package/dist/server.d.ts +810 -169
  18. package/dist/server.js +2848 -1646
  19. package/dist/server.js.map +1 -1
  20. package/dist/svelte.cjs +2 -2
  21. package/dist/svelte.cjs.map +1 -1
  22. package/dist/svelte.d.cts +2 -2
  23. package/dist/svelte.d.ts +2 -2
  24. package/dist/svelte.js +2 -2
  25. package/dist/svelte.js.map +1 -1
  26. package/dist/vue.d.cts +1 -1
  27. package/dist/vue.d.ts +1 -1
  28. package/package.json +7 -7
  29. package/src/admin/admin-api.ts +327 -0
  30. package/src/admin/audit-log.ts +324 -0
  31. package/src/admin/webhooks.ts +576 -0
  32. package/src/bindings/create-auth-session.ts +184 -0
  33. package/src/bindings/create-org-session.ts +130 -0
  34. package/src/client/auth-client.ts +1592 -0
  35. package/src/client/auth-sync.ts +213 -0
  36. package/src/client/device-session.ts +104 -0
  37. package/src/client/org-client.ts +399 -0
  38. package/src/client/quickstart.ts +108 -0
  39. package/src/client/storage.ts +94 -0
  40. package/src/device/device-identity.ts +330 -0
  41. package/src/device/device-store.ts +379 -0
  42. package/src/encryption/auto-lock.ts +170 -0
  43. package/src/encryption/database-encryption.ts +265 -0
  44. package/src/encryption/key-derivation.ts +149 -0
  45. package/src/encryption/operation-encryptor.ts +361 -0
  46. package/src/index.ts +132 -0
  47. package/src/mfa/totp.ts +826 -0
  48. package/src/org/org-routes.ts +758 -0
  49. package/src/org/org-store.ts +490 -0
  50. package/src/org/org-types.ts +230 -0
  51. package/src/passkey/passkey-client.ts +597 -0
  52. package/src/passkey/passkey-server.ts +779 -0
  53. package/src/postgres/ensure-schema.ts +65 -0
  54. package/src/provider/adapter.ts +246 -0
  55. package/src/provider/built-in/auth-routes.ts +1313 -0
  56. package/src/provider/built-in/email-verification.ts +303 -0
  57. package/src/provider/built-in/password-hash.ts +118 -0
  58. package/src/provider/built-in/password-reset.ts +416 -0
  59. package/src/provider/built-in/postgres-user-store.ts +365 -0
  60. package/src/provider/built-in/quickstart-server.ts +760 -0
  61. package/src/provider/built-in/sqlite-user-store.ts +335 -0
  62. package/src/provider/built-in/sync-scopes.ts +85 -0
  63. package/src/provider/built-in/user-store.ts +465 -0
  64. package/src/provider/external/clerk-adapter.ts +157 -0
  65. package/src/provider/external/external-jwt-provider.ts +491 -0
  66. package/src/provider/external/supabase-adapter.ts +163 -0
  67. package/src/provider/oauth/linked-identity-store.ts +108 -0
  68. package/src/provider/oauth/oauth-flow.ts +550 -0
  69. package/src/provider/oauth/oauth-types.ts +184 -0
  70. package/src/provider/oauth/postgres-oauth-store.ts +296 -0
  71. package/src/provider/oauth/sqlite-oauth-store.ts +285 -0
  72. package/src/rbac/rbac-engine.ts +323 -0
  73. package/src/rbac/rbac-types.ts +210 -0
  74. package/src/rbac/scope-resolver.ts +140 -0
  75. package/src/react/AuthProvider.tsx +97 -0
  76. package/src/react/OrgProvider.tsx +41 -0
  77. package/src/react/auth-context.ts +26 -0
  78. package/src/react/hooks.ts +110 -0
  79. package/src/react/org-hooks.ts +214 -0
  80. package/src/react.ts +26 -0
  81. package/src/server.ts +338 -0
  82. package/src/session/session.ts +401 -0
  83. package/src/svelte/auth-context.ts +50 -0
  84. package/src/svelte/org-context.ts +32 -0
  85. package/src/svelte/org-hooks.ts +201 -0
  86. package/src/svelte/use-auth.ts +115 -0
  87. package/src/svelte.ts +25 -0
  88. package/src/tokens/encrypted-token-store.ts +360 -0
  89. package/src/tokens/jwt.ts +236 -0
  90. package/src/tokens/postgres-token-revocation-store.ts +140 -0
  91. package/src/tokens/sqlite-token-revocation-store.ts +121 -0
  92. package/src/tokens/token-manager.ts +821 -0
  93. package/src/tokens/token-store.ts +192 -0
  94. package/src/types.ts +394 -0
  95. package/src/vue/auth-context.ts +10 -0
  96. package/src/vue/auth-provider-types.ts +5 -0
  97. package/src/vue/auth-provider.ts +76 -0
  98. package/src/vue/org-hooks.ts +193 -0
  99. package/src/vue/org-provider.ts +49 -0
  100. package/src/vue/use-auth.ts +139 -0
  101. package/src/vue.ts +10 -0
@@ -35,6 +35,22 @@ interface TokenPayload {
35
35
  iat: number;
36
36
  /** Expiration time (seconds since epoch, per JWT spec) */
37
37
  exp: number;
38
+ /**
39
+ * Refresh-token family id. Every token minted by one sign-in and its refresh
40
+ * rotations shares it, so reuse detection can revoke exactly that family
41
+ * instead of the whole device. Absent on tokens minted before beta.13.
42
+ */
43
+ fam?: string;
44
+ /**
45
+ * Issue time in milliseconds. `iat` has one-second resolution, which is too
46
+ * coarse to order a token against a revocation made in the same second.
47
+ */
48
+ iatMs?: number;
49
+ /**
50
+ * Authentication methods used to obtain this session (RFC 8176), for example
51
+ * `['pwd']` or `['pwd', 'otp']`.
52
+ */
53
+ amr?: string[];
38
54
  }
39
55
  /**
40
56
  * Bundle of tokens returned after successful authentication.
@@ -35,6 +35,22 @@ interface TokenPayload {
35
35
  iat: number;
36
36
  /** Expiration time (seconds since epoch, per JWT spec) */
37
37
  exp: number;
38
+ /**
39
+ * Refresh-token family id. Every token minted by one sign-in and its refresh
40
+ * rotations shares it, so reuse detection can revoke exactly that family
41
+ * instead of the whole device. Absent on tokens minted before beta.13.
42
+ */
43
+ fam?: string;
44
+ /**
45
+ * Issue time in milliseconds. `iat` has one-second resolution, which is too
46
+ * coarse to order a token against a revocation made in the same second.
47
+ */
48
+ iatMs?: number;
49
+ /**
50
+ * Authentication methods used to obtain this session (RFC 8176), for example
51
+ * `['pwd']` or `['pwd', 'otp']`.
52
+ */
53
+ amr?: string[];
38
54
  }
39
55
  /**
40
56
  * Bundle of tokens returned after successful authentication.
package/dist/react.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
- import { d as AuthClient, e as AuthState$1, l as AuthUser, O as OAuthAuthorizationOptions, q as OAuthAuthorizationResult, r as OAuthCallbackParams, L as LinkedOAuthAccount, i as AuthSession, s as OrgClient, v as OrgSession, m as ClientMembership, C as ClientInvitation, n as ClientOrganization } from './create-org-session-RsDj9cl4.cjs';
4
- export { x as checkOrgPermission } from './create-org-session-RsDj9cl4.cjs';
3
+ import { d as AuthClient, e as AuthState$1, n as AuthUser, O as OAuthAuthorizationOptions, s as OAuthAuthorizationResult, t as OAuthCallbackParams, L as LinkedOAuthAccount, j as AuthSession, u as OrgClient, x as OrgSession, o as ClientMembership, C as ClientInvitation, p as ClientOrganization } from './create-org-session-ChFdulEM.cjs';
4
+ export { z as checkOrgPermission } from './create-org-session-ChFdulEM.cjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import '@korajs/core';
7
7
 
package/dist/react.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
- import { d as AuthClient, e as AuthState$1, l as AuthUser, O as OAuthAuthorizationOptions, q as OAuthAuthorizationResult, r as OAuthCallbackParams, L as LinkedOAuthAccount, i as AuthSession, s as OrgClient, v as OrgSession, m as ClientMembership, C as ClientInvitation, n as ClientOrganization } from './create-org-session-RsDj9cl4.js';
4
- export { x as checkOrgPermission } from './create-org-session-RsDj9cl4.js';
3
+ import { d as AuthClient, e as AuthState$1, n as AuthUser, O as OAuthAuthorizationOptions, s as OAuthAuthorizationResult, t as OAuthCallbackParams, L as LinkedOAuthAccount, j as AuthSession, u as OrgClient, x as OrgSession, o as ClientMembership, C as ClientInvitation, p as ClientOrganization } from './create-org-session-ChFdulEM.js';
4
+ export { z as checkOrgPermission } from './create-org-session-ChFdulEM.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import '@korajs/core';
7
7