dn-react-router-toolkit 0.1.1 → 0.1.2
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-kit/apple_auth.d.mts +24 -0
- package/dist/{esm/auth-kit → auth-kit}/apple_auth.d.ts +11 -2
- package/dist/auth-kit/apple_auth.js +75 -0
- package/dist/auth-kit/apple_auth.mjs +50 -0
- package/dist/auth-kit/auth_service.d.mts +73 -0
- package/dist/{esm/auth-kit → auth-kit}/auth_service.d.ts +17 -11
- package/dist/auth-kit/auth_service.js +257 -0
- package/dist/auth-kit/auth_service.mjs +218 -0
- package/dist/auth-kit/client/google_login_button.d.mts +9 -0
- package/dist/auth-kit/client/google_login_button.d.ts +9 -0
- package/dist/auth-kit/client/google_login_button.js +67 -0
- package/dist/auth-kit/client/google_login_button.mjs +32 -0
- package/dist/auth-kit/client/redirect_page.d.mts +5 -0
- package/dist/auth-kit/client/redirect_page.d.ts +5 -0
- package/dist/auth-kit/client/redirect_page.js +53 -0
- package/dist/auth-kit/client/redirect_page.mjs +18 -0
- package/dist/auth-kit/google_auth.d.mts +27 -0
- package/dist/{esm/auth-kit → auth-kit}/google_auth.d.ts +11 -2
- package/dist/auth-kit/google_auth.js +144 -0
- package/dist/auth-kit/google_auth.mjs +117 -0
- package/dist/auth-kit/jwt.d.mts +18 -0
- package/dist/{esm/auth-kit → auth-kit}/jwt.d.ts +5 -2
- package/dist/auth-kit/jwt.js +76 -0
- package/dist/auth-kit/jwt.mjs +51 -0
- package/dist/auth-kit/kakao_auth.d.mts +24 -0
- package/dist/{esm/auth-kit → auth-kit}/kakao_auth.d.ts +11 -2
- package/dist/auth-kit/kakao_auth.js +115 -0
- package/dist/auth-kit/kakao_auth.mjs +88 -0
- package/dist/auth-kit/repository.d.mts +42 -0
- package/dist/{esm/auth-kit → auth-kit}/repository.d.ts +3 -1
- package/dist/auth-kit/repository.js +18 -0
- package/dist/auth-kit/repository.mjs +0 -0
- package/dist/auth-kit/with_auth.d.mts +17 -0
- package/dist/auth-kit/with_auth.d.ts +17 -0
- package/dist/auth-kit/with_auth.js +108 -0
- package/dist/auth-kit/with_auth.mjs +71 -0
- package/dist/cn.d.mts +3 -0
- package/dist/cn.d.ts +3 -0
- package/dist/cn.js +32 -0
- package/dist/cn.mjs +7 -0
- package/dist/components/index.d.mts +5 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +261 -0
- package/dist/components/index.mjs +219 -0
- package/dist/components/modal/fullscreen_container.d.mts +7 -0
- package/dist/components/modal/fullscreen_container.d.ts +7 -0
- package/dist/components/modal/fullscreen_container.js +102 -0
- package/dist/components/modal/fullscreen_container.mjs +68 -0
- package/dist/components/modal/hooks.d.mts +18 -0
- package/dist/components/modal/hooks.d.ts +18 -0
- package/dist/components/modal/hooks.js +236 -0
- package/dist/components/modal/hooks.mjs +204 -0
- package/dist/components/modal/index.d.mts +4 -0
- package/dist/components/modal/index.d.ts +4 -0
- package/dist/components/modal/index.js +238 -0
- package/dist/components/modal/index.mjs +203 -0
- package/dist/components/modal/modal.d.mts +13 -0
- package/dist/components/modal/modal.d.ts +13 -0
- package/dist/components/modal/modal.js +155 -0
- package/dist/components/modal/modal.mjs +130 -0
- package/dist/components/styles.d.mts +9 -0
- package/dist/components/styles.d.ts +9 -0
- package/dist/components/styles.js +48 -0
- package/dist/components/styles.mjs +17 -0
- package/dist/date.d.mts +3 -0
- package/dist/date.d.ts +3 -0
- package/dist/date.js +63 -0
- package/dist/date.mjs +28 -0
- package/dist/file-kit/cdn.d.mts +5 -0
- package/dist/file-kit/cdn.d.ts +5 -0
- package/dist/file-kit/cdn.js +34 -0
- package/dist/file-kit/cdn.mjs +9 -0
- package/dist/file-kit/client/drop_file_input.d.mts +33 -0
- package/dist/{esm/file-kit → file-kit}/client/drop_file_input.d.ts +10 -8
- package/dist/file-kit/client/drop_file_input.js +235 -0
- package/dist/file-kit/client/drop_file_input.mjs +205 -0
- package/dist/file-kit/client/file_uploader.d.mts +13 -0
- package/dist/{esm/file-kit → file-kit}/client/file_uploader.d.ts +4 -2
- package/dist/file-kit/client/file_uploader.js +115 -0
- package/dist/file-kit/client/file_uploader.mjs +90 -0
- package/dist/file-kit/file_service.d.mts +26 -0
- package/dist/{esm/file-kit → file-kit}/file_service.d.ts +7 -4
- package/dist/file-kit/file_service.js +60 -0
- package/dist/file-kit/file_service.mjs +35 -0
- package/dist/file-kit/object_storage.d.mts +17 -0
- package/dist/{esm/file-kit → file-kit}/object_storage.d.ts +6 -2
- package/dist/file-kit/object_storage.js +78 -0
- package/dist/file-kit/object_storage.mjs +57 -0
- package/dist/file-kit/repository.d.mts +16 -0
- package/dist/{esm/file-kit → file-kit}/repository.d.ts +3 -1
- package/dist/file-kit/repository.js +18 -0
- package/dist/file-kit/repository.mjs +0 -0
- package/dist/file-kit/responsive_image.d.mts +20 -0
- package/dist/file-kit/responsive_image.d.ts +20 -0
- package/dist/file-kit/responsive_image.js +123 -0
- package/dist/file-kit/responsive_image.mjs +87 -0
- package/dist/http-kit/index.d.mts +1 -0
- package/dist/http-kit/index.d.ts +1 -0
- package/dist/http-kit/index.js +111 -0
- package/dist/http-kit/index.mjs +68 -0
- package/dist/http-kit/response.d.mts +19 -0
- package/dist/http-kit/response.d.ts +19 -0
- package/dist/http-kit/response.js +109 -0
- package/dist/http-kit/response.mjs +68 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +91 -0
- package/dist/index.mjs +51 -0
- package/dist/route/api/auth/login/[provider]/route.js +113 -0
- package/dist/route/api/auth/login/[provider]/route.mjs +86 -0
- package/dist/route/api/auth/login/_provider_/route.d.mts +20 -0
- package/dist/route/api/auth/login/_provider_/route.d.ts +20 -0
- package/dist/route/api/auth/login/route.d.mts +14 -0
- package/dist/route/api/auth/login/route.d.ts +14 -0
- package/dist/route/api/auth/login/route.js +107 -0
- package/dist/route/api/auth/login/route.mjs +80 -0
- package/dist/route/api/auth/logout/route.d.mts +14 -0
- package/dist/route/api/auth/logout/route.d.ts +14 -0
- package/dist/route/api/auth/logout/route.js +98 -0
- package/dist/route/api/auth/logout/route.mjs +71 -0
- package/dist/route/api/auth/refresh/route.d.mts +13 -0
- package/dist/route/api/auth/refresh/route.d.ts +13 -0
- package/dist/route/api/auth/refresh/route.js +92 -0
- package/dist/route/api/auth/refresh/route.mjs +65 -0
- package/dist/route/api/auth/route.d.mts +13 -0
- package/dist/route/api/auth/route.d.ts +13 -0
- package/dist/route/api/auth/route.js +82 -0
- package/dist/route/api/auth/route.mjs +55 -0
- package/dist/route/api/files/[fileId]/route.js +99 -0
- package/dist/route/api/files/[fileId]/route.mjs +72 -0
- package/dist/route/api/files/_fileId_/route.d.mts +17 -0
- package/dist/route/api/files/_fileId_/route.d.ts +17 -0
- package/dist/route/api/files/route.d.mts +16 -0
- package/dist/route/api/files/route.d.ts +16 -0
- package/dist/route/api/files/route.js +106 -0
- package/dist/route/api/files/route.mjs +79 -0
- package/dist/route/api.d.mts +29 -0
- package/dist/route/api.d.ts +29 -0
- package/dist/route/api.js +395 -0
- package/dist/route/api.mjs +368 -0
- package/dist/route/auth/callback/[provider]/route.js +120 -0
- package/dist/route/auth/callback/[provider]/route.mjs +93 -0
- package/dist/route/auth/callback/_provider_/route.d.mts +20 -0
- package/dist/route/auth/callback/_provider_/route.d.ts +20 -0
- package/dist/seo-kit/index.d.mts +6 -0
- package/dist/seo-kit/index.d.ts +6 -0
- package/dist/seo-kit/index.js +321 -0
- package/dist/seo-kit/index.mjs +282 -0
- package/dist/seo-kit/loader.d.mts +7 -0
- package/dist/seo-kit/loader.d.ts +7 -0
- package/dist/seo-kit/loader.js +43 -0
- package/dist/seo-kit/loader.mjs +18 -0
- package/dist/seo-kit/seo.d.mts +103 -0
- package/dist/{esm/seo-kit → seo-kit}/seo.d.ts +10 -6
- package/dist/seo-kit/seo.js +286 -0
- package/dist/seo-kit/seo.mjs +251 -0
- package/dist/seo-kit/seo_loader.d.mts +16 -0
- package/dist/seo-kit/seo_loader.d.ts +16 -0
- package/dist/seo-kit/seo_loader.js +68 -0
- package/dist/seo-kit/seo_loader.mjs +31 -0
- package/dist/singleton.d.mts +3 -0
- package/dist/singleton.d.ts +3 -0
- package/dist/singleton.js +37 -0
- package/dist/singleton.mjs +12 -0
- package/dist/slug.d.mts +3 -0
- package/dist/slug.d.ts +3 -0
- package/dist/slug.js +32 -0
- package/dist/slug.mjs +7 -0
- package/package.json +36 -34
- package/tsup.config.ts +9 -0
- package/dist/cjs/auth-kit/apple_auth.js +0 -61
- package/dist/cjs/auth-kit/auth_service.js +0 -204
- package/dist/cjs/auth-kit/client/google_login_button.js +0 -19
- package/dist/cjs/auth-kit/client/redirect_page.js +0 -18
- package/dist/cjs/auth-kit/google_auth.js +0 -69
- package/dist/cjs/auth-kit/jwt.js +0 -54
- package/dist/cjs/auth-kit/kakao_auth.js +0 -43
- package/dist/cjs/auth-kit/repository.js +0 -2
- package/dist/cjs/auth-kit/with_auth.js +0 -46
- package/dist/cjs/cn.js +0 -6
- package/dist/cjs/components/index.js +0 -18
- package/dist/cjs/components/modal/fullscreen_container.js +0 -49
- package/dist/cjs/components/modal/hooks.js +0 -76
- package/dist/cjs/components/modal/index.js +0 -19
- package/dist/cjs/components/modal/modal.js +0 -79
- package/dist/cjs/components/styles.js +0 -10
- package/dist/cjs/date.js +0 -31
- package/dist/cjs/file-kit/cdn.js +0 -9
- package/dist/cjs/file-kit/client/drop_file_input.js +0 -148
- package/dist/cjs/file-kit/client/file_uploader.js +0 -88
- package/dist/cjs/file-kit/file_service.js +0 -32
- package/dist/cjs/file-kit/object_storage.js +0 -51
- package/dist/cjs/file-kit/repository.js +0 -2
- package/dist/cjs/file-kit/responsive_image.js +0 -63
- package/dist/cjs/http-kit/index.js +0 -17
- package/dist/cjs/http-kit/response.js +0 -37
- package/dist/cjs/index.js +0 -20
- package/dist/cjs/route/api/auth/login/[provider]/route.js +0 -36
- package/dist/cjs/route/api/auth/login/route.js +0 -35
- package/dist/cjs/route/api/auth/logout/route.js +0 -22
- package/dist/cjs/route/api/auth/refresh/route.js +0 -22
- package/dist/cjs/route/api/auth/route.js +0 -12
- package/dist/cjs/route/api/files/[fileId]/route.js +0 -20
- package/dist/cjs/route/api/files/route.js +0 -34
- package/dist/cjs/route/auth/callback/[provider]/route.js +0 -38
- package/dist/cjs/route/index.js +0 -80
- package/dist/cjs/seo-kit/index.js +0 -19
- package/dist/cjs/seo-kit/loader.js +0 -17
- package/dist/cjs/seo-kit/seo.js +0 -278
- package/dist/cjs/seo-kit/seo_loader.js +0 -15
- package/dist/cjs/singleton.js +0 -12
- package/dist/cjs/slug.js +0 -10
- package/dist/esm/auth-kit/apple_auth.js +0 -57
- package/dist/esm/auth-kit/auth_service.js +0 -197
- package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -5
- package/dist/esm/auth-kit/client/google_login_button.js +0 -16
- package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -1
- package/dist/esm/auth-kit/client/redirect_page.js +0 -15
- package/dist/esm/auth-kit/google_auth.js +0 -65
- package/dist/esm/auth-kit/jwt.js +0 -50
- package/dist/esm/auth-kit/kakao_auth.js +0 -39
- package/dist/esm/auth-kit/repository.js +0 -1
- package/dist/esm/auth-kit/with_auth.d.ts +0 -12
- package/dist/esm/auth-kit/with_auth.js +0 -43
- package/dist/esm/cn.d.ts +0 -1
- package/dist/esm/cn.js +0 -3
- package/dist/esm/components/index.d.ts +0 -2
- package/dist/esm/components/index.js +0 -2
- package/dist/esm/components/modal/fullscreen_container.d.ts +0 -5
- package/dist/esm/components/modal/fullscreen_container.js +0 -45
- package/dist/esm/components/modal/hooks.d.ts +0 -15
- package/dist/esm/components/modal/hooks.js +0 -67
- package/dist/esm/components/modal/index.d.ts +0 -3
- package/dist/esm/components/modal/index.js +0 -3
- package/dist/esm/components/modal/modal.d.ts +0 -10
- package/dist/esm/components/modal/modal.js +0 -43
- package/dist/esm/components/styles.d.ts +0 -7
- package/dist/esm/components/styles.js +0 -7
- package/dist/esm/date.d.ts +0 -1
- package/dist/esm/date.js +0 -24
- package/dist/esm/file-kit/cdn.d.ts +0 -3
- package/dist/esm/file-kit/cdn.js +0 -5
- package/dist/esm/file-kit/client/drop_file_input.js +0 -144
- package/dist/esm/file-kit/client/file_uploader.js +0 -84
- package/dist/esm/file-kit/file_service.js +0 -28
- package/dist/esm/file-kit/object_storage.js +0 -47
- package/dist/esm/file-kit/repository.js +0 -1
- package/dist/esm/file-kit/responsive_image.d.ts +0 -17
- package/dist/esm/file-kit/responsive_image.js +0 -58
- package/dist/esm/http-kit/index.d.ts +0 -1
- package/dist/esm/http-kit/index.js +0 -1
- package/dist/esm/http-kit/response.d.ts +0 -17
- package/dist/esm/http-kit/response.js +0 -31
- package/dist/esm/index.d.ts +0 -4
- package/dist/esm/index.js +0 -4
- package/dist/esm/route/api/auth/login/[provider]/route.d.ts +0 -10
- package/dist/esm/route/api/auth/login/[provider]/route.js +0 -32
- package/dist/esm/route/api/auth/login/route.d.ts +0 -6
- package/dist/esm/route/api/auth/login/route.js +0 -31
- package/dist/esm/route/api/auth/logout/route.d.ts +0 -6
- package/dist/esm/route/api/auth/logout/route.js +0 -18
- package/dist/esm/route/api/auth/refresh/route.d.ts +0 -4
- package/dist/esm/route/api/auth/refresh/route.js +0 -18
- package/dist/esm/route/api/auth/route.d.ts +0 -4
- package/dist/esm/route/api/auth/route.js +0 -8
- package/dist/esm/route/api/files/[fileId]/route.d.ts +0 -8
- package/dist/esm/route/api/files/[fileId]/route.js +0 -16
- package/dist/esm/route/api/files/route.d.ts +0 -6
- package/dist/esm/route/api/files/route.js +0 -30
- package/dist/esm/route/auth/callback/[provider]/route.d.ts +0 -11
- package/dist/esm/route/auth/callback/[provider]/route.js +0 -34
- package/dist/esm/route/index.d.ts +0 -22
- package/dist/esm/route/index.js +0 -76
- package/dist/esm/seo-kit/index.d.ts +0 -3
- package/dist/esm/seo-kit/index.js +0 -3
- package/dist/esm/seo-kit/loader.d.ts +0 -5
- package/dist/esm/seo-kit/loader.js +0 -14
- package/dist/esm/seo-kit/seo.js +0 -275
- package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
- package/dist/esm/seo-kit/seo_loader.js +0 -12
- package/dist/esm/singleton.d.ts +0 -1
- package/dist/esm/singleton.js +0 -9
- package/dist/esm/slug.d.ts +0 -1
- package/dist/esm/slug.js +0 -6
|
@@ -0,0 +1,24 @@
|
|
|
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,5 +1,12 @@
|
|
|
1
|
-
import { AuthService } from
|
|
2
|
-
|
|
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 {
|
|
3
10
|
AUTH: AuthService;
|
|
4
11
|
constructor(AUTH: AuthService);
|
|
5
12
|
signIn(code: string, type?: "web" | "app"): Promise<{
|
|
@@ -13,3 +20,5 @@ export declare class AppleAuth {
|
|
|
13
20
|
}>;
|
|
14
21
|
private generateAppleClientSecret;
|
|
15
22
|
}
|
|
23
|
+
|
|
24
|
+
export { AppleAuth };
|
|
@@ -0,0 +1,75 @@
|
|
|
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/apple_auth.ts
|
|
21
|
+
var apple_auth_exports = {};
|
|
22
|
+
__export(apple_auth_exports, {
|
|
23
|
+
AppleAuth: () => AppleAuth
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(apple_auth_exports);
|
|
26
|
+
var import_jose = require("jose");
|
|
27
|
+
var AppleAuth = class {
|
|
28
|
+
AUTH;
|
|
29
|
+
constructor(AUTH) {
|
|
30
|
+
this.AUTH = AUTH;
|
|
31
|
+
}
|
|
32
|
+
async signIn(code, type = "web") {
|
|
33
|
+
const url = "https://appleid.apple.com/auth/token";
|
|
34
|
+
const client_secret = await this.generateAppleClientSecret(type);
|
|
35
|
+
const res = await fetch(url, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: {
|
|
38
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
39
|
+
},
|
|
40
|
+
body: new URLSearchParams({
|
|
41
|
+
client_id: type === "web" ? process.env.APPLE_SERVICE_ID : process.env.APPLE_CLIENT_ID,
|
|
42
|
+
client_secret,
|
|
43
|
+
code,
|
|
44
|
+
grant_type: "authorization_code"
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
if (!res.ok) {
|
|
48
|
+
console.error(await res.text());
|
|
49
|
+
throw new Error("Apple \uC778\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.");
|
|
50
|
+
}
|
|
51
|
+
const data = await res.json();
|
|
52
|
+
const { id_token } = data;
|
|
53
|
+
const payload = (0, import_jose.decodeJwt)(id_token);
|
|
54
|
+
const { sub, email, name } = payload;
|
|
55
|
+
const user = await this.AUTH.getOrCreateUser("apple", {
|
|
56
|
+
id: sub,
|
|
57
|
+
email,
|
|
58
|
+
name
|
|
59
|
+
});
|
|
60
|
+
const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
|
|
61
|
+
return { user, accessToken, refreshToken };
|
|
62
|
+
}
|
|
63
|
+
async generateAppleClientSecret(type = "web") {
|
|
64
|
+
const authKey = process.env.APPLE_AUTH_KEY;
|
|
65
|
+
const teamId = process.env.APPLE_TEAM_ID;
|
|
66
|
+
const keyId = process.env.APPLE_KEY_ID;
|
|
67
|
+
const clientId = type === "web" ? process.env.APPLE_SERVICE_ID : process.env.APPLE_CLIENT_ID;
|
|
68
|
+
const keyObject = await (0, import_jose.importPKCS8)(authKey, "ES256");
|
|
69
|
+
return new import_jose.SignJWT().setProtectedHeader({ alg: "ES256", kid: keyId }).setIssuedAt().setIssuer(teamId).setExpirationTime("1h").setAudience("https://appleid.apple.com").setSubject(clientId).sign(keyObject);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
AppleAuth
|
|
75
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as jose from 'jose';
|
|
2
|
+
import * as react_router from 'react-router';
|
|
3
|
+
import { JWTManager } from './jwt.mjs';
|
|
4
|
+
import { ObjectStorage } from '../file-kit/object_storage.mjs';
|
|
5
|
+
import { AuthRepository } from './repository.mjs';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
|
|
8
|
+
declare const ACCESS_TOKEN_KEY = "access_token";
|
|
9
|
+
declare const REFRESH_TOKEN_KEY = "refresh_token";
|
|
10
|
+
declare const ACCESS_TOKEN_COOKIE: react_router.Cookie;
|
|
11
|
+
declare const REFRESH_TOKEN_COOKIE: react_router.Cookie;
|
|
12
|
+
declare class AuthService {
|
|
13
|
+
repository: AuthRepository;
|
|
14
|
+
JWT_MANAGER: JWTManager;
|
|
15
|
+
OBJECT_STORAGE: ObjectStorage;
|
|
16
|
+
constructor({ repository, JWT_MANAGER, OBJECT_STORAGE, }: {
|
|
17
|
+
repository: AuthRepository;
|
|
18
|
+
JWT_MANAGER: JWTManager;
|
|
19
|
+
OBJECT_STORAGE: ObjectStorage;
|
|
20
|
+
});
|
|
21
|
+
verify(request: Request): Promise<jose.JWTPayload | undefined>;
|
|
22
|
+
verifyOrRefresh(request: Request): Promise<jose.JWTPayload | undefined>;
|
|
23
|
+
getAccessTokenFromCookies(request: Request): Promise<any>;
|
|
24
|
+
getRefreshTokenFromCookies(request: Request): Promise<any>;
|
|
25
|
+
refresh(request: Request): Promise<jose.JWTPayload | undefined>;
|
|
26
|
+
signIn({ id, password }: {
|
|
27
|
+
id: string;
|
|
28
|
+
password: string;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
accessToken: string;
|
|
31
|
+
refreshToken: string;
|
|
32
|
+
}>;
|
|
33
|
+
issueAccessToken(user: {
|
|
34
|
+
id: string;
|
|
35
|
+
role: string;
|
|
36
|
+
name: string;
|
|
37
|
+
}): Promise<string>;
|
|
38
|
+
issueTokenPair(user: {
|
|
39
|
+
id: string;
|
|
40
|
+
role: string;
|
|
41
|
+
name: string;
|
|
42
|
+
}): Promise<{
|
|
43
|
+
refreshToken: string;
|
|
44
|
+
accessToken: string;
|
|
45
|
+
}>;
|
|
46
|
+
refreshAccessToken(refreshToken: string): Promise<string>;
|
|
47
|
+
getAccessTokenSetCookie(accessToken: string | null): Promise<string>;
|
|
48
|
+
getRefreshTokenSetCookie(refreshToken: string | null): Promise<string>;
|
|
49
|
+
findUser(provider: string, info: {
|
|
50
|
+
id: string;
|
|
51
|
+
email: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
picture?: string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
id: string;
|
|
56
|
+
role: string;
|
|
57
|
+
name: string;
|
|
58
|
+
refreshToken: string | null;
|
|
59
|
+
} | undefined>;
|
|
60
|
+
getOrCreateUser(provider: string, info: {
|
|
61
|
+
id: string;
|
|
62
|
+
email: string;
|
|
63
|
+
name?: string;
|
|
64
|
+
picture?: string;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
id: string;
|
|
67
|
+
role: string;
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
70
|
+
protected savePicture(picture?: string): Promise<string | undefined>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_KEY, AuthService, REFRESH_TOKEN_COOKIE, REFRESH_TOKEN_KEY };
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import * as jose from 'jose';
|
|
2
|
+
import * as react_router from 'react-router';
|
|
3
|
+
import { JWTManager } from './jwt.js';
|
|
4
|
+
import { ObjectStorage } from '../file-kit/object_storage.js';
|
|
5
|
+
import { AuthRepository } from './repository.js';
|
|
6
|
+
import '@aws-sdk/client-s3';
|
|
7
|
+
|
|
8
|
+
declare const ACCESS_TOKEN_KEY = "access_token";
|
|
9
|
+
declare const REFRESH_TOKEN_KEY = "refresh_token";
|
|
10
|
+
declare const ACCESS_TOKEN_COOKIE: react_router.Cookie;
|
|
11
|
+
declare const REFRESH_TOKEN_COOKIE: react_router.Cookie;
|
|
12
|
+
declare class AuthService {
|
|
9
13
|
repository: AuthRepository;
|
|
10
14
|
JWT_MANAGER: JWTManager;
|
|
11
15
|
OBJECT_STORAGE: ObjectStorage;
|
|
@@ -14,11 +18,11 @@ export declare class AuthService {
|
|
|
14
18
|
JWT_MANAGER: JWTManager;
|
|
15
19
|
OBJECT_STORAGE: ObjectStorage;
|
|
16
20
|
});
|
|
17
|
-
verify(request: Request): Promise<
|
|
18
|
-
verifyOrRefresh(request: Request): Promise<
|
|
21
|
+
verify(request: Request): Promise<jose.JWTPayload | undefined>;
|
|
22
|
+
verifyOrRefresh(request: Request): Promise<jose.JWTPayload | undefined>;
|
|
19
23
|
getAccessTokenFromCookies(request: Request): Promise<any>;
|
|
20
24
|
getRefreshTokenFromCookies(request: Request): Promise<any>;
|
|
21
|
-
refresh(request: Request): Promise<
|
|
25
|
+
refresh(request: Request): Promise<jose.JWTPayload | undefined>;
|
|
22
26
|
signIn({ id, password }: {
|
|
23
27
|
id: string;
|
|
24
28
|
password: string;
|
|
@@ -65,3 +69,5 @@ export declare class AuthService {
|
|
|
65
69
|
}>;
|
|
66
70
|
protected savePicture(picture?: string): Promise<string | undefined>;
|
|
67
71
|
}
|
|
72
|
+
|
|
73
|
+
export { ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_KEY, AuthService, REFRESH_TOKEN_COOKIE, REFRESH_TOKEN_KEY };
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/auth-kit/auth_service.ts
|
|
31
|
+
var auth_service_exports = {};
|
|
32
|
+
__export(auth_service_exports, {
|
|
33
|
+
ACCESS_TOKEN_COOKIE: () => ACCESS_TOKEN_COOKIE,
|
|
34
|
+
ACCESS_TOKEN_KEY: () => ACCESS_TOKEN_KEY,
|
|
35
|
+
AuthService: () => AuthService,
|
|
36
|
+
REFRESH_TOKEN_COOKIE: () => REFRESH_TOKEN_COOKIE,
|
|
37
|
+
REFRESH_TOKEN_KEY: () => REFRESH_TOKEN_KEY
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(auth_service_exports);
|
|
40
|
+
var import_bcryptjs = __toESM(require("bcryptjs"));
|
|
41
|
+
var import_uuid = require("uuid");
|
|
42
|
+
var import_react_router = require("react-router");
|
|
43
|
+
var ACCESS_TOKEN_KEY = "access_token";
|
|
44
|
+
var REFRESH_TOKEN_KEY = "refresh_token";
|
|
45
|
+
var ACCESS_TOKEN_COOKIE = (0, import_react_router.createCookie)(ACCESS_TOKEN_KEY, {
|
|
46
|
+
path: "/",
|
|
47
|
+
httpOnly: process.env.NODE_ENV === "production",
|
|
48
|
+
secure: process.env.NODE_ENV === "production",
|
|
49
|
+
sameSite: "strict"
|
|
50
|
+
});
|
|
51
|
+
var REFRESH_TOKEN_COOKIE = (0, import_react_router.createCookie)(REFRESH_TOKEN_KEY, {
|
|
52
|
+
path: "/",
|
|
53
|
+
httpOnly: process.env.NODE_ENV === "production",
|
|
54
|
+
secure: process.env.NODE_ENV === "production",
|
|
55
|
+
sameSite: "strict"
|
|
56
|
+
});
|
|
57
|
+
var AuthService = class {
|
|
58
|
+
repository;
|
|
59
|
+
JWT_MANAGER;
|
|
60
|
+
OBJECT_STORAGE;
|
|
61
|
+
constructor({
|
|
62
|
+
repository,
|
|
63
|
+
JWT_MANAGER,
|
|
64
|
+
OBJECT_STORAGE
|
|
65
|
+
}) {
|
|
66
|
+
this.repository = repository;
|
|
67
|
+
this.JWT_MANAGER = JWT_MANAGER;
|
|
68
|
+
this.OBJECT_STORAGE = OBJECT_STORAGE;
|
|
69
|
+
}
|
|
70
|
+
async verify(request) {
|
|
71
|
+
const accessToken = request?.headers.get("Authorization")?.replace("Bearer ", "") || await this.getAccessTokenFromCookies(request);
|
|
72
|
+
if (accessToken) {
|
|
73
|
+
return this.JWT_MANAGER.verifyAccessToken(accessToken);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async verifyOrRefresh(request) {
|
|
77
|
+
const payload = await this.verify(request);
|
|
78
|
+
if (payload) {
|
|
79
|
+
return payload;
|
|
80
|
+
}
|
|
81
|
+
return this.refresh(request);
|
|
82
|
+
}
|
|
83
|
+
async getAccessTokenFromCookies(request) {
|
|
84
|
+
const cookieStore = await ACCESS_TOKEN_COOKIE.parse(
|
|
85
|
+
request.headers.get("cookie")
|
|
86
|
+
);
|
|
87
|
+
return cookieStore.get(ACCESS_TOKEN_KEY)?.value;
|
|
88
|
+
}
|
|
89
|
+
async getRefreshTokenFromCookies(request) {
|
|
90
|
+
const cookieStore = await REFRESH_TOKEN_COOKIE.parse(
|
|
91
|
+
request.headers.get("cookie")
|
|
92
|
+
);
|
|
93
|
+
return cookieStore.get(REFRESH_TOKEN_KEY)?.value;
|
|
94
|
+
}
|
|
95
|
+
async refresh(request) {
|
|
96
|
+
const refreshToken = await this.getRefreshTokenFromCookies(request);
|
|
97
|
+
if (refreshToken) {
|
|
98
|
+
try {
|
|
99
|
+
const refreshedAccessToken = await this.refreshAccessToken(
|
|
100
|
+
refreshToken
|
|
101
|
+
);
|
|
102
|
+
await this.getAccessTokenSetCookie(refreshedAccessToken);
|
|
103
|
+
const payload = this.JWT_MANAGER.decode(refreshedAccessToken);
|
|
104
|
+
if (payload) {
|
|
105
|
+
return payload;
|
|
106
|
+
}
|
|
107
|
+
} catch (e) {
|
|
108
|
+
if (e instanceof Error) {
|
|
109
|
+
console.log(e.message);
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async signIn({ id, password }) {
|
|
116
|
+
const credential = await this.repository.findCredentialById(id);
|
|
117
|
+
if (!credential) {
|
|
118
|
+
throw Error("\uC544\uC774\uB514 \uB610\uB294 \uBE44\uBC00\uBC88\uD638\uAC00 \uD2C0\uB838\uC2B5\uB2C8\uB2E4.");
|
|
119
|
+
}
|
|
120
|
+
if (!await import_bcryptjs.default.compare(password, credential.password)) {
|
|
121
|
+
throw Error("\uC544\uC774\uB514 \uB610\uB294 \uBE44\uBC00\uBC88\uD638\uAC00 \uD2C0\uB838\uC2B5\uB2C8\uB2E4.");
|
|
122
|
+
}
|
|
123
|
+
const user = await this.repository.findUserById(credential.userId);
|
|
124
|
+
if (!user) {
|
|
125
|
+
throw Error("\uD68C\uC6D0 \uC815\uBCF4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
126
|
+
}
|
|
127
|
+
const { accessToken, refreshToken } = await this.issueTokenPair(user);
|
|
128
|
+
return {
|
|
129
|
+
accessToken,
|
|
130
|
+
refreshToken
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
async issueAccessToken(user) {
|
|
134
|
+
return this.JWT_MANAGER.signAccessToken({
|
|
135
|
+
userId: user.id,
|
|
136
|
+
role: user.role,
|
|
137
|
+
name: user.name
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async issueTokenPair(user) {
|
|
141
|
+
const refreshToken = await this.JWT_MANAGER.signRefreshToken({
|
|
142
|
+
userId: user.id,
|
|
143
|
+
role: user.role,
|
|
144
|
+
name: user.name
|
|
145
|
+
});
|
|
146
|
+
await this.repository.updateUserRefreshToken(
|
|
147
|
+
user.id,
|
|
148
|
+
await import_bcryptjs.default.hash(refreshToken, 10)
|
|
149
|
+
);
|
|
150
|
+
const accessToken = await this.issueAccessToken(user);
|
|
151
|
+
return { refreshToken, accessToken };
|
|
152
|
+
}
|
|
153
|
+
async refreshAccessToken(refreshToken) {
|
|
154
|
+
const payload = await this.JWT_MANAGER.verifyRefreshToken(refreshToken);
|
|
155
|
+
if (!payload) {
|
|
156
|
+
throw new Error("\uD1A0\uD070\uC774 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
157
|
+
}
|
|
158
|
+
const { userId } = payload;
|
|
159
|
+
if (typeof userId !== "string") {
|
|
160
|
+
throw new Error("\uD1A0\uD070\uC774 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
161
|
+
}
|
|
162
|
+
const user = await this.repository.findUserById(userId);
|
|
163
|
+
if (!user) {
|
|
164
|
+
throw Error("\uC774\uC6A9\uC790\uB97C \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.");
|
|
165
|
+
}
|
|
166
|
+
if (!user.refreshToken) {
|
|
167
|
+
throw Error("\uC778\uC99D \uC815\uBCF4\uB97C \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.");
|
|
168
|
+
}
|
|
169
|
+
if (await import_bcryptjs.default.compare(user.refreshToken, refreshToken)) {
|
|
170
|
+
throw Error("\uD1A0\uD070\uC774 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
|
|
171
|
+
}
|
|
172
|
+
const accessToken = await this.issueAccessToken(user);
|
|
173
|
+
return accessToken;
|
|
174
|
+
}
|
|
175
|
+
async getAccessTokenSetCookie(accessToken) {
|
|
176
|
+
return ACCESS_TOKEN_COOKIE.serialize(accessToken, {
|
|
177
|
+
expires: accessToken ? this.JWT_MANAGER.getExpirationTime(accessToken) : /* @__PURE__ */ new Date(0)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
async getRefreshTokenSetCookie(refreshToken) {
|
|
181
|
+
return REFRESH_TOKEN_COOKIE.serialize(refreshToken, {
|
|
182
|
+
expires: refreshToken ? this.JWT_MANAGER.getExpirationTime(refreshToken) : /* @__PURE__ */ new Date(0)
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async findUser(provider, info) {
|
|
186
|
+
const thirdPartyAuth = await this.repository.findThirdPartyAuth(
|
|
187
|
+
provider,
|
|
188
|
+
info.id
|
|
189
|
+
);
|
|
190
|
+
if (thirdPartyAuth) {
|
|
191
|
+
const user = await this.repository.findUserById(thirdPartyAuth.userId);
|
|
192
|
+
if (user) {
|
|
193
|
+
return user;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
async getOrCreateUser(provider, info) {
|
|
198
|
+
const thirdPartyAuth = await this.repository.findThirdPartyAuth(
|
|
199
|
+
provider,
|
|
200
|
+
info.id
|
|
201
|
+
);
|
|
202
|
+
if (thirdPartyAuth) {
|
|
203
|
+
const user = await this.repository.findUserById(thirdPartyAuth.userId);
|
|
204
|
+
if (user) {
|
|
205
|
+
return user;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const userId = (0, import_uuid.v4)();
|
|
209
|
+
const email = info.email;
|
|
210
|
+
const name = info.name || "\uC775\uBA85";
|
|
211
|
+
const picture = info.picture;
|
|
212
|
+
const profileImageId = await this.savePicture(picture) || null;
|
|
213
|
+
const result = await this.repository.createUser({
|
|
214
|
+
id: userId,
|
|
215
|
+
role: "user",
|
|
216
|
+
profileImageId,
|
|
217
|
+
name,
|
|
218
|
+
email
|
|
219
|
+
});
|
|
220
|
+
await this.repository.createThirdPartyAuth({
|
|
221
|
+
id: info.id,
|
|
222
|
+
provider,
|
|
223
|
+
userId
|
|
224
|
+
});
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
async savePicture(picture) {
|
|
228
|
+
if (!picture) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const res = await fetch(picture);
|
|
232
|
+
if (!res.ok) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const buffer = await res.arrayBuffer();
|
|
236
|
+
const id = (0, import_uuid.v4)();
|
|
237
|
+
const key = `/users/${id}/picture`;
|
|
238
|
+
await this.OBJECT_STORAGE.put(key, Buffer.from(buffer));
|
|
239
|
+
await this.repository.createFile({
|
|
240
|
+
id,
|
|
241
|
+
name: "picture",
|
|
242
|
+
type: "image/*",
|
|
243
|
+
key,
|
|
244
|
+
size: buffer.byteLength,
|
|
245
|
+
metadata: {}
|
|
246
|
+
});
|
|
247
|
+
return id;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
251
|
+
0 && (module.exports = {
|
|
252
|
+
ACCESS_TOKEN_COOKIE,
|
|
253
|
+
ACCESS_TOKEN_KEY,
|
|
254
|
+
AuthService,
|
|
255
|
+
REFRESH_TOKEN_COOKIE,
|
|
256
|
+
REFRESH_TOKEN_KEY
|
|
257
|
+
});
|