Support BC-UR v1 wallet import (#3080)

Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
This commit is contained in:
Andrew Camilleri 2021-11-25 10:25:22 +01:00 committed by GitHub
parent d555d2f3f6
commit 87061ecfc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 3 deletions

View File

@ -142,6 +142,7 @@
<Folder Include="wwwroot\vendor\clipboard.js\" />
<Folder Include="wwwroot\vendor\highlightjs\" />
<Folder Include="wwwroot\vendor\summernote" />
<Folder Include="wwwroot\vendor\ur-registry" />
<Folder Include="wwwroot\vendor\vue-qrcode-reader" />
</ItemGroup>

View File

@ -11,6 +11,7 @@
<h5 class="modal-title">
{{title}}
<span v-if="workload.length > 0">Animated QR detected: {{workload.length}} / {{workload[0].total}} scanned</span>
<span v-if="decoder">Animated QR detected: {{decoder.processedPartsCount()}} / {{decoder.expectedPartCount()}} scanned</span>
</h5>
<button type="button" class="btn-close" aria-label="Close" v-on:click="close">
<vc:icon symbol="close"/>
@ -62,7 +63,7 @@ function initCameraScanningApp(title, onDataSubmit, modalId) {
const isModal = !!modalId;
Vue.component('scanner-wrap', {
props: ["modalId", "title", "workload"],
props: ["modalId", "title", "workload", "decoder"],
template: "#camera-qr-scanner-wrap",
methods: {
close() {
@ -128,6 +129,7 @@ function initCameraScanningApp(title, onDataSubmit, modalId) {
this.setQrData(null);
this.errorMessage = null;
this.workload = [];
this.decoder = null;
},
close() {
if (this.modalId) {
@ -143,6 +145,22 @@ function initCameraScanningApp(title, onDataSubmit, modalId) {
this.setQrData(content);
this.workload = [];
} else {
if (this.workload.length == 0){
const d = this.decoder || new window.URlib.URRegistryDecoder();
if (d.receivePart(content)){
this.decoder = d;
if (d.isComplete()){
if (!this.decoder.isSuccess()){
this.errorMessage = this.decoder.resultError();
}else{
this.setQrData(this.decoder.resultRegistryType().toString());
}
}
}
if (this.decoder != null){
return;
}
}
const [index, total] = window.bcur.extractSingleWorkload(content);
if (this.workload.length > 0) {
const currentTotal = this.workload[0].total;

View File

@ -41,13 +41,17 @@
</tr>
</thead>
<tbody>
<tr>
<td>BlueWallet</td>
<td>Open Wallet Settings Show Wallet XPUB</td>
</tr>
<tr>
<td class="text-nowrap">Cobo Vault</td>
<td>Open Wallet Settings Show/Export XPUB</td>
</tr>
<tr>
<td>BlueWallet</td>
<td>Open Wallet Settings Show Wallet XPUB</td>
<td class="text-nowrap">Keystone Vault</td>
<td>Open Wallet Settings Show/Export XPUB</td>
</tr>
<tr>
<td>Passport</td>

View File

@ -194,6 +194,7 @@
"wwwroot/vendor/vuejs/vue.min.js",
"wwwroot/vendor/babel-polyfill/polyfill.min.js",
"wwwroot/vendor/bc-ur/web-bundle.js",
"wwwroot/vendor/ur-registry/urlib.min.js",
"wwwroot/vendor/vue-qrcode-reader/VueQrcodeReader.umd.min.js",
"wwwroot/js/wallet/**/*.js"
],
@ -214,6 +215,7 @@
"wwwroot/vendor/vuejs/vue.min.js",
"wwwroot/vendor/vue-qrcode/vue-qrcode.min.js",
"wwwroot/vendor/bc-ur/web-bundle.js",
"wwwroot/vendor/ur-registry/urlib.min.js",
"wwwroot/vendor/vue-qrcode-reader/VueQrcodeReader.umd.min.js"
],
"minify": {

File diff suppressed because one or more lines are too long