@korajs/auth 0.5.0 → 1.0.0-beta.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/dist/index.d.cts CHANGED
@@ -1,6 +1,8 @@
1
- import { A as AuthClientConfig, a as AuthTokenStorage, b as AuthKeyValueStorage, c as AuthDeviceIdentityProvider, D as DeviceKeyStore, d as AuthClient, e as AuthState } from './org-client-q2u55qod.cjs';
2
- export { f as AuthDeviceIdentity, g as AuthDeviceIdentityError, h as AuthError, i as AuthTokenStorageOptions, j as AuthUser, C as ClientInvitation, k as ClientMembership, l as ClientOrganization, m as DeviceKeyStoreError, I as InMemoryDeviceKeyStore, n as IndexedDBDeviceKeyStore, L as LinkedOAuthAccount, O as OAuthAuthorizationOptions, o as OAuthAuthorizationResult, p as OAuthCallbackParams, q as OrgClient, r as OrgClientConfig, s as OrgClientError, P as PersistentDeviceIdentityOptions, t as createAuthTokenStorage, u as createDeviceKeyStore, v as createMemoryAuthTokenStorage, w as createPersistentDeviceIdentity, x as createWebStorageAuthTokenStorage } from './org-client-q2u55qod.cjs';
3
- import { SchemaDefinition, ScopeMap, KoraError } from '@korajs/core';
1
+ import { A as AuthClientConfig, a as AuthTokenStorage, b as AuthKeyValueStorage, c as AuthDeviceIdentityProvider, D as DeviceKeyStore, d as AuthClient, e as AuthState } from './create-org-session-RsDj9cl4.cjs';
2
+ export { f as AuthDeviceIdentity, g as AuthDeviceIdentityError, h as AuthError, i as AuthSession, j as AuthSessionSnapshot, k as AuthTokenStorageOptions, l as AuthUser, C as ClientInvitation, m as ClientMembership, n as ClientOrganization, o as DeviceKeyStoreError, I as InMemoryDeviceKeyStore, p as IndexedDBDeviceKeyStore, L as LinkedOAuthAccount, O as OAuthAuthorizationOptions, q as OAuthAuthorizationResult, r as OAuthCallbackParams, s as OrgClient, t as OrgClientConfig, u as OrgClientError, v as OrgSession, w as OrgSnapshot, P as PersistentDeviceIdentityOptions, x as checkOrgPermission, y as createAuthSession, z as createAuthTokenStorage, B as createDeviceKeyStore, E as createMemoryAuthTokenStorage, F as createOrgSession, G as createPersistentDeviceIdentity, H as createWebStorageAuthTokenStorage } from './create-org-session-RsDj9cl4.cjs';
3
+ import { SchemaDefinition, KoraError } from '@korajs/core';
4
+ import { AuthSyncBinding } from '@korajs/core/bindings';
5
+ export { AuthSyncBinding } from '@korajs/core/bindings';
4
6
  import { A as AuthTokens } from './operation-encryptor-DRmKNWpF.cjs';
5
7
  export { a as AuthConfig, b as AuthEvent, c as AuthEventType, d as AuthStatus, C as CryptoUnavailableError, D as DeviceIdentityError, O as OperationEncryptionError, e as OperationEncryptor, f as OperationEncryptorConfig, T as TokenPayload, g as TokenType, h as computePublicKeyThumbprint, i as exportPublicKeyJwk, j as fromBase64Url, k as generateDeviceKeyPair, l as isEncryptedField, s as signChallenge, t as toBase64Url, v as verifyChallenge } from './operation-encryptor-DRmKNWpF.cjs';
6
8
 
@@ -46,22 +48,10 @@ interface AuthSyncClient {
46
48
  /**
47
49
  * Sync binding returned by {@link createKoraAuthSync}.
48
50
  * Passed to `createApp({ sync: { authClient } })` in korajs.
51
+ *
52
+ * @deprecated Use {@link AuthSyncBinding} from `@korajs/core/bindings` or `@korajs/auth`.
49
53
  */
50
- interface KoraAuthSyncBinding {
51
- /** Returns the access token for sync handshake (empty string when signed out). */
52
- auth: () => Promise<{
53
- token: string;
54
- }>;
55
- /** Builds a scope map from the current token and schema. */
56
- resolveScopeMap?: () => Promise<ScopeMap | undefined>;
57
- /**
58
- * Returns the device-bound sync node id from the token `dev` claim.
59
- * Separate from the user id (`sub`).
60
- */
61
- resolveNodeId?: () => Promise<string | undefined>;
62
- /** Notifies when auth state changes so sync can refresh scope or reconnect. */
63
- subscribe?: (listener: () => void) => () => void;
64
- }
54
+ type KoraAuthSyncBinding = AuthSyncBinding;
65
55
  /**
66
56
  * Configuration for {@link createKoraAuthSync}.
67
57
  */
@@ -101,7 +91,7 @@ interface CreateKoraAuthSyncOptions {
101
91
  * })
102
92
  * ```
103
93
  */
104
- declare function createKoraAuthSync(options: CreateKoraAuthSyncOptions): KoraAuthSyncBinding;
94
+ declare function createKoraAuthSync(options: CreateKoraAuthSyncOptions): AuthSyncBinding;
105
95
 
106
96
  /**
107
97
  * Client-side token storage for Kora auth tokens.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { A as AuthClientConfig, a as AuthTokenStorage, b as AuthKeyValueStorage, c as AuthDeviceIdentityProvider, D as DeviceKeyStore, d as AuthClient, e as AuthState } from './org-client-q2u55qod.js';
2
- export { f as AuthDeviceIdentity, g as AuthDeviceIdentityError, h as AuthError, i as AuthTokenStorageOptions, j as AuthUser, C as ClientInvitation, k as ClientMembership, l as ClientOrganization, m as DeviceKeyStoreError, I as InMemoryDeviceKeyStore, n as IndexedDBDeviceKeyStore, L as LinkedOAuthAccount, O as OAuthAuthorizationOptions, o as OAuthAuthorizationResult, p as OAuthCallbackParams, q as OrgClient, r as OrgClientConfig, s as OrgClientError, P as PersistentDeviceIdentityOptions, t as createAuthTokenStorage, u as createDeviceKeyStore, v as createMemoryAuthTokenStorage, w as createPersistentDeviceIdentity, x as createWebStorageAuthTokenStorage } from './org-client-q2u55qod.js';
3
- import { SchemaDefinition, ScopeMap, KoraError } from '@korajs/core';
1
+ import { A as AuthClientConfig, a as AuthTokenStorage, b as AuthKeyValueStorage, c as AuthDeviceIdentityProvider, D as DeviceKeyStore, d as AuthClient, e as AuthState } from './create-org-session-RsDj9cl4.js';
2
+ export { f as AuthDeviceIdentity, g as AuthDeviceIdentityError, h as AuthError, i as AuthSession, j as AuthSessionSnapshot, k as AuthTokenStorageOptions, l as AuthUser, C as ClientInvitation, m as ClientMembership, n as ClientOrganization, o as DeviceKeyStoreError, I as InMemoryDeviceKeyStore, p as IndexedDBDeviceKeyStore, L as LinkedOAuthAccount, O as OAuthAuthorizationOptions, q as OAuthAuthorizationResult, r as OAuthCallbackParams, s as OrgClient, t as OrgClientConfig, u as OrgClientError, v as OrgSession, w as OrgSnapshot, P as PersistentDeviceIdentityOptions, x as checkOrgPermission, y as createAuthSession, z as createAuthTokenStorage, B as createDeviceKeyStore, E as createMemoryAuthTokenStorage, F as createOrgSession, G as createPersistentDeviceIdentity, H as createWebStorageAuthTokenStorage } from './create-org-session-RsDj9cl4.js';
3
+ import { SchemaDefinition, KoraError } from '@korajs/core';
4
+ import { AuthSyncBinding } from '@korajs/core/bindings';
5
+ export { AuthSyncBinding } from '@korajs/core/bindings';
4
6
  import { A as AuthTokens } from './operation-encryptor-DRmKNWpF.js';
5
7
  export { a as AuthConfig, b as AuthEvent, c as AuthEventType, d as AuthStatus, C as CryptoUnavailableError, D as DeviceIdentityError, O as OperationEncryptionError, e as OperationEncryptor, f as OperationEncryptorConfig, T as TokenPayload, g as TokenType, h as computePublicKeyThumbprint, i as exportPublicKeyJwk, j as fromBase64Url, k as generateDeviceKeyPair, l as isEncryptedField, s as signChallenge, t as toBase64Url, v as verifyChallenge } from './operation-encryptor-DRmKNWpF.js';
6
8
 
@@ -46,22 +48,10 @@ interface AuthSyncClient {
46
48
  /**
47
49
  * Sync binding returned by {@link createKoraAuthSync}.
48
50
  * Passed to `createApp({ sync: { authClient } })` in korajs.
51
+ *
52
+ * @deprecated Use {@link AuthSyncBinding} from `@korajs/core/bindings` or `@korajs/auth`.
49
53
  */
50
- interface KoraAuthSyncBinding {
51
- /** Returns the access token for sync handshake (empty string when signed out). */
52
- auth: () => Promise<{
53
- token: string;
54
- }>;
55
- /** Builds a scope map from the current token and schema. */
56
- resolveScopeMap?: () => Promise<ScopeMap | undefined>;
57
- /**
58
- * Returns the device-bound sync node id from the token `dev` claim.
59
- * Separate from the user id (`sub`).
60
- */
61
- resolveNodeId?: () => Promise<string | undefined>;
62
- /** Notifies when auth state changes so sync can refresh scope or reconnect. */
63
- subscribe?: (listener: () => void) => () => void;
64
- }
54
+ type KoraAuthSyncBinding = AuthSyncBinding;
65
55
  /**
66
56
  * Configuration for {@link createKoraAuthSync}.
67
57
  */
@@ -101,7 +91,7 @@ interface CreateKoraAuthSyncOptions {
101
91
  * })
102
92
  * ```
103
93
  */
104
- declare function createKoraAuthSync(options: CreateKoraAuthSyncOptions): KoraAuthSyncBinding;
94
+ declare function createKoraAuthSync(options: CreateKoraAuthSyncOptions): AuthSyncBinding;
105
95
 
106
96
  /**
107
97
  * Client-side token storage for Kora auth tokens.
package/dist/index.js CHANGED
@@ -24,6 +24,11 @@ import {
24
24
  toBase64Url,
25
25
  verifyChallenge
26
26
  } from "./chunk-IO2MCCG2.js";
27
+ import {
28
+ checkOrgPermission,
29
+ createAuthSession,
30
+ createOrgSession
31
+ } from "./chunk-MPMXJ62R.js";
27
32
 
28
33
  // src/client/auth-client.ts
29
34
  import { KoraError } from "@korajs/core";
@@ -1822,12 +1827,15 @@ export {
1822
1827
  PasskeyUnsupportedError,
1823
1828
  TokenStore,
1824
1829
  authenticateWithPasskey,
1830
+ checkOrgPermission,
1825
1831
  computePublicKeyThumbprint,
1832
+ createAuthSession,
1826
1833
  createAuthTokenStorage,
1827
1834
  createDeviceKeyStore,
1828
1835
  createKoraAuth,
1829
1836
  createKoraAuthSync,
1830
1837
  createMemoryAuthTokenStorage,
1838
+ createOrgSession,
1831
1839
  createPasskeyCredential,
1832
1840
  createPersistentDeviceIdentity,
1833
1841
  createWebStorageAuthTokenStorage,