|
1 | 1 | import * as jwt from 'jsonwebtoken' |
| 2 | +import crypto from 'crypto' |
2 | 3 |
|
3 | 4 | import { canAccessZone } from '../../../lib/misc' |
4 | 5 |
|
5 | | -const { randomUUID } = require('crypto') |
6 | | - |
7 | 6 | const computeRoomName = (zone) => { |
8 | 7 | check(zone._id, Match.Id) |
9 | 8 |
|
10 | 9 | log('computeRoomName: start', { zoneId: zone._id }) |
11 | 10 |
|
12 | 11 | let { uuid } = zone |
13 | 12 | if (!uuid) { |
14 | | - uuid = randomUUID() |
| 13 | + uuid = crypto.randomUUID() |
15 | 14 | Zones.update(zone._id, { $set: { uuid } }) |
16 | 15 | } |
17 | 16 |
|
@@ -104,15 +103,22 @@ Meteor.methods({ |
104 | 103 |
|
105 | 104 | log('computeMeetLowLevelRoomName: start', { usersIds }) |
106 | 105 |
|
| 106 | + const salt = Meteor.settings.meet.salt |
107 | 107 | const meetRoomName = usersIds |
108 | 108 | .sort((a, b) => a.localeCompare(b)) |
109 | 109 | .join('-') |
110 | 110 | .toLowerCase() |
111 | | - updateUserRoomName(meetRoomName) |
112 | 111 |
|
113 | | - log('computeMeetLowLevelRoomName: end', { meetRoomName }) |
| 112 | + const hmac = crypto.createHmac('sha1', salt) |
| 113 | + hmac.setEncoding('base64') |
| 114 | + hmac.write(meetRoomName) |
| 115 | + hmac.end() |
| 116 | + hashedMeetRoomName = hmac.read().toLowerCase() |
| 117 | + |
| 118 | + updateUserRoomName(hashedMeetRoomName) |
| 119 | + log('computeMeetLowLevelRoomName: end', { meetRoomName: hashedMeetRoomName }) |
114 | 120 |
|
115 | | - return meetRoomName |
| 121 | + return hashedMeetRoomName |
116 | 122 | }, |
117 | 123 | }) |
118 | 124 |
|
|
0 commit comments