mirror of
https://github.com/djhackersdev/minime.git
synced 2026-09-08 10:35:36 -05:00
aimedb: Enhance typing
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { Socket } from "net";
|
||||
|
||||
import { dispatch } from "./handler";
|
||||
import { AimeRequest } from "./request";
|
||||
import { setup } from "./pipeline";
|
||||
|
||||
export default async function aimedb(socket) {
|
||||
export default async function aimedb(socket: Socket) {
|
||||
console.log("Aimedb: Connection opened");
|
||||
|
||||
const { input, output } = setup(socket);
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
import * as crypto from "crypto";
|
||||
import { Socket } from "net";
|
||||
import { pipeline } from "stream";
|
||||
|
||||
import { Decoder } from "./decoder";
|
||||
import { Deframer } from "./frame";
|
||||
import { Encoder } from "./encoder";
|
||||
import { AimeRequest } from "./request";
|
||||
import { AimeResponse } from "./response";
|
||||
|
||||
const K = Buffer.from("Copyright(C)SEGA", "utf8");
|
||||
|
||||
export function setup(socket) {
|
||||
export interface Session {
|
||||
input: AsyncIterable<AimeRequest>;
|
||||
output: {
|
||||
write(res: AimeResponse): void;
|
||||
};
|
||||
}
|
||||
|
||||
export function setup(socket: Socket): Session {
|
||||
const input = pipeline(
|
||||
socket,
|
||||
crypto.createDecipheriv("aes-128-ecb", K, null).setAutoPadding(false),
|
||||
|
||||
Reference in New Issue
Block a user