feat: add buttons config
This commit is contained in:
parent
61d3ca8c0b
commit
d8d4d4d057
3 changed files with 39 additions and 9 deletions
|
|
@ -124,10 +124,32 @@
|
||||||
<q-form @submit="hwwConfigAndConnect" class="q-gutter-md">
|
<q-form @submit="hwwConfigAndConnect" class="q-gutter-md">
|
||||||
<span>Enter Config</span>
|
<span>Enter Config</span>
|
||||||
|
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
v-model.trim="hww.deviceConfig.name"
|
||||||
|
label="Name (optional)"
|
||||||
|
></q-input>
|
||||||
|
<q-separator></q-separator>
|
||||||
<serial-port-config
|
<serial-port-config
|
||||||
ref="serialPortConfig"
|
ref="serialPortConfig"
|
||||||
:config="hww.config"
|
:config="hww.config"
|
||||||
></serial-port-config>
|
></serial-port-config>
|
||||||
|
<q-separator></q-separator>
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
v-model.trim="hww.deviceConfig.buttonOnePin"
|
||||||
|
type="number"
|
||||||
|
label="Pin Number (Button 1)"
|
||||||
|
></q-input>
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
v-model.trim="hww.deviceConfig.buttonTwoPin"
|
||||||
|
type="number"
|
||||||
|
label="Pin Number (Button 2)"
|
||||||
|
></q-input>
|
||||||
|
|
||||||
<div class="row q-mt-lg">
|
<div class="row q-mt-lg">
|
||||||
<q-btn unelevated color="primary" type="submit">Connect</q-btn>
|
<q-btn unelevated color="primary" type="submit">Connect</q-btn>
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ async function serialSigner(path) {
|
||||||
xpubResolve: null,
|
xpubResolve: null,
|
||||||
seedWordPosition: 1,
|
seedWordPosition: 1,
|
||||||
showSeedDialog: false,
|
showSeedDialog: false,
|
||||||
|
config: null,
|
||||||
|
deviceConfig: {
|
||||||
|
name: null,
|
||||||
|
buttonOnePin: 0,
|
||||||
|
buttonTwoPin: 35
|
||||||
|
},
|
||||||
confirm: {
|
confirm: {
|
||||||
outputIndex: 0,
|
outputIndex: 0,
|
||||||
showFee: false
|
showFee: false
|
||||||
|
|
@ -237,7 +243,7 @@ async function serialSigner(path) {
|
||||||
case COMMAND_SEED:
|
case COMMAND_SEED:
|
||||||
this.handleShowSeedResponse(commandData)
|
this.handleShowSeedResponse(commandData)
|
||||||
break
|
break
|
||||||
case COMMAND_DH_EXCHANGE:
|
case COMMAND_PAIR:
|
||||||
this.handleDhExchangeResponse(commandData)
|
this.handleDhExchangeResponse(commandData)
|
||||||
break
|
break
|
||||||
case COMMAND_LOG:
|
case COMMAND_LOG:
|
||||||
|
|
@ -258,7 +264,7 @@ async function serialSigner(path) {
|
||||||
case COMMAND_SEND_PSBT:
|
case COMMAND_SEND_PSBT:
|
||||||
case COMMAND_WIPE:
|
case COMMAND_WIPE:
|
||||||
case COMMAND_XPUB:
|
case COMMAND_XPUB:
|
||||||
case COMMAND_DH_EXCHANGE:
|
case COMMAND_PAIR:
|
||||||
console.log(
|
console.log(
|
||||||
` %c${command} ${commandData}`,
|
` %c${command} ${commandData}`,
|
||||||
'background: #222; color: yellow'
|
'background: #222; color: yellow'
|
||||||
|
|
@ -551,10 +557,12 @@ async function serialSigner(path) {
|
||||||
this.decryptionKey
|
this.decryptionKey
|
||||||
)
|
)
|
||||||
const publicKeyHex = publicKey.toHex().slice(2)
|
const publicKeyHex = publicKey.toHex().slice(2)
|
||||||
// must not be encrypted
|
|
||||||
await this.writer.write(
|
await this.sendCommandClearText(COMMAND_PAIR, [
|
||||||
COMMAND_DH_EXCHANGE + ' ' + publicKeyHex + '\n'
|
publicKeyHex,
|
||||||
)
|
this.hww.deviceConfig.buttonOnePin,
|
||||||
|
this.hww.deviceConfig.buttonTwoPin
|
||||||
|
])
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message: 'Starting secure session!',
|
message: 'Starting secure session!',
|
||||||
|
|
@ -580,7 +588,7 @@ async function serialSigner(path) {
|
||||||
break
|
break
|
||||||
case '1':
|
case '1':
|
||||||
errorMessage =
|
errorMessage =
|
||||||
'Secure connection can only be established in the first 60 seconds after start-up!'
|
'Secure connection can only be established in the first 10 seconds after start-up!'
|
||||||
captionMessage = 'Restart and try again'
|
captionMessage = 'Restart and try again'
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
@ -776,7 +784,7 @@ async function serialSigner(path) {
|
||||||
const commandData = value.substring(command.length).trim()
|
const commandData = value.substring(command.length).trim()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
command === COMMAND_DH_EXCHANGE ||
|
command === COMMAND_PAIR ||
|
||||||
command === COMMAND_LOG ||
|
command === COMMAND_LOG ||
|
||||||
command === COMMAND_PASSWORD_CLEAR ||
|
command === COMMAND_PASSWORD_CLEAR ||
|
||||||
command === COMMAND_PING ||
|
command === COMMAND_PING ||
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ const COMMAND_RESTORE = '/restore'
|
||||||
const COMMAND_CONFIRM_NEXT = '/confirm-next'
|
const COMMAND_CONFIRM_NEXT = '/confirm-next'
|
||||||
const COMMAND_CANCEL = '/cancel'
|
const COMMAND_CANCEL = '/cancel'
|
||||||
const COMMAND_XPUB = '/xpub'
|
const COMMAND_XPUB = '/xpub'
|
||||||
const COMMAND_DH_EXCHANGE = '/dh-exchange'
|
const COMMAND_PAIR = '/pair'
|
||||||
const COMMAND_LOG = '/log'
|
const COMMAND_LOG = '/log'
|
||||||
const COMMAND_CHECK_PAIRING = '/check-pairing'
|
const COMMAND_CHECK_PAIRING = '/check-pairing'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue