import { Payload } from "../../transport" ; import { BleCmd } from "../ble" ; export const CtapBleCborCmd = 0x83 ; export class CtapBleCborReq implements BleCmd { cmd ! : number ; data ! : Buffer ; initialize ( cmd , data ) { this . cmd = cmd ; this . data = data ; return this ; } serialize ( ) { let result = Buffer . alloc ( this . data . length + 1 ) ; let offset = 0 ; offset = result . writeUInt8 ( this . cmd , offset ) ; offset += this . data . copy ( result , offset ) ; return { cmd : CtapBleCborCmd , data : result } ; } deserialize ( payload ) { throw new Error ( "Method not implemented." ) ; } } export class CtapBleCborRes implements BleCmd { code ! : number ; data ! : Buffer ; initialize ( ... args ) { throw new Error ( "Method not implemented." ) ; } serialize ( ) { throw new Error ( "Method not implemented." ) ; } deserialize ( payload ) { this . code = payload . readUInt8 ( 0 ) ; this . data = payload . slice ( 1 ) ; return this ; } }