Merge branch 'main' into secure_communication
This commit is contained in:
@@ -111,7 +111,7 @@
|
||||
<q-td colspan="100%">
|
||||
<div class="row items-center q-mt-md q-mb-lg">
|
||||
<div class="col-2 q-pr-lg"></div>
|
||||
<div class="col-4 q-pr-lg">
|
||||
<div class="col-2 q-pr-lg">
|
||||
<q-btn
|
||||
unelevated
|
||||
dense
|
||||
@@ -123,6 +123,16 @@
|
||||
QR Code</q-btn
|
||||
>
|
||||
</div>
|
||||
<div class="col-2 q-pr-lg">
|
||||
<q-btn
|
||||
outline
|
||||
color="grey"
|
||||
icon="content_copy"
|
||||
@click="copyText(props.row.address)"
|
||||
class="q-ml-sm"
|
||||
>Copy</q-btn
|
||||
>
|
||||
</div>
|
||||
<div class="col-2 q-pr-lg">
|
||||
<q-btn
|
||||
outline
|
||||
|
||||
@@ -74,6 +74,16 @@ async function addressList(path) {
|
||||
satBtc(val, showUnit = true) {
|
||||
return satOrBtc(val, showUnit, this.satsDenominated)
|
||||
},
|
||||
// todo: bad. base.js not present in custom components
|
||||
copyText: function (text, message, position) {
|
||||
var notify = this.$q.notify
|
||||
Quasar.utils.copyToClipboard(text).then(function () {
|
||||
notify({
|
||||
message: message || 'Copied to clipboard!',
|
||||
position: position || 'bottom'
|
||||
})
|
||||
})
|
||||
},
|
||||
getWalletName: function (walletId) {
|
||||
const wallet = (this.accounts || []).find(wl => wl.id === walletId)
|
||||
return wallet ? wallet.title : 'unknown'
|
||||
|
||||
@@ -123,7 +123,6 @@
|
||||
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
|
||||
<q-form @submit="hwwConfigAndConnect" class="q-gutter-md">
|
||||
<span>Enter Config</span>
|
||||
|
||||
<q-input
|
||||
filled
|
||||
dense
|
||||
@@ -131,6 +130,7 @@
|
||||
label="Name (optional)"
|
||||
></q-input>
|
||||
<q-separator></q-separator>
|
||||
|
||||
<serial-port-config
|
||||
ref="serialPortConfig"
|
||||
:config="hww.config"
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<div>
|
||||
<q-card>
|
||||
<div class="row items-center no-wrap q-mb-md">
|
||||
<div class="col-2 q-ml-lg">
|
||||
|
||||
<div class="col-md-2 col-xs-4 q-ml-lg">
|
||||
<q-btn unelevated @click="show = true" color="primary" icon="settings">
|
||||
</q-btn>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div class="col-md-8 col-xs-4">
|
||||
<div class="row justify-center q-gutter-x-md items-center">
|
||||
<div class="text-h3">{{satBtc(total)}}</div>
|
||||
<div :class="{'text-h4': $q.screen.gt.md}">{{satBtc(total)}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 float-right">
|
||||
<div class="col-md-2 col-xs-4 q-pr-lg">
|
||||
<slot name="serial"></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,124 +58,10 @@ async function walletConfig(path) {
|
||||
} catch (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
}
|
||||
},
|
||||
deriveSecretKey: async function (privateKey, publicKey) {
|
||||
return window.crypto.subtle.deriveKey(
|
||||
{
|
||||
name: 'ECDH',
|
||||
public: publicKey
|
||||
},
|
||||
privateKey,
|
||||
{
|
||||
name: 'AES-GCM',
|
||||
length: 256
|
||||
},
|
||||
true,
|
||||
['encrypt', 'decrypt']
|
||||
)
|
||||
},
|
||||
old: async function () {
|
||||
// const alicesKeyPair = await window.crypto.subtle.generateKey(
|
||||
// {
|
||||
// name: 'ECDH',
|
||||
// namedCurve: 'P-256'
|
||||
// },
|
||||
// true,
|
||||
// ['deriveKey']
|
||||
// )
|
||||
// const bobsKeyPair = await window.crypto.subtle.generateKey(
|
||||
// {
|
||||
// name: 'ECDH',
|
||||
// namedCurve: 'P-256'
|
||||
// },
|
||||
// true,
|
||||
// ['deriveKey']
|
||||
// )
|
||||
// console.log('### alicesKeyPair', alicesKeyPair)
|
||||
// console.log('### alicesKeyPair.privateKey', alicesKeyPair.privateKey)
|
||||
// console.log('### alicesKeyPair.publicKey', alicesKeyPair.publicKey)
|
||||
// const alicesPriveKey = await window.crypto.subtle.exportKey(
|
||||
// 'jwk',
|
||||
// alicesKeyPair.privateKey
|
||||
// )
|
||||
// console.log('### alicesPriveKey', alicesPriveKey)
|
||||
// const alicesPriveKeyBase64 = toStdBase64(alicesPriveKey.d)
|
||||
// console.log(
|
||||
// '### alicesPriveKeyBase64',
|
||||
// alicesPriveKeyBase64,
|
||||
// base64ToHex(alicesPriveKeyBase64)
|
||||
// )
|
||||
// const bobPublicKey = await window.crypto.subtle.exportKey(
|
||||
// 'raw',
|
||||
// bobsKeyPair.publicKey
|
||||
// )
|
||||
// console.log('### bobPublicKey hex', buf2hex(bobPublicKey))
|
||||
// const sharedSecret01 = await this.deriveSecretKey(alicesKeyPair.privateKey, bobsKeyPair.publicKey)
|
||||
// console.log('### sharedSecret01', sharedSecret01)
|
||||
// const sharedSecret01Raw = await window.crypto.subtle.exportKey('jwk', sharedSecret01)
|
||||
// console.log('### sharedSecret01Raw', sharedSecret01Raw)
|
||||
// const sharedSecret02 = await this.deriveSecretKey(bobsKeyPair.privateKey, alicesKeyPair.publicKey)
|
||||
// console.log('### sharedSecret02', sharedSecret02)
|
||||
// const sharedSecret02Raw = await window.crypto.subtle.exportKey('jwk', sharedSecret02)
|
||||
// console.log('### sharedSecret02Raw', sharedSecret02Raw)
|
||||
// const sharedSecret = nobleSecp256k1.getSharedSecret(
|
||||
// alicesPriveKey,
|
||||
// buf2hex(bobPublicKey)
|
||||
// )
|
||||
// console.log('###', getSharedSecret)
|
||||
},
|
||||
importSecretKey: async function (rawKey) {
|
||||
return window.crypto.subtle.importKey('raw', rawKey, 'AES-GCM', true, [
|
||||
'encrypt',
|
||||
'decrypt'
|
||||
])
|
||||
}
|
||||
},
|
||||
|
||||
created: async function () {
|
||||
await this.getConfig()
|
||||
// ### in: 6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710
|
||||
// ### in2: 073059e23605fe508919d892501974905f8b5e13728db63b1b7b9326951abbe4f722c104bc82a4bcf3f1e15ede8ab7d5eb00be8c46271e1f65867f984e9cb5f1
|
||||
|
||||
// const alicesPrivateKey =
|
||||
// '359A8CA1418C49DD26DC7D92C789AC33347F64C6B7789C666098805AF3CC60E5'
|
||||
|
||||
// const bobsPrivateKey =
|
||||
// 'AB52F1F981F639BD83F884703BC690B10DB709FF48806680A0D3FBC6475E6093'
|
||||
|
||||
// const alicesPublicKey = nobleSecp256k1.Point.fromPrivateKey(
|
||||
// alicesPrivateKey
|
||||
// )
|
||||
// console.log('### alicesPublicKey', alicesPublicKey.toHex())
|
||||
|
||||
// const bobsPublicKey = nobleSecp256k1.Point.fromPrivateKey(bobsPrivateKey)
|
||||
// console.log('### bobsPublicKey', bobsPublicKey.toHex())
|
||||
|
||||
// const sharedSecret = nobleSecp256k1.getSharedSecret(
|
||||
// alicesPrivateKey,
|
||||
// bobsPublicKey
|
||||
// )
|
||||
|
||||
// console.log('### sharedSecret naked', sharedSecret)
|
||||
|
||||
// console.log(
|
||||
// '### sharedSecret a',
|
||||
// nobleSecp256k1.utils.bytesToHex(sharedSecret)
|
||||
// )
|
||||
// console.log(
|
||||
// '### sharedSecret b',
|
||||
// nobleSecp256k1.Point.fromHex(sharedSecret)
|
||||
// )
|
||||
// console.log(
|
||||
// '### sharedSecret b',
|
||||
// nobleSecp256k1.Point.fromHex(sharedSecret).toHex(true)
|
||||
// )
|
||||
|
||||
// const alicesPrivateKeyBytes = nobleSecp256k1.utils.hexToBytes(
|
||||
// alicesPrivateKey
|
||||
// )
|
||||
// const x = await this.importSecretKey(alicesPrivateKeyBytes)
|
||||
// console.log('### x', x)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<div class="row items-center no-wrap q-mb-md">
|
||||
<div class="col">
|
||||
<div class="col-4">
|
||||
<q-btn-dropdown
|
||||
split
|
||||
unelevated
|
||||
@@ -30,9 +30,8 @@
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
</div>
|
||||
|
||||
<div class="col-auto q-pr-lg"></div>
|
||||
<div class="col-auto q-pl-lg">
|
||||
<div class="col-4 q-pl-lg"></div>
|
||||
<div class="col-4 q-pl-lg">
|
||||
<q-input
|
||||
borderless
|
||||
dense
|
||||
|
||||
@@ -19,6 +19,7 @@ const COMMAND_CHECK_PAIRING = '/check-pairing'
|
||||
const DEFAULT_RECEIVE_GAP_LIMIT = 20
|
||||
const PAIRING_CONTROL_TEXT = 'lnbits'
|
||||
|
||||
|
||||
const blockTimeToDate = blockTime =>
|
||||
blockTime ? moment(blockTime * 1000).format('LLL') : ''
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
:network="config.network"
|
||||
:sats-denominated="config.sats_denominated"
|
||||
@signed:psbt="updateSignedPsbt"
|
||||
class="q-pr-lg float-right"
|
||||
></serial-signer>
|
||||
</template>
|
||||
</wallet-config>
|
||||
@@ -33,7 +34,7 @@
|
||||
{% raw %}
|
||||
<q-card>
|
||||
<div class="row q-pt-sm q-pb-sm items-center no-wrap q-mb-md">
|
||||
<div class="col-3 q-pl-md">
|
||||
<div class="col-md-3 col-sm-5 q-pl-md">
|
||||
<q-btn
|
||||
unelevated
|
||||
class="btn-full"
|
||||
@@ -43,14 +44,14 @@
|
||||
>Scan Blockchain</q-btn
|
||||
>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="col-md-6 col-sm-2 q-pl-md">
|
||||
<q-spinner
|
||||
v-if="scan.scanning == true"
|
||||
color="primary"
|
||||
size="2.55em"
|
||||
></q-spinner>
|
||||
</div>
|
||||
<div class="col-3 q-pr-md">
|
||||
<div class="col-md-3 col-sm-5 q-pr-md">
|
||||
<q-btn
|
||||
v-if="!showPayment"
|
||||
unelevated
|
||||
@@ -170,14 +171,25 @@
|
||||
></qrcode>
|
||||
</q-responsive>
|
||||
<p v-if="currentAddress">
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="ms"
|
||||
icon="content_copy"
|
||||
@click="copyText(props.row.address)"
|
||||
class="q-ml-sm"
|
||||
></q-btn>
|
||||
|
||||
{{ currentAddress.address }}
|
||||
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
size="ms"
|
||||
icon="launch"
|
||||
type="a"
|
||||
:href="mempoolHostname + '/address/' + currentAddress.address"
|
||||
:href="'https://' + mempoolHostname + '/address/' + currentAddress.address"
|
||||
|
||||
target="_blank"
|
||||
></q-btn>
|
||||
</p>
|
||||
@@ -239,5 +251,6 @@
|
||||
<script src="{{ url_for('watchonly_static', path='components/serial-port-config/serial-port-config.js') }}"></script>
|
||||
<script src="{{ url_for('watchonly_static', path='js/crypto/noble-secp256k1.js') }}"></script>
|
||||
<script src="{{ url_for('watchonly_static', path='js/crypto/aes.js') }}"></script>
|
||||
|
||||
<script src="{{ url_for('watchonly_static', path='js/index.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user