Skip to content

Improve secp key handling and deployment reliability#13

Open
robertkodra wants to merge 1 commit intokeep-starknet-strange:feat/ethereum-signerfrom
robertkodra:feat/ethereum-signer
Open

Improve secp key handling and deployment reliability#13
robertkodra wants to merge 1 commit intokeep-starknet-strange:feat/ethereum-signerfrom
robertkodra:feat/ethereum-signer

Conversation

@robertkodra
Copy link

@robertkodra robertkodra commented Feb 6, 2026

  • Hardens signer input/output in ethereum.ts (strict 32-byte keys, hash padding, normalized hex signatures).
  • Fixes OZ Eth preset key parsing/calldata encoding in presets.ts (proper {x,y} handling).
  • Fixes deploy salt usage in index.ts to use accountProvider.getSalt(publicKey) for consistent address/deploy behavior.

const uncompressed = secp256k1.getPublicKey(this.privateKey, false);
const x = "0x" + bytesToHex(uncompressed.slice(1, 33));
const y = "0x" + bytesToHex(uncompressed.slice(33, 65));
this.publicKey = JSON.stringify({ x, y });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems weird to me to store the public key as a json string

let result = 0n;
for (const byte of bytes) {
result = (result << 8n) | BigInt(byte);
function normalizeHashHex(hash: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead use this starknet.js function?

"vitest": "^4.0.17"
},
"dependencies": {
"@noble/curves": "^1.9.7",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xLucqs Just to make sure can you check if this needs to be polyfilled for mobile integration?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants