Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
generateName() {
const name = uniqueNamesGenerator({
length: 2,
separator: ' ',
});
// const camelized = this.camelize(name);
// return camelized;
return 'Unknown sender';
}
coinType, // coinType is required
canDelete = true,
index = DEFAULT_ACC_INDEX,
net = DEFAULT_NET,
account = 0,
change = 0,
walletLabel,
publicKey,
isImport = false
}) => {
if (!coinType) {
throw new Error('coinType is required.');
}
const storageWallet = {
walletId: uuid(),
walletLabel: walletLabel || uniqueNamesGenerator(config),
canDelete,
isHardware,
index,
coinType,
account,
change,
net,
isImport,
publicKey // present with hardware wallets
};
return storageWallet;
};
function generateInstanceName () {
const instanceName: string = uniqueNamesGenerator({
dictionaries: [colors,adjectives, animals],
separator: '-'
});
console.log('instance name',instanceName)
return instanceName
}
onConnectionReceived(ws, req) {
if (!req.session.username) {
let username = uniqueNamesGenerator();
console.log("Generated name for new user (on connect):", username);
req.session.username = username;
req.session.save();
}
let client = {
session: req.session,
socket: ws,
};
this.clients.push(client);
ws.on('message', (message) => {
this.onMessageReceived(client, JSON.parse(message));
});
this.sendRoomEvent(new RoomEvent(this.name, ROOM_EVENT_TYPE.JOIN_ROOM, client.session.username, {}));
}
function newJobName(): string {
return uniqueNamesGenerator({
dictionaries: [adjectives, animals],
length: 2,
separator: "-"
})
}
_generateNodeName = () => {
const newNodeName = uniqueNamesGenerator({
length: 2,
separator: '-',
});
while (this._isNameUsed(newNodeName)) {
this._generateNodeName();
}
return newNodeName;
};