Skip to content

Commit 69f9010

Browse files
committed
chore: allow passing the request msg to recover signer
1 parent 3eb3539 commit 69f9010

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/hypergraph/src/messages/signed-update-message.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ export const signedUpdateMessage = ({
6363
};
6464
};
6565

66-
export const recoverUpdateMessageSigner = ({ update, spaceId, ephemeralId, signature, accountId }: RecoverParams) => {
66+
export const recoverUpdateMessageSigner = ({
67+
update,
68+
spaceId,
69+
ephemeralId,
70+
signature,
71+
accountId,
72+
}: RecoverParams | RequestCreateUpdate) => {
6773
const recoveredSignature = secp256k1.Signature.fromCompact(signature.hex).addRecoveryBit(signature.recovery);
6874
const signedMessage = stringToUint8Array(
6975
canonicalize({

packages/hypergraph/test/messages/signed-update-message.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ describe('sign updates and recover key', () => {
2727

2828
// The signer should be recoverable without needing anything
2929
// outside of what's included in the message
30-
const recoveredSigner = recoverUpdateMessageSigner({
31-
update: msg.update,
32-
spaceId: msg.spaceId,
33-
ephemeralId: msg.ephemeralId,
34-
signature: msg.signature,
35-
accountId: msg.accountId,
36-
});
30+
const recoveredSigner = recoverUpdateMessageSigner(msg);
3731

3832
expect(recoveredSigner).to.eq(signaturePublicKey);
3933
});

0 commit comments

Comments
 (0)