feat: only allow DH key exchange in the first 60 seconds
This commit is contained in:
parent
7c796f428a
commit
f73f5a90c9
1 changed files with 20 additions and 4 deletions
|
|
@ -577,12 +577,28 @@ async function serialSigner(path) {
|
||||||
},
|
},
|
||||||
handleDhExchangeResponse: async function (res = '') {
|
handleDhExchangeResponse: async function (res = '') {
|
||||||
console.log('### handleDhExchangeResponse', res)
|
console.log('### handleDhExchangeResponse', res)
|
||||||
const [pubKeyHex] = res.trim().split(' ')
|
const [statusCode, data] = res.trim().split(' ')
|
||||||
if (!pubKeyHex) {
|
let pubKeyHex, errorMessage, captionMessage
|
||||||
|
switch (statusCode) {
|
||||||
|
case '0':
|
||||||
|
pubKeyHex = data
|
||||||
|
if(!data) errorMessage = 'Failed to exchange DH secret!'
|
||||||
|
break
|
||||||
|
case '1':
|
||||||
|
errorMessage = 'Secure connection can only be established in the first 60 seconds after start-up!'
|
||||||
|
captionMessage = 'Restart and try again'
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
errorMessage = 'Unexpected error code'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorMessage) {
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: 'Failed to exchange DH secret!',
|
message: errorMessage,
|
||||||
caption: `${res}`,
|
caption: captionMessage || '',
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue