Take a username at pairing

This commit is contained in:
NicolasCantu 2025-03-03 23:22:28 +01:00
parent 7ad8063e87
commit 1747908d20

View File

@ -169,10 +169,25 @@ export async function prepareAndSendPairingTx(secondDeviceAddress: string) {
} catch (e) {
throw e;
}
// Create the process
// Prompt the user for a username.
const userName = prompt("Please enter your user name:");
if (!userName) {
throw new Error("User name is required for the pairing process.");
}
// Create the process after a delay.
setTimeout(async () => {
const relayAddress = service.getAllRelays();
const createPairingProcessReturn = await service.createPairingProcess([secondDeviceAddress], relayAddress[0].spAddress, 1);
const relayAddress = service.getAllRelays();
// Pass the userName as an additional parameter.
const createPairingProcessReturn = await service.createPairingProcess(
userName,
[secondDeviceAddress],
relayAddress[0].spAddress,
1,
userName
);
if (!createPairingProcessReturn.updated_process) {
throw new Error('createPairingProcess returned an empty new process'); // This should never happen