This commit is contained in:
2023-09-22 20:51:08 +09:00
parent b8d57a014a
commit 295d39327b
5 changed files with 78 additions and 5 deletions
+1
View File
@@ -5,6 +5,7 @@
"main": "dist/index.js",
"exports": {
".": "./dist/index.js",
"./gateway": "./dist/gateway.js",
"./def": "./dist/def/index.js"
},
"scripts": {
+72
View File
@@ -0,0 +1,72 @@
import { GET, POST, type DefAPINamespace } from "@strpc/def";
//굳이 할 필요는 없지만, d.ts가 깔끔해짐
import type {
InvalidResponse, ValidResponse
} from "@strpc/def";
import type {
ArgDeleteAPI,
ArgGetAPI,
ArgHeadAPI,
ArgPatchAPI,
ArgPostAPI,
ArgPutAPI,
EmptyDeleteAPI,
EmptyGetAPI,
EmptyHeadAPI,
EmptyPatchAPI,
EmptyPostAPI,
EmptyPutAPI,
} from "@strpc/def/types";
export type LoginResponse = {
result: true,
nextToken: [number, string] | undefined,
}
export type LoginFailed = {
result: false,
reqOTP: boolean,
reason: string,
}
export type AutoLoginNonceResponse = {
result: true,
loginNonce: string,
};
export type AutoLoginResponse = {
result: true,
nextToken: [number, string] | undefined,
}
export type AutoLoginFailed = {
result: false,
silent: boolean,
reason: string,
}
/** @internal */
export const structure = {
Login: {
LoginByID: POST<{
id: string,
password: string,
}, LoginResponse, LoginFailed>(),
LoginByToken: POST<{
hashedToken: string,
token_id: number,
}, AutoLoginResponse, AutoLoginFailed>(),
ReqNonce: GET<AutoLoginNonceResponse, AutoLoginFailed>(),
test: GET<{result: true, hello:'world'}>(),
},
GetGameLoginToken: GET<{
result: true,
gameLoginToken: string,
userID: number,
}>(),
} satisfies DefAPINamespace;
-4
View File
@@ -22,10 +22,6 @@ import type {
} from "@strpc/def/types";
import { GET, POST } from '@strpc/def';
import type { Base64String, WrappedBuffer } from "@sammo/util";
import type { ECDSASignatureBSON, ECDSASignatureJSON, ECDSASignatureRaw, ECDSA_P384_VerifyKey, ECDSA_PKCS8_P384_SignKey } from "@sammo/crypto/RawTypes";
import type { PEMString } from "@sammo/crypto";
export type {
InferResponse,
InferError,
+2 -1
View File
@@ -38,7 +38,8 @@
"tslib": "^2.6.1",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"zod": "^3.22.1"
"zod": "^3.22.1",
"@sammo/api_def": "workspace:^"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.2",
+3
View File
@@ -14,6 +14,9 @@ importers:
'@popperjs/core':
specifier: ^2.11.8
version: 2.11.8
'@sammo/api_def':
specifier: workspace:^
version: link:@sammo/api_def
async-lock:
specifier: ^1.4.0
version: 1.4.0