From 8a4f5e29343eed4f7e88d7d6b53c78e4b864f9f1 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 4 May 2024 08:55:54 +0530 Subject: [PATCH] Fix --- web/apps/cast/src/services/cast.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/apps/cast/src/services/cast.ts b/web/apps/cast/src/services/cast.ts index db41e707e..32e24a934 100644 --- a/web/apps/cast/src/services/cast.ts +++ b/web/apps/cast/src/services/cast.ts @@ -159,6 +159,8 @@ export const advertiseCode = ( * given pairing code. If so, decrypt it using our private key and return the * JSON payload. Phase 3 of the pairing protocol. * + * Returns `undefined` if there hasn't been any data obtained yet. + * * See: [Note: Pairing protocol]. */ export const getCastData = async (registration: Registration) => { @@ -167,6 +169,7 @@ export const getCastData = async (registration: Registration) => { // The client will send us the encrypted payload using our public key that // we registered with museum. const encryptedCastData = await castGateway.getCastData(pairingCode); + if (!encryptedCastData) return; // Decrypt it using the private key of the pair and return the plaintext // payload, which'll be a JSON object containing the data we need to start a