Skip to content

Commit

Permalink
💡 (core): Add comments in DefaultApduReceiverService
Browse files Browse the repository at this point in the history
  • Loading branch information
aussedatlo committed Mar 28, 2024
1 parent 140b71a commit 31d7aca
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ export class DefaultApduReceiverService implements ApduReceiverService {
});
}

/*
* Parse an Uint8Array to a Frame
* Return an error if the frame is not formatted correctly
*
* @param Uint8Array
*/
private apduToFrame(apdu: Uint8Array): Either<ReceiverApduError, Frame> {
const channelSize = this._channel.caseOf({
Just: () => CHANNEL_LENGTH,
Expand Down Expand Up @@ -149,6 +155,11 @@ export class DefaultApduReceiverService implements ApduReceiverService {
return Right(frame);
}

/*
* Return true if all the datas has been received
*
* @param number
*/
private isComplete(dataSize: number): boolean {
const totalReceiveLength = this._pendingFrames.reduce(
(prev: number, curr: Frame) => prev + curr.getData().length,
Expand Down

0 comments on commit 31d7aca

Please sign in to comment.