chore: Token.ts 單獨成類
This commit is contained in:
6
server/api/Token.ts
Normal file
6
server/api/Token.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export default interface Token {
|
||||||
|
author: string
|
||||||
|
auth: string
|
||||||
|
made_time: number
|
||||||
|
expired_time: number
|
||||||
|
}
|
||||||
@@ -1,14 +1,8 @@
|
|||||||
import { Buffer } from "node:buffer";
|
import { Buffer } from "node:buffer"
|
||||||
import config from "../config.ts"
|
import config from "../config.ts"
|
||||||
import User from "../data/User.ts"
|
import User from "../data/User.ts"
|
||||||
import crypto from 'node:crypto'
|
import crypto from 'node:crypto'
|
||||||
|
import Token from "./Token.ts"
|
||||||
interface Token {
|
|
||||||
author: string
|
|
||||||
auth: string
|
|
||||||
made_time: number
|
|
||||||
expired_time: number
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeKey(key: string, keyLength = 32) {
|
function normalizeKey(key: string, keyLength = 32) {
|
||||||
const hash = crypto.createHash('sha256')
|
const hash = crypto.createHash('sha256')
|
||||||
|
|||||||
Reference in New Issue
Block a user