Skip to content

Commit bf5a70a

Browse files
committed
fix: verify identity ownership for the app identity
1 parent 2d1fb78 commit bf5a70a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

apps/server/src/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,20 @@ app.post('/connect/app-identity', async (req, res) => {
318318
res.status(401).send('Unauthorized');
319319
return;
320320
}
321+
if (
322+
!Identity.verifyIdentityOwnership(
323+
accountAddress,
324+
message.signaturePublicKey,
325+
message.accountProof,
326+
message.keyProof,
327+
CHAIN,
328+
RPC_URL,
329+
)
330+
) {
331+
console.log('Ownership proof is invalid');
332+
res.status(401).send('Unauthorized');
333+
return;
334+
}
321335
const sessionToken = bytesToHex(randomBytes(32));
322336
const sessionTokenExpires = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30); // 30 days
323337
const appIdentity = await createAppIdentity({

0 commit comments

Comments
 (0)