Skip to content

Commit 97e17b9

Browse files
authored
Remove signed_message from returned value (#8)
1 parent 4605aa0 commit 97e17b9

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ We recommend using the npmjs package in order to receive updates/fixes.
2525
| Operation | Response | Command | Notes |
2626
| --------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
2727
| signTransaction | { signature: string } | txType + senderAccount + senderAddress + receiverAddress + amount + fee + nonce + validUntil + memo + networkId | Signs a Mina transaction |
28-
| signMessage | { field: string, scalar: string, raw_signature: string, signed_message: string } | account + networkId + message | Signs a message using the specified account |
28+
| signMessage | { field: string, scalar: string, raw_signature: string } | account + networkId + message | Signs a message using the specified account |
2929

3030
### Transaction Types
3131

src/app.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ interface SignMessageResponse extends BaseLedgerResponse {
6363
field: string | null;
6464
scalar: string | null;
6565
raw_signature?: string | null;
66-
signed_message?: string | null;
6766
}
6867

6968
export class MinaApp extends BaseApp {
@@ -306,7 +305,6 @@ export class MinaApp extends BaseApp {
306305
field: null,
307306
scalar: null,
308307
raw_signature: null,
309-
signed_message: null,
310308
returnCode: "-6",
311309
message: "Message is empty",
312310
};
@@ -316,7 +314,6 @@ export class MinaApp extends BaseApp {
316314
field: null,
317315
scalar: null,
318316
raw_signature: null,
319-
signed_message: null,
320317
returnCode: "-7",
321318
message: "Message too long",
322319
};
@@ -350,37 +347,15 @@ export class MinaApp extends BaseApp {
350347

351348
const response = processResponse(responseBuffer);
352349

353-
// Validate minimum buffer length (64 bytes for signature + 1 byte for message length)
354-
if (response.length() < 65) {
355-
throw new Error("Response buffer too short");
356-
}
357-
358-
// First read the signature (64 bytes)
359350
const signature = response.readBytes(64).toString("hex");
360351
const sigLength = signature.length;
361352
const field_extracted = signature.substring(0, sigLength / 2);
362353
const scalar_extracted = signature.substring(sigLength / 2, sigLength);
363354

364-
// Then read the message length (1 byte)
365-
const messageLength = response.readBytes(1).readUInt8();
366-
367-
// Validate remaining buffer length against message length
368-
if (response.length() < messageLength) {
369-
throw new Error(
370-
`Response buffer too short for message: expected ${messageLength} bytes but only ${response.length()} remaining`,
371-
);
372-
}
373-
374-
// Finally read the message
375-
const returnedMessage = response
376-
.readBytes(messageLength)
377-
.toString("utf8");
378-
379355
return {
380356
field: BigInt("0x" + field_extracted).toString(),
381357
scalar: BigInt("0x" + scalar_extracted).toString(),
382358
raw_signature: signature,
383-
signed_message: returnedMessage,
384359
returnCode: "9000",
385360
};
386361
} catch (e) {
@@ -389,7 +364,6 @@ export class MinaApp extends BaseApp {
389364
field: null,
390365
scalar: null,
391366
raw_signature: null,
392-
signed_message: null,
393367
returnCode: respError.returnCode.toString(),
394368
message: respError.errorMessage,
395369
};

0 commit comments

Comments
 (0)