diff --git a/src/aimedb/index.ts b/src/aimedb/index.ts index 1e8f531..c22e689 100644 --- a/src/aimedb/index.ts +++ b/src/aimedb/index.ts @@ -28,7 +28,11 @@ export default async function aimedb(socket) { case "lookup": case "lookup2": console.log("Aimedb: Mifare lookup", req.luid); - output.write({ type: req.type, status: 1 }); // Add aimeId if desired + output.write({ + type: req.type, + status: 1, + aimeId: 0x55667788, + }); break; diff --git a/src/idz/decoder.ts b/src/idz/decoder.ts index 3a1d97e..9dc1649 100644 --- a/src/idz/decoder.ts +++ b/src/idz/decoder.ts @@ -22,6 +22,14 @@ readers.set(MSG.ACCOUNT_LOCK_REQ, buf => { }; }); +readers.set(MSG.ACCOUNT_UNLOCK_REQ, buf => { + return { + type: "account_unlock_req", + aimeId: buf.readUInt32LE(0x0004), + pcbId: buf.slice(0x0008, buf.indexOf("\0", 0x0008)).toString("ascii"), + }; +}); + readers.set(MSG.CREATE_RECORD_REQ, buf => { return { type: "create_record_req", diff --git a/src/idz/defs.ts b/src/idz/defs.ts index 555cb34..12ada30 100644 --- a/src/idz/defs.ts +++ b/src/idz/defs.ts @@ -8,6 +8,8 @@ export const MSG = { UPDATE_RECORD_REQ: 0x0068, ACCOUNT_LOCK_REQ: 0x0069, ACCOUNT_LOCK_RES: 0x006a, + ACCOUNT_UNLOCK_REQ: 0x006f, + ACCOUNT_UNLOCK_RES: 0x0070, CREATE_TEAM_REQ: 0x007b, CREATE_TEAM_RES: 0x007c, UPDATE_STORY_CLEAR_REQ: 0x007f, @@ -20,6 +22,7 @@ export const MSG = { export const REQ_LEN = new Map(); REQ_LEN.set(MSG.ACCOUNT_LOCK_REQ, 0x0020); +REQ_LEN.set(MSG.ACCOUNT_UNLOCK_REQ, 0x0020); REQ_LEN.set(MSG.CREATE_RECORD_REQ, 0x00c0); REQ_LEN.set(MSG.CREATE_TEAM_REQ, 0x0010); REQ_LEN.set(MSG.GET_CONFIG_REQ, 0x0050); diff --git a/src/idz/encoder.ts b/src/idz/encoder.ts index 33a19df..277fb3a 100644 --- a/src/idz/encoder.ts +++ b/src/idz/encoder.ts @@ -29,6 +29,13 @@ export class Encoder extends Transform { break; + case "account_unlock_res": + buf = Buffer.alloc(0x0010); + buf.writeUInt16LE(MSG.ACCOUNT_UNLOCK_RES, 0x0000); + buf.writeUInt8(obj.status, 0x0004); + + break; + case "create_team_res": buf = Buffer.alloc(0x0ca0); buf.writeUInt16LE(MSG.CREATE_TEAM_RES, 0x0000); @@ -39,7 +46,7 @@ export class Encoder extends Transform { case "generic_res": buf = Buffer.alloc(0x0020); buf.writeUInt16LE(MSG.GENERIC_RES, 0x0000); - buf.writeUInt32LE(obj.field_0004, 0x0004); + buf.writeUInt32LE(obj.status, 0x0004); break; diff --git a/src/idz/index.ts b/src/idz/index.ts index 9411d78..fe9a21c 100644 --- a/src/idz/index.ts +++ b/src/idz/index.ts @@ -22,10 +22,18 @@ export default async function idz(socket: Socket) { break; + case "account_unlock_req": + output.write({ + type: "account_unlock_res", + status: 1, + }); + + break; + case "create_record_req": output.write({ type: "generic_res", - field_0004: 1, + status: 1, }); break; @@ -115,7 +123,7 @@ export default async function idz(socket: Socket) { case "update_record_req": output.write({ type: "generic_res", - field_0004: 1, + status: 1, }); break; diff --git a/src/idz/request.ts b/src/idz/request.ts index c1d15aa..54b309d 100644 --- a/src/idz/request.ts +++ b/src/idz/request.ts @@ -5,6 +5,12 @@ export interface AccountLockRequest { field_0018: number; } +export interface AccountUnlockRequest { + type: "account_unlock_req"; + aimeId: number; + pcbId: string; +} + export interface CreateRecordRequest { type: "create_record_req"; aimeId: number; @@ -62,6 +68,7 @@ export interface UpdateRecordRequest { export type Request = | AccountLockRequest + | AccountUnlockRequest | CreateRecordRequest | CreateTeamRequest | GetConfigRequest diff --git a/src/idz/response.ts b/src/idz/response.ts index 1105a05..cd3c759 100644 --- a/src/idz/response.ts +++ b/src/idz/response.ts @@ -5,9 +5,14 @@ export interface AccountLockResponse { field_001C: Date; } +export interface AccountUnlockResponse { + type: "account_unlock_res"; + status: number; +} + export interface GenericResponse { type: "generic_res"; - field_0004: number; + status: number; } export interface CreateTeamResponse { @@ -79,6 +84,7 @@ export interface UpdateProvisionalStoreRankResponse { export type Response = | AccountLockResponse + | AccountUnlockResponse | CreateTeamResponse | GenericResponse | GetConfigResponse