Skip to content

Commit

Permalink
fix: make sign method send all chunks (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: Emmanuel <[email protected]>
  • Loading branch information
chcmedeiros and emmanuelm41 authored Sep 27, 2024
1 parent 52e1ce2 commit 46bf168
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ export default class IronfishApp extends GenericApp {
async sign(path: string, blob: Buffer): Promise<ResponseSign> {
try {
const chunks = this.prepareChunks(path, blob)
let result = await this.signSendChunk(this.INS.SIGN, 1, chunks.length, chunks[0])

let result: any
for (let i = 0; i < chunks.length; i += 1) {
result = await this.sendGenericChunk(this.INS.SIGN, P2_VALUES.DEFAULT, 1, chunks.length, chunks[0])
for (let i = 1; i < chunks.length; i += 1) {
result = await this.signSendChunk(this.INS.SIGN, 1 + i, chunks.length, chunks[i])
}

return {
signature: result.readBytes(result.length()),
}
Expand Down

0 comments on commit 46bf168

Please sign in to comment.