Correct wording
This commit is contained in:
parent
45c599794b
commit
7f66c8bd09
1 changed files with 6 additions and 2 deletions
|
|
@ -124,12 +124,14 @@ const authorizeDevice = async ({ deviceId, publicKey }) => {
|
||||||
*/
|
*/
|
||||||
const encryptMessage = async ({ message = '', deviceId }) => {
|
const encryptMessage = async ({ message = '', deviceId }) => {
|
||||||
const parsedMessage = message.toString()
|
const parsedMessage = message.toString()
|
||||||
|
// decryptMessage checks for known devices while this one checks for
|
||||||
|
// authorized ones instead, why?
|
||||||
const publicKey = devicePublicKeys.get(deviceId)
|
const publicKey = devicePublicKeys.get(deviceId)
|
||||||
|
|
||||||
if (!publicKey) {
|
if (!publicKey) {
|
||||||
throw new FieldError({
|
throw new FieldError({
|
||||||
field: 'deviceId',
|
field: 'deviceId',
|
||||||
message: 'Unauthorized Device ID detected'
|
message: 'encryptMessage() -> Unauthorized Device ID detected'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,12 +161,14 @@ const encryptMessage = async ({ message = '', deviceId }) => {
|
||||||
* @param {{ encryptedMessage: import('./crypto').EncryptedMessageResponse, deviceId: string }} arg0
|
* @param {{ encryptedMessage: import('./crypto').EncryptedMessageResponse, deviceId: string }} arg0
|
||||||
*/
|
*/
|
||||||
const decryptMessage = async ({ encryptedMessage, deviceId }) => {
|
const decryptMessage = async ({ encryptedMessage, deviceId }) => {
|
||||||
|
// encryptMessages checks for authorized devices while this one checks for
|
||||||
|
// known ones, why?
|
||||||
const keyPair = nodeKeyPairs.get(deviceId)
|
const keyPair = nodeKeyPairs.get(deviceId)
|
||||||
try {
|
try {
|
||||||
if (!keyPair) {
|
if (!keyPair) {
|
||||||
throw new FieldError({
|
throw new FieldError({
|
||||||
field: 'deviceId',
|
field: 'deviceId',
|
||||||
message: 'Unauthorized Device ID detected'
|
message: 'decryptMessage() -> Unknown Device ID detected'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue