diff --git a/packages/core/src/api/command/Command.ts b/packages/core/src/api/command/Command.ts new file mode 100644 index 000000000..2d1e47f4e --- /dev/null +++ b/packages/core/src/api/command/Command.ts @@ -0,0 +1,6 @@ +import { Apdu } from "@api/apdu/model/Apdu"; + +export interface Command { + getApdu(params?: Params): Apdu; + parseResponse(responseApdu: Apdu): T; +} diff --git a/packages/core/src/internal/device-session/model/Session.ts b/packages/core/src/internal/device-session/model/Session.ts index 53868f6dc..20f93ee39 100644 --- a/packages/core/src/internal/device-session/model/Session.ts +++ b/packages/core/src/internal/device-session/model/Session.ts @@ -1,5 +1,6 @@ import { v4 as uuidv4 } from "uuid"; +import { Command } from "@api/command/Command"; import { InternalConnectedDevice } from "@internal/usb/model/InternalConnectedDevice"; export type SessionId = string; @@ -32,4 +33,15 @@ export class Session { sendApdu(_args: Uint8Array) { return this._connectedDevice.sendApdu(_args); } + + executeCommand( + _params: Params, + _command: Command, + ): Promise { + // const apdu = command.getApdu(params); + // do some magic with apdu + // const response = command.parseResponse(); + // return response; + throw new Error("Method not implemented."); + } }