Skip to content

Commit

Permalink
solve for parity
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Dec 9, 2024
1 parent 13af9b9 commit 4c7f689
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
type Hex,
parseCompactSignature,
serializeCompactSignature,
keccak256,
encodeAbiParameters,
encodePacked,
concat,
getAddress,
serializeSignature,
signatureToCompactSignature,
} from 'viem';
import { privateKeyToAccount, signMessage, sign } from 'viem/accounts';
import { type StoredCompactMessage } from './compact';
Expand Down Expand Up @@ -151,12 +150,9 @@ export async function signDigest(hash: Hex): Promise<Hex> {
privateKey,
});

// Convert signature object to hex string
const signatureHex = serializeSignature(signature);

// Convert to EIP2098 compact signature format
const parsedCompactSig = parseCompactSignature(signatureHex);
return serializeCompactSignature(parsedCompactSig);
const compactSig = signatureToCompactSignature(signature);
return serializeCompactSignature(compactSig);
}

export type CompactSignature = {
Expand Down

0 comments on commit 4c7f689

Please sign in to comment.