dn-react-router-toolkit 0.1.12 → 0.2.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/dist/auth/apple_auth.d.mts +38 -0
- package/dist/auth/apple_auth.d.ts +38 -0
- package/dist/{auth-kit → auth}/apple_auth.js +31 -18
- package/dist/auth/apple_auth.mjs +63 -0
- package/dist/{auth-kit/repository.d.mts → auth/auth_repository.d.mts} +10 -11
- package/dist/{auth-kit/repository.d.ts → auth/auth_repository.d.ts} +10 -11
- package/dist/{file-kit/repository.js → auth/auth_repository.js} +3 -3
- package/dist/{auth-kit → auth}/auth_service.d.mts +12 -23
- package/dist/{auth-kit → auth}/auth_service.d.ts +12 -23
- package/dist/{auth-kit → auth}/auth_service.js +24 -77
- package/dist/{auth-kit → auth}/auth_service.mjs +24 -77
- package/dist/auth/client/google_login_button.d.mts +7 -0
- package/dist/auth/client/google_login_button.d.ts +7 -0
- package/dist/{auth-kit → auth}/client/google_login_button.js +24 -19
- package/dist/auth/client/google_login_button.mjs +37 -0
- package/dist/auth/client/provider.d.mts +26 -0
- package/dist/auth/client/provider.d.ts +26 -0
- package/dist/auth/client/provider.js +152 -0
- package/dist/auth/client/provider.mjs +116 -0
- package/dist/{auth-kit → auth}/client/redirect_page.js +1 -1
- package/dist/{auth-kit → auth}/client/redirect_page.mjs +1 -1
- package/dist/auth/google_auth.d.mts +33 -0
- package/dist/auth/google_auth.d.ts +33 -0
- package/dist/{auth-kit → auth}/google_auth.js +23 -32
- package/dist/{auth-kit → auth}/google_auth.mjs +22 -31
- package/dist/auth/handlers/find_auth.d.mts +13 -0
- package/dist/auth/handlers/find_auth.d.ts +13 -0
- package/dist/{route/api/auth/route.js → auth/handlers/find_auth.js} +10 -10
- package/dist/{route/api/auth/route.mjs → auth/handlers/find_auth.mjs} +5 -5
- package/dist/auth/handlers/login.d.mts +13 -0
- package/dist/auth/handlers/login.d.ts +13 -0
- package/dist/{route/api/auth/login/route.js → auth/handlers/login.js} +17 -17
- package/dist/{route/api/auth/login/route.mjs → auth/handlers/login.mjs} +12 -12
- package/dist/auth/handlers/login_with_thirdparty.d.mts +15 -0
- package/dist/auth/handlers/login_with_thirdparty.d.ts +15 -0
- package/dist/{route/api/auth/login/[provider]/route.js → auth/handlers/login_with_thirdparty.js} +12 -27
- package/dist/{route/api/auth/login/[provider]/route.mjs → auth/handlers/login_with_thirdparty.mjs} +7 -22
- package/dist/auth/handlers/logout.d.mts +13 -0
- package/dist/auth/handlers/logout.d.ts +13 -0
- package/dist/{route/api/auth/logout/route.js → auth/handlers/logout.js} +15 -11
- package/dist/{route/api/auth/logout/route.mjs → auth/handlers/logout.mjs} +11 -7
- package/dist/auth/handlers/refresh.d.mts +13 -0
- package/dist/auth/handlers/refresh.d.ts +13 -0
- package/dist/{route/api/auth/refresh/route.js → auth/handlers/refresh.js} +12 -12
- package/dist/{route/api/auth/refresh/route.mjs → auth/handlers/refresh.mjs} +7 -7
- package/dist/auth/handlers/request_password_reset.d.mts +10 -0
- package/dist/auth/handlers/request_password_reset.d.ts +10 -0
- package/dist/auth/handlers/request_password_reset.js +87 -0
- package/dist/auth/handlers/request_password_reset.mjs +60 -0
- package/dist/auth/handlers/reset_password.d.mts +10 -0
- package/dist/auth/handlers/reset_password.d.ts +10 -0
- package/dist/auth/handlers/reset_password.js +88 -0
- package/dist/auth/handlers/reset_password.mjs +61 -0
- package/dist/auth/handlers/signup.d.mts +15 -0
- package/dist/auth/handlers/signup.d.ts +15 -0
- package/dist/auth/handlers/signup.js +147 -0
- package/dist/auth/handlers/signup.mjs +112 -0
- package/dist/auth/handlers/signup_with_thirdparty.d.mts +17 -0
- package/dist/auth/handlers/signup_with_thirdparty.d.ts +17 -0
- package/dist/auth/handlers/signup_with_thirdparty.js +123 -0
- package/dist/auth/handlers/signup_with_thirdparty.mjs +98 -0
- package/dist/auth/handlers/thirdparty_auth_callback.d.mts +16 -0
- package/dist/auth/handlers/thirdparty_auth_callback.d.ts +16 -0
- package/dist/{route/auth/callback/[provider]/route.js → auth/handlers/thirdparty_auth_callback.js} +54 -45
- package/dist/{route/auth/callback/[provider]/route.mjs → auth/handlers/thirdparty_auth_callback.mjs} +49 -40
- package/dist/{auth-kit/jwt.d.mts → auth/jwt_manager.d.mts} +11 -1
- package/dist/{auth-kit/jwt.d.ts → auth/jwt_manager.d.ts} +11 -1
- package/dist/{auth-kit/jwt.js → auth/jwt_manager.js} +25 -11
- package/dist/{auth-kit/jwt.mjs → auth/jwt_manager.mjs} +22 -8
- package/dist/auth/kakao_auth.d.mts +27 -0
- package/dist/auth/kakao_auth.d.ts +27 -0
- package/dist/auth/kakao_auth.js +56 -0
- package/dist/auth/kakao_auth.mjs +31 -0
- package/dist/auth/password_recovery.d.mts +34 -0
- package/dist/auth/password_recovery.d.ts +34 -0
- package/dist/auth/password_recovery.js +169 -0
- package/dist/auth/password_recovery.mjs +134 -0
- package/dist/auth/thirdparty_auth.d.mts +41 -0
- package/dist/auth/thirdparty_auth.d.ts +41 -0
- package/dist/{auth-kit/kakao_auth.js → auth/thirdparty_auth.js} +31 -33
- package/dist/{auth-kit/kakao_auth.mjs → auth/thirdparty_auth.mjs} +26 -28
- package/dist/{auth-kit → auth}/with_auth.d.mts +5 -6
- package/dist/{auth-kit → auth}/with_auth.d.ts +5 -6
- package/dist/{auth-kit → auth}/with_auth.js +26 -10
- package/dist/auth/with_auth.mjs +63 -0
- package/dist/date.d.mts +2 -0
- package/dist/date.d.ts +2 -0
- package/dist/date.js +4 -2
- package/dist/date.mjs +2 -1
- package/dist/{file-kit → file}/cdn.js +1 -1
- package/dist/{file-kit → file}/cdn.mjs +1 -1
- package/dist/{file-kit → file}/client/drop_file_input.js +3 -3
- package/dist/{file-kit → file}/client/drop_file_input.mjs +3 -3
- package/dist/{file-kit → file}/client/file_upload_button.js +1 -1
- package/dist/{file-kit → file}/client/file_upload_button.mjs +1 -1
- package/dist/{file-kit → file}/client/file_uploader.js +3 -3
- package/dist/{file-kit → file}/client/file_uploader.mjs +2 -2
- package/dist/{file-kit → file}/client/format_size.js +1 -1
- package/dist/{file-kit → file}/client/format_size.mjs +1 -1
- package/dist/{file-kit → file}/client/metadata.js +1 -1
- package/dist/{file-kit → file}/client/metadata.mjs +1 -1
- package/dist/{file-kit/repository.d.mts → file/file_repository.d.mts} +4 -4
- package/dist/{file-kit/repository.d.ts → file/file_repository.d.ts} +4 -4
- package/dist/{auth-kit/repository.js → file/file_repository.js} +3 -3
- package/dist/file/file_service.d.mts +32 -0
- package/dist/file/file_service.d.ts +32 -0
- package/dist/{file-kit → file}/file_service.js +27 -21
- package/dist/file/file_service.mjs +41 -0
- package/dist/file/handlers/delete_file.d.mts +17 -0
- package/dist/file/handlers/delete_file.d.ts +17 -0
- package/dist/{route/api/files/[fileId]/route.js → file/handlers/delete_file.js} +15 -15
- package/dist/{route/api/files/[fileId]/route.mjs → file/handlers/delete_file.mjs} +10 -10
- package/dist/file/handlers/upload_file.d.mts +16 -0
- package/dist/file/handlers/upload_file.d.ts +16 -0
- package/dist/{route/api/files/route.js → file/handlers/upload_file.js} +13 -13
- package/dist/{route/api/files/route.mjs → file/handlers/upload_file.mjs} +8 -8
- package/dist/{file-kit → file}/object_storage.d.mts +3 -1
- package/dist/{file-kit → file}/object_storage.d.ts +3 -1
- package/dist/{file-kit → file}/object_storage.js +2 -2
- package/dist/{file-kit → file}/object_storage.mjs +2 -2
- package/dist/{file-kit → file}/responsive_image.d.mts +4 -4
- package/dist/{file-kit → file}/responsive_image.d.ts +4 -4
- package/dist/{file-kit → file}/responsive_image.js +18 -9
- package/dist/{file-kit → file}/responsive_image.mjs +18 -9
- package/dist/{http-kit → http}/index.js +5 -5
- package/dist/{http-kit → http}/index.mjs +1 -1
- package/dist/{http-kit → http}/response.js +1 -1
- package/dist/{http-kit → http}/response.mjs +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +1 -0
- package/dist/route/api.d.mts +17 -25
- package/dist/route/api.d.ts +17 -25
- package/dist/route/api.js +367 -178
- package/dist/route/api.mjs +356 -177
- package/dist/{seo-kit → seo}/seo.js +1 -1
- package/dist/{seo-kit → seo}/seo.mjs +1 -1
- package/package.json +76 -74
- package/dist/auth-kit/apple_auth.d.mts +0 -24
- package/dist/auth-kit/apple_auth.d.ts +0 -24
- package/dist/auth-kit/apple_auth.mjs +0 -50
- package/dist/auth-kit/client/google_login_button.d.mts +0 -9
- package/dist/auth-kit/client/google_login_button.d.ts +0 -9
- package/dist/auth-kit/client/google_login_button.mjs +0 -32
- package/dist/auth-kit/client/logout.d.mts +0 -3
- package/dist/auth-kit/client/logout.d.ts +0 -3
- package/dist/auth-kit/client/logout.js +0 -49
- package/dist/auth-kit/client/logout.mjs +0 -24
- package/dist/auth-kit/google_auth.d.mts +0 -27
- package/dist/auth-kit/google_auth.d.ts +0 -27
- package/dist/auth-kit/kakao_auth.d.mts +0 -24
- package/dist/auth-kit/kakao_auth.d.ts +0 -24
- package/dist/auth-kit/with_auth.mjs +0 -47
- package/dist/file-kit/file_service.d.mts +0 -26
- package/dist/file-kit/file_service.d.ts +0 -26
- package/dist/file-kit/file_service.mjs +0 -35
- package/dist/route/api/auth/login/_provider_/route.d.mts +0 -20
- package/dist/route/api/auth/login/_provider_/route.d.ts +0 -20
- package/dist/route/api/auth/login/route.d.mts +0 -14
- package/dist/route/api/auth/login/route.d.ts +0 -14
- package/dist/route/api/auth/logout/route.d.mts +0 -14
- package/dist/route/api/auth/logout/route.d.ts +0 -14
- package/dist/route/api/auth/refresh/route.d.mts +0 -13
- package/dist/route/api/auth/refresh/route.d.ts +0 -13
- package/dist/route/api/auth/route.d.mts +0 -13
- package/dist/route/api/auth/route.d.ts +0 -13
- package/dist/route/api/files/_fileId_/route.d.mts +0 -17
- package/dist/route/api/files/_fileId_/route.d.ts +0 -17
- package/dist/route/api/files/route.d.mts +0 -16
- package/dist/route/api/files/route.d.ts +0 -16
- package/dist/route/auth/callback/_provider_/route.d.mts +0 -20
- package/dist/route/auth/callback/_provider_/route.d.ts +0 -20
- /package/dist/{auth-kit/repository.mjs → auth/auth_repository.mjs} +0 -0
- /package/dist/{auth-kit → auth}/client/redirect_page.d.mts +0 -0
- /package/dist/{auth-kit → auth}/client/redirect_page.d.ts +0 -0
- /package/dist/{file-kit → file}/cdn.d.mts +0 -0
- /package/dist/{file-kit → file}/cdn.d.ts +0 -0
- /package/dist/{file-kit → file}/client/drop_file_input.d.mts +0 -0
- /package/dist/{file-kit → file}/client/drop_file_input.d.ts +0 -0
- /package/dist/{file-kit → file}/client/file_upload_button.d.mts +0 -0
- /package/dist/{file-kit → file}/client/file_upload_button.d.ts +0 -0
- /package/dist/{file-kit → file}/client/file_uploader.d.mts +0 -0
- /package/dist/{file-kit → file}/client/file_uploader.d.ts +0 -0
- /package/dist/{file-kit → file}/client/format_size.d.mts +0 -0
- /package/dist/{file-kit → file}/client/format_size.d.ts +0 -0
- /package/dist/{file-kit → file}/client/metadata.d.mts +0 -0
- /package/dist/{file-kit → file}/client/metadata.d.ts +0 -0
- /package/dist/{file-kit/repository.mjs → file/file_repository.mjs} +0 -0
- /package/dist/{http-kit → http}/index.d.mts +0 -0
- /package/dist/{http-kit → http}/index.d.ts +0 -0
- /package/dist/{http-kit → http}/response.d.mts +0 -0
- /package/dist/{http-kit → http}/response.d.ts +0 -0
- /package/dist/{seo-kit → seo}/seo.d.mts +0 -0
- /package/dist/{seo-kit → seo}/seo.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,83 +1,85 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"name": "dn-react-router-toolkit",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "./dist/index.mjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./auth/*": {
|
|
14
|
+
"types": "./dist/auth/*.d.ts",
|
|
15
|
+
"import": "./dist/auth/*.mjs",
|
|
16
|
+
"require": "./dist/auth/*.js"
|
|
17
|
+
},
|
|
18
|
+
"./file/*": {
|
|
19
|
+
"types": "./dist/file/*.d.ts",
|
|
20
|
+
"import": "./dist/file/*.mjs",
|
|
21
|
+
"require": "./dist/file/*.js"
|
|
22
|
+
},
|
|
23
|
+
"./route/*": {
|
|
24
|
+
"types": "./dist/route/*.d.ts",
|
|
25
|
+
"import": "./dist/route/*.mjs",
|
|
26
|
+
"require": "./dist/route/*.js"
|
|
27
|
+
},
|
|
28
|
+
"./components/*": {
|
|
29
|
+
"types": "./dist/components/*.d.ts",
|
|
30
|
+
"import": "./dist/components/*.mjs",
|
|
31
|
+
"require": "./dist/components/*.js"
|
|
32
|
+
},
|
|
33
|
+
"./http/*": {
|
|
34
|
+
"types": "./dist/http/*.d.ts",
|
|
35
|
+
"import": "./dist/http/*.mjs",
|
|
36
|
+
"require": "./dist/http/*.js"
|
|
37
|
+
},
|
|
38
|
+
"./seo/*": {
|
|
39
|
+
"types": "./dist/seo/*.d.ts",
|
|
40
|
+
"import": "./dist/seo/*.mjs",
|
|
41
|
+
"require": "./dist/seo/*.js"
|
|
42
|
+
}
|
|
12
43
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"require": "./dist/auth-kit/*.js"
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch"
|
|
17
47
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"require": "./dist/file-kit/*.js"
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
|
|
22
51
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
52
|
+
"author": "",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
|
|
27
56
|
},
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
57
|
+
"homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
|
|
58
|
+
"description": "",
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^24.10.1",
|
|
61
|
+
"@types/nodemailer": "^7.0.4",
|
|
62
|
+
"@types/react": "^19",
|
|
63
|
+
"@types/react-dom": "^19",
|
|
64
|
+
"rimraf": "^6.0.1",
|
|
65
|
+
"schema-dts": "^1.1.5",
|
|
66
|
+
"tsup": "^8.5.1",
|
|
67
|
+
"typescript": "^5.7.3"
|
|
32
68
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@aws-sdk/client-s3": "^3.940.0",
|
|
71
|
+
"@aws-sdk/s3-request-presigner": "^3.940.0",
|
|
72
|
+
"bcryptjs": "^3.0.3",
|
|
73
|
+
"jose": "^6.1.2",
|
|
74
|
+
"moment-timezone": "^0.6.0",
|
|
75
|
+
"nodemailer": "^7.0.11",
|
|
76
|
+
"react-icons": "^5.5.0",
|
|
77
|
+
"uuid": "^13.0.0"
|
|
37
78
|
},
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"drizzle-orm": "^0.44",
|
|
81
|
+
"react": "^19",
|
|
82
|
+
"react-dom": "^19",
|
|
83
|
+
"react-router": "^7"
|
|
42
84
|
}
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "tsup",
|
|
46
|
-
"dev": "tsup --watch"
|
|
47
|
-
},
|
|
48
|
-
"repository": {
|
|
49
|
-
"type": "git",
|
|
50
|
-
"url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
|
|
51
|
-
},
|
|
52
|
-
"author": "",
|
|
53
|
-
"license": "MIT",
|
|
54
|
-
"bugs": {
|
|
55
|
-
"url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
|
|
56
|
-
},
|
|
57
|
-
"homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
|
|
58
|
-
"description": "",
|
|
59
|
-
"devDependencies": {
|
|
60
|
-
"@types/node": "^24.5.2",
|
|
61
|
-
"@types/react": "^19",
|
|
62
|
-
"@types/react-dom": "^19",
|
|
63
|
-
"rimraf": "^6.0.1",
|
|
64
|
-
"schema-dts": "^1.1.5",
|
|
65
|
-
"tsup": "^8.5.1",
|
|
66
|
-
"typescript": "^5.7.3"
|
|
67
|
-
},
|
|
68
|
-
"dependencies": {
|
|
69
|
-
"@aws-sdk/client-s3": "^3.940.0",
|
|
70
|
-
"@aws-sdk/s3-request-presigner": "^3.940.0",
|
|
71
|
-
"bcryptjs": "^3.0.3",
|
|
72
|
-
"jose": "^6.1.2",
|
|
73
|
-
"moment-timezone": "^0.6.0",
|
|
74
|
-
"react-icons": "^5.5.0",
|
|
75
|
-
"uuid": "^13.0.0"
|
|
76
|
-
},
|
|
77
|
-
"peerDependencies": {
|
|
78
|
-
"drizzle-orm": "^0.44",
|
|
79
|
-
"react": "^19",
|
|
80
|
-
"react-dom": "^19",
|
|
81
|
-
"react-router": "^7"
|
|
82
|
-
}
|
|
83
85
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.mjs';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import 'react-router';
|
|
4
|
-
import './jwt.mjs';
|
|
5
|
-
import '../file-kit/object_storage.mjs';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './repository.mjs';
|
|
8
|
-
|
|
9
|
-
declare class AppleAuth {
|
|
10
|
-
AUTH: AuthService;
|
|
11
|
-
constructor(AUTH: AuthService);
|
|
12
|
-
signIn(code: string, type?: "web" | "app"): Promise<{
|
|
13
|
-
user: {
|
|
14
|
-
id: string;
|
|
15
|
-
role: string;
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
18
|
-
accessToken: string;
|
|
19
|
-
refreshToken: string;
|
|
20
|
-
}>;
|
|
21
|
-
private generateAppleClientSecret;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { AppleAuth };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.js';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import 'react-router';
|
|
4
|
-
import './jwt.js';
|
|
5
|
-
import '../file-kit/object_storage.js';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './repository.js';
|
|
8
|
-
|
|
9
|
-
declare class AppleAuth {
|
|
10
|
-
AUTH: AuthService;
|
|
11
|
-
constructor(AUTH: AuthService);
|
|
12
|
-
signIn(code: string, type?: "web" | "app"): Promise<{
|
|
13
|
-
user: {
|
|
14
|
-
id: string;
|
|
15
|
-
role: string;
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
18
|
-
accessToken: string;
|
|
19
|
-
refreshToken: string;
|
|
20
|
-
}>;
|
|
21
|
-
private generateAppleClientSecret;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { AppleAuth };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// src/auth-kit/apple_auth.ts
|
|
2
|
-
import { decodeJwt, importPKCS8, SignJWT } from "jose";
|
|
3
|
-
var AppleAuth = class {
|
|
4
|
-
AUTH;
|
|
5
|
-
constructor(AUTH) {
|
|
6
|
-
this.AUTH = AUTH;
|
|
7
|
-
}
|
|
8
|
-
async signIn(code, type = "web") {
|
|
9
|
-
const url = "https://appleid.apple.com/auth/token";
|
|
10
|
-
const client_secret = await this.generateAppleClientSecret(type);
|
|
11
|
-
const res = await fetch(url, {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: {
|
|
14
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
15
|
-
},
|
|
16
|
-
body: new URLSearchParams({
|
|
17
|
-
client_id: type === "web" ? process.env.APPLE_SERVICE_ID : process.env.APPLE_CLIENT_ID,
|
|
18
|
-
client_secret,
|
|
19
|
-
code,
|
|
20
|
-
grant_type: "authorization_code"
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
if (!res.ok) {
|
|
24
|
-
console.error(await res.text());
|
|
25
|
-
throw new Error("Apple \uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
|
|
26
|
-
}
|
|
27
|
-
const data = await res.json();
|
|
28
|
-
const { id_token } = data;
|
|
29
|
-
const payload = decodeJwt(id_token);
|
|
30
|
-
const { sub, email, name } = payload;
|
|
31
|
-
const user = await this.AUTH.getOrCreateUser("apple", {
|
|
32
|
-
id: sub,
|
|
33
|
-
email,
|
|
34
|
-
name
|
|
35
|
-
});
|
|
36
|
-
const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
|
|
37
|
-
return { user, accessToken, refreshToken };
|
|
38
|
-
}
|
|
39
|
-
async generateAppleClientSecret(type = "web") {
|
|
40
|
-
const authKey = process.env.APPLE_AUTH_KEY;
|
|
41
|
-
const teamId = process.env.APPLE_TEAM_ID;
|
|
42
|
-
const keyId = process.env.APPLE_KEY_ID;
|
|
43
|
-
const clientId = type === "web" ? process.env.APPLE_SERVICE_ID : process.env.APPLE_CLIENT_ID;
|
|
44
|
-
const keyObject = await importPKCS8(authKey, "ES256");
|
|
45
|
-
return new SignJWT().setProtectedHeader({ alg: "ES256", kid: keyId }).setIssuedAt().setIssuer(teamId).setExpirationTime("1h").setAudience("https://appleid.apple.com").setSubject(clientId).sign(keyObject);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
export {
|
|
49
|
-
AppleAuth
|
|
50
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// src/auth-kit/client/google_login_button.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { FcGoogle } from "react-icons/fc";
|
|
4
|
-
import { useSearchParams } from "react-router";
|
|
5
|
-
function GoogleLoginButton({
|
|
6
|
-
className = "max-w-[300px] w-full",
|
|
7
|
-
GOOGLE_CLIENT_ID,
|
|
8
|
-
GOOGLE_REDIRECT_URI
|
|
9
|
-
}) {
|
|
10
|
-
const [searchParams] = useSearchParams();
|
|
11
|
-
const redirectUrl = searchParams.get("redirectUrl") || "";
|
|
12
|
-
const googleClientId = GOOGLE_CLIENT_ID || "";
|
|
13
|
-
const googleRedirectUrl = GOOGLE_REDIRECT_URI || "";
|
|
14
|
-
const href = new URL("https://accounts.google.com/o/oauth2/v2/auth");
|
|
15
|
-
href.searchParams.append("client_id", googleClientId);
|
|
16
|
-
href.searchParams.append("redirect_uri", googleRedirectUrl);
|
|
17
|
-
href.searchParams.append("response_type", "code");
|
|
18
|
-
href.searchParams.append("scope", "email profile");
|
|
19
|
-
href.searchParams.append("state", redirectUrl);
|
|
20
|
-
return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement(
|
|
21
|
-
"a",
|
|
22
|
-
{
|
|
23
|
-
href: href.toString(),
|
|
24
|
-
className: "relative flex items-center border border-neutral-300 px-4 py-3 no-underline hover:no-underline bg-white hover:bg-neutral-100 rounded"
|
|
25
|
-
},
|
|
26
|
-
/* @__PURE__ */ React.createElement(FcGoogle, null),
|
|
27
|
-
/* @__PURE__ */ React.createElement("p", { className: "text-[14px] text-black absolute left-0 right-0 text-center" }, "\uAD6C\uAE00\uB85C \uACC4\uC18D\uD558\uAE30")
|
|
28
|
-
));
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
GoogleLoginButton
|
|
32
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/auth-kit/client/logout.ts
|
|
21
|
-
var logout_exports = {};
|
|
22
|
-
__export(logout_exports, {
|
|
23
|
-
useLogout: () => useLogout
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(logout_exports);
|
|
26
|
-
var import_react_router = require("react-router");
|
|
27
|
-
function useLogout() {
|
|
28
|
-
const navigate = (0, import_react_router.useNavigate)();
|
|
29
|
-
const logout = async () => {
|
|
30
|
-
const ok = confirm("\uC815\uB9D0 \uB85C\uADF8\uC544\uC6C3 \uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?");
|
|
31
|
-
if (!ok) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const res = await fetch("/api/auth/logout", {
|
|
35
|
-
method: "POST"
|
|
36
|
-
});
|
|
37
|
-
if (res.ok) {
|
|
38
|
-
navigate("/");
|
|
39
|
-
} else {
|
|
40
|
-
const { message } = await res.json();
|
|
41
|
-
alert(message);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
return logout;
|
|
45
|
-
}
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
useLogout
|
|
49
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// src/auth-kit/client/logout.ts
|
|
2
|
-
import { useNavigate } from "react-router";
|
|
3
|
-
function useLogout() {
|
|
4
|
-
const navigate = useNavigate();
|
|
5
|
-
const logout = async () => {
|
|
6
|
-
const ok = confirm("\uC815\uB9D0 \uB85C\uADF8\uC544\uC6C3 \uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?");
|
|
7
|
-
if (!ok) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const res = await fetch("/api/auth/logout", {
|
|
11
|
-
method: "POST"
|
|
12
|
-
});
|
|
13
|
-
if (res.ok) {
|
|
14
|
-
navigate("/");
|
|
15
|
-
} else {
|
|
16
|
-
const { message } = await res.json();
|
|
17
|
-
alert(message);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
return logout;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
useLogout
|
|
24
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.mjs';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import 'react-router';
|
|
4
|
-
import './jwt.mjs';
|
|
5
|
-
import '../file-kit/object_storage.mjs';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './repository.mjs';
|
|
8
|
-
|
|
9
|
-
declare class GoogleAuth {
|
|
10
|
-
AUTH: AuthService;
|
|
11
|
-
GOOGLE_CLIENT_ID: string;
|
|
12
|
-
GOOGLE_CLIENT_SECRET: string;
|
|
13
|
-
GOOGLE_REDIRECT_URI: string;
|
|
14
|
-
constructor(AUTH: AuthService, GOOGLE_CLIENT_ID: string, GOOGLE_CLIENT_SECRET: string, GOOGLE_REDIRECT_URI: string);
|
|
15
|
-
signIn(code: string): Promise<{
|
|
16
|
-
user: {
|
|
17
|
-
id: string;
|
|
18
|
-
role: string;
|
|
19
|
-
name: string;
|
|
20
|
-
refreshToken: string | null;
|
|
21
|
-
};
|
|
22
|
-
accessToken: string;
|
|
23
|
-
refreshToken: string;
|
|
24
|
-
}>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { GoogleAuth };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.js';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import 'react-router';
|
|
4
|
-
import './jwt.js';
|
|
5
|
-
import '../file-kit/object_storage.js';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './repository.js';
|
|
8
|
-
|
|
9
|
-
declare class GoogleAuth {
|
|
10
|
-
AUTH: AuthService;
|
|
11
|
-
GOOGLE_CLIENT_ID: string;
|
|
12
|
-
GOOGLE_CLIENT_SECRET: string;
|
|
13
|
-
GOOGLE_REDIRECT_URI: string;
|
|
14
|
-
constructor(AUTH: AuthService, GOOGLE_CLIENT_ID: string, GOOGLE_CLIENT_SECRET: string, GOOGLE_REDIRECT_URI: string);
|
|
15
|
-
signIn(code: string): Promise<{
|
|
16
|
-
user: {
|
|
17
|
-
id: string;
|
|
18
|
-
role: string;
|
|
19
|
-
name: string;
|
|
20
|
-
refreshToken: string | null;
|
|
21
|
-
};
|
|
22
|
-
accessToken: string;
|
|
23
|
-
refreshToken: string;
|
|
24
|
-
}>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { GoogleAuth };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.mjs';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import 'react-router';
|
|
4
|
-
import './jwt.mjs';
|
|
5
|
-
import '../file-kit/object_storage.mjs';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './repository.mjs';
|
|
8
|
-
|
|
9
|
-
declare class KakaoAuth {
|
|
10
|
-
AUTH: AuthService;
|
|
11
|
-
constructor(AUTH: AuthService);
|
|
12
|
-
signIn(kakaoAccessToken: string): Promise<{
|
|
13
|
-
user: {
|
|
14
|
-
id: string;
|
|
15
|
-
role: string;
|
|
16
|
-
name: string;
|
|
17
|
-
refreshToken: string | null;
|
|
18
|
-
};
|
|
19
|
-
accessToken: string;
|
|
20
|
-
refreshToken: string;
|
|
21
|
-
}>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { KakaoAuth };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AuthService } from './auth_service.js';
|
|
2
|
-
import 'jose';
|
|
3
|
-
import 'react-router';
|
|
4
|
-
import './jwt.js';
|
|
5
|
-
import '../file-kit/object_storage.js';
|
|
6
|
-
import '@aws-sdk/client-s3';
|
|
7
|
-
import './repository.js';
|
|
8
|
-
|
|
9
|
-
declare class KakaoAuth {
|
|
10
|
-
AUTH: AuthService;
|
|
11
|
-
constructor(AUTH: AuthService);
|
|
12
|
-
signIn(kakaoAccessToken: string): Promise<{
|
|
13
|
-
user: {
|
|
14
|
-
id: string;
|
|
15
|
-
role: string;
|
|
16
|
-
name: string;
|
|
17
|
-
refreshToken: string | null;
|
|
18
|
-
};
|
|
19
|
-
accessToken: string;
|
|
20
|
-
refreshToken: string;
|
|
21
|
-
}>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { KakaoAuth };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// src/auth-kit/with_auth.ts
|
|
2
|
-
function createWithAuthHandler({ JWT_MANAGER, AUTH }) {
|
|
3
|
-
return function(fn) {
|
|
4
|
-
const handler = async function(arg) {
|
|
5
|
-
const accessToken = await AUTH.getAccessTokenFromRequest(arg.request);
|
|
6
|
-
if (accessToken) {
|
|
7
|
-
const payload = await JWT_MANAGER.verifyAccessToken(accessToken);
|
|
8
|
-
if (payload) {
|
|
9
|
-
return fn(payload)(arg);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
const refreshToken = await AUTH.getRefreshTokenFromCookies(arg.request);
|
|
13
|
-
if (refreshToken) {
|
|
14
|
-
try {
|
|
15
|
-
const newAccessToken = await AUTH.refreshAccessToken(refreshToken);
|
|
16
|
-
const setCookieHeader = await AUTH.getAccessTokenSetCookie(
|
|
17
|
-
newAccessToken
|
|
18
|
-
);
|
|
19
|
-
const headers = new Headers();
|
|
20
|
-
headers.append("Set-Cookie", setCookieHeader);
|
|
21
|
-
headers.append("Location", arg.request.url);
|
|
22
|
-
return new Response("Temporary Redirect", {
|
|
23
|
-
status: 307,
|
|
24
|
-
headers
|
|
25
|
-
});
|
|
26
|
-
} catch (e) {
|
|
27
|
-
if (e instanceof Error) {
|
|
28
|
-
console.log(e.message);
|
|
29
|
-
}
|
|
30
|
-
const setCookieHeader = await AUTH.getRefreshTokenSetCookie(null);
|
|
31
|
-
const headers = new Headers();
|
|
32
|
-
headers.append("Set-Cookie", setCookieHeader);
|
|
33
|
-
headers.append("Location", arg.request.url);
|
|
34
|
-
return new Response("Temporary Redirect", {
|
|
35
|
-
status: 307,
|
|
36
|
-
headers
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return fn(void 0)(arg);
|
|
41
|
-
};
|
|
42
|
-
return handler;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
createWithAuthHandler
|
|
47
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ObjectStorage } from './object_storage.mjs';
|
|
2
|
-
import { FileRepository } from './repository.mjs';
|
|
3
|
-
import '@aws-sdk/client-s3';
|
|
4
|
-
|
|
5
|
-
type Params = {
|
|
6
|
-
userId?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
type: string;
|
|
9
|
-
size: number;
|
|
10
|
-
metadata?: Record<string, any>;
|
|
11
|
-
};
|
|
12
|
-
declare class FileService<TFile> {
|
|
13
|
-
prefix: string;
|
|
14
|
-
repository: FileRepository<TFile>;
|
|
15
|
-
OBJECT_STORAGE: ObjectStorage;
|
|
16
|
-
constructor(prefix: string | undefined, { repository, OBJECT_STORAGE, }: {
|
|
17
|
-
repository: FileRepository<TFile>;
|
|
18
|
-
OBJECT_STORAGE: ObjectStorage;
|
|
19
|
-
});
|
|
20
|
-
generateSignedUrl({ userId, name, type, size, metadata }: Params): Promise<{
|
|
21
|
-
file: Awaited<TFile>;
|
|
22
|
-
signedUrl: string;
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { FileService };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ObjectStorage } from './object_storage.js';
|
|
2
|
-
import { FileRepository } from './repository.js';
|
|
3
|
-
import '@aws-sdk/client-s3';
|
|
4
|
-
|
|
5
|
-
type Params = {
|
|
6
|
-
userId?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
type: string;
|
|
9
|
-
size: number;
|
|
10
|
-
metadata?: Record<string, any>;
|
|
11
|
-
};
|
|
12
|
-
declare class FileService<TFile> {
|
|
13
|
-
prefix: string;
|
|
14
|
-
repository: FileRepository<TFile>;
|
|
15
|
-
OBJECT_STORAGE: ObjectStorage;
|
|
16
|
-
constructor(prefix: string | undefined, { repository, OBJECT_STORAGE, }: {
|
|
17
|
-
repository: FileRepository<TFile>;
|
|
18
|
-
OBJECT_STORAGE: ObjectStorage;
|
|
19
|
-
});
|
|
20
|
-
generateSignedUrl({ userId, name, type, size, metadata }: Params): Promise<{
|
|
21
|
-
file: Awaited<TFile>;
|
|
22
|
-
signedUrl: string;
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { FileService };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// src/file-kit/file_service.ts
|
|
2
|
-
import { v4 } from "uuid";
|
|
3
|
-
var FileService = class {
|
|
4
|
-
prefix;
|
|
5
|
-
repository;
|
|
6
|
-
OBJECT_STORAGE;
|
|
7
|
-
constructor(prefix = "user", {
|
|
8
|
-
repository,
|
|
9
|
-
OBJECT_STORAGE
|
|
10
|
-
}) {
|
|
11
|
-
this.prefix = prefix;
|
|
12
|
-
this.repository = repository;
|
|
13
|
-
this.OBJECT_STORAGE = OBJECT_STORAGE;
|
|
14
|
-
}
|
|
15
|
-
async generateSignedUrl({ userId, name, type, size, metadata = {} }) {
|
|
16
|
-
const id = v4();
|
|
17
|
-
const key = `${this.prefix}/${id}/${name}`;
|
|
18
|
-
const file = await this.repository.createFile({
|
|
19
|
-
id,
|
|
20
|
-
userId,
|
|
21
|
-
name,
|
|
22
|
-
type,
|
|
23
|
-
size,
|
|
24
|
-
metadata,
|
|
25
|
-
key
|
|
26
|
-
});
|
|
27
|
-
const signedUrl = await this.OBJECT_STORAGE.generateSignedUrl(key, {
|
|
28
|
-
contentType: type
|
|
29
|
-
});
|
|
30
|
-
return { file, signedUrl };
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
FileService
|
|
35
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GoogleAuth } from '../../../../../auth-kit/google_auth.mjs';
|
|
2
|
-
import { AppleAuth } from '../../../../../auth-kit/apple_auth.mjs';
|
|
3
|
-
import { KakaoAuth } from '../../../../../auth-kit/kakao_auth.mjs';
|
|
4
|
-
import '../../../../../auth-kit/auth_service.mjs';
|
|
5
|
-
import 'jose';
|
|
6
|
-
import 'react-router';
|
|
7
|
-
import '../../../../../auth-kit/jwt.mjs';
|
|
8
|
-
import '../../../../../file-kit/object_storage.mjs';
|
|
9
|
-
import '@aws-sdk/client-s3';
|
|
10
|
-
import '../../../../../auth-kit/repository.mjs';
|
|
11
|
-
|
|
12
|
-
declare const loginThirdPartyHandler: (request: Request, { provider, }: {
|
|
13
|
-
provider: string;
|
|
14
|
-
}, { GOOGLE_AUTH, APPLE_AUTH, KAKAO_AUTH, }: {
|
|
15
|
-
GOOGLE_AUTH: GoogleAuth;
|
|
16
|
-
APPLE_AUTH: AppleAuth;
|
|
17
|
-
KAKAO_AUTH: KakaoAuth;
|
|
18
|
-
}) => Promise<Response>;
|
|
19
|
-
|
|
20
|
-
export { loginThirdPartyHandler };
|