@playcademy/better-auth 0.0.1-alpha.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.
- package/README.md +57 -0
- package/dist/client.d.ts +69 -0
- package/dist/client.js +278 -0
- package/dist/fetch.d.ts +10 -0
- package/dist/server.d.ts +92 -0
- package/dist/server.js +20655 -0
- package/dist/utils.d.ts +44 -0
- package/package.json +39 -0
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for Playcademy Better Auth plugins
|
|
3
|
+
*
|
|
4
|
+
* Common detection and helper functions used by both client and fetch plugins.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if we're in platform mode (iframe with Playcademy SDK)
|
|
8
|
+
*/
|
|
9
|
+
export declare function isPlatformMode(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Detect if the browser is Safari
|
|
12
|
+
*
|
|
13
|
+
* Safari doesn't support CHIPS (Partitioned cookies) in iframes,
|
|
14
|
+
* so it requires Storage Access API.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isSafari(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get platform token from SDK
|
|
19
|
+
*
|
|
20
|
+
* The SDK sets window.PLAYCADEMY.token after initialization.
|
|
21
|
+
* Make sure to call this AFTER the SDK has initialized.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getPlatformToken(): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Check if Storage Access API is available
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasStorageAccessAPI(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Check if we need to request storage access
|
|
30
|
+
*
|
|
31
|
+
* Returns true if:
|
|
32
|
+
* - In platform mode (iframe)
|
|
33
|
+
* - Using Safari
|
|
34
|
+
* - Storage Access API is available
|
|
35
|
+
* - Don't already have access
|
|
36
|
+
*/
|
|
37
|
+
export declare function needsStorageAccess(): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Request storage access from the user
|
|
40
|
+
*
|
|
41
|
+
* This must be called in response to a user gesture (click).
|
|
42
|
+
* Shows a browser-native prompt asking the user to allow cookies.
|
|
43
|
+
*/
|
|
44
|
+
export declare function requestStorageAccess(): Promise<boolean>;
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@playcademy/better-auth",
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
"./server": {
|
|
7
|
+
"types": "./dist/server.d.ts",
|
|
8
|
+
"import": "./dist/server.js",
|
|
9
|
+
"require": "./dist/server.js"
|
|
10
|
+
},
|
|
11
|
+
"./client": {
|
|
12
|
+
"types": "./dist/client.d.ts",
|
|
13
|
+
"import": "./dist/client.js",
|
|
14
|
+
"require": "./dist/client.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"main": "dist/index.js",
|
|
18
|
+
"module": "dist/index.js",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "bun build.ts",
|
|
24
|
+
"pub": "bun publish.ts"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"better-auth": "1.3.33"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@inquirer/prompts": "^7.9.0",
|
|
31
|
+
"@playcademy/sdk": "0.1.13",
|
|
32
|
+
"@playcademy/utils": "0.0.1",
|
|
33
|
+
"@types/bun": "latest",
|
|
34
|
+
"typescript": "^5.7.2"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"typescript": "^5"
|
|
38
|
+
}
|
|
39
|
+
}
|