@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/LICENSE +21 -0
- package/dist/chunk-MPMXJ62R.js +203 -0
- package/dist/chunk-MPMXJ62R.js.map +1 -0
- package/dist/{org-client-q2u55qod.d.cts → create-org-session-RsDj9cl4.d.cts} +58 -1
- package/dist/{org-client-q2u55qod.d.ts → create-org-session-RsDj9cl4.d.ts} +58 -1
- package/dist/index.cjs +168 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -19
- package/dist/index.d.ts +9 -19
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +294 -258
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +15 -215
- package/dist/react.d.ts +15 -215
- package/dist/react.js +135 -288
- package/dist/react.js.map +1 -1
- package/dist/server.cjs +42 -5
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +24 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.js +42 -5
- package/dist/server.js.map +1 -1
- package/dist/svelte.cjs +512 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +100 -0
- package/dist/svelte.d.ts +100 -0
- package/dist/svelte.js +278 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.cjs +565 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +136 -0
- package/dist/vue.d.ts +136 -0
- package/dist/vue.js +338 -0
- package/dist/vue.js.map +1 -0
- package/package.json +40 -6
- package/src/svelte/AuthProvider.svelte +37 -0
- package/src/svelte/OrgProvider.svelte +22 -0
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-
|
|
2
|
-
export { f as AuthDeviceIdentity, g as AuthDeviceIdentityError, h as AuthError, i as
|
|
3
|
-
import { SchemaDefinition,
|
|
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
|
-
|
|
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):
|
|
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-
|
|
2
|
-
export { f as AuthDeviceIdentity, g as AuthDeviceIdentityError, h as AuthError, i as
|
|
3
|
-
import { SchemaDefinition,
|
|
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
|
-
|
|
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):
|
|
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,
|