This commit is contained in:
Manav Rathi 2024-05-04 08:55:54 +05:30
parent 54bb32d5e7
commit 8a4f5e2934
No known key found for this signature in database

View file

@ -159,6 +159,8 @@ export const advertiseCode = (
* given pairing code. If so, decrypt it using our private key and return the * given pairing code. If so, decrypt it using our private key and return the
* JSON payload. Phase 3 of the pairing protocol. * JSON payload. Phase 3 of the pairing protocol.
* *
* Returns `undefined` if there hasn't been any data obtained yet.
*
* See: [Note: Pairing protocol]. * See: [Note: Pairing protocol].
*/ */
export const getCastData = async (registration: Registration) => { 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 // The client will send us the encrypted payload using our public key that
// we registered with museum. // we registered with museum.
const encryptedCastData = await castGateway.getCastData(pairingCode); const encryptedCastData = await castGateway.getCastData(pairingCode);
if (!encryptedCastData) return;
// Decrypt it using the private key of the pair and return the plaintext // 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 // payload, which'll be a JSON object containing the data we need to start a