mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
Remove Trezor in AddDerivationScheme
This commit is contained in:
parent
fef1bde9b6
commit
e7ff5c0a4b
6 changed files with 0 additions and 311 deletions
|
@ -50,7 +50,6 @@
|
|||
<div class="dropdown-menu dropdown-menu-right w-100" aria-labelledby="hardwarewlletimportdropdown">
|
||||
<button class="dropdown-item" type="button" data-toggle="modal" data-target="#coldcardimport">Coldcard</button>
|
||||
<button class="dropdown-item check-for-ledger" data-toggle="modal" data-target="#ledgerimport" type="button">Ledger Wallet</button>
|
||||
@* <button class="dropdown-item check-for-trezor" type="button" data-toggle="modal" data-target="#trezorimport">Trezor</button> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -163,9 +162,6 @@
|
|||
@await Html.PartialAsync("_ValidationScriptsPartial")
|
||||
<script src="~/js/ledgerwebsocket.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/StoreAddDerivationScheme.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/vendor/trezor/trezor.js-umd.min.js" defer="defer"></script>
|
||||
<script src="~/js/trezor/trezor-client.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/trezor/trezor-add-derivation-scheme.js" type="text/javascript" defer="defer"></script>
|
||||
<script>
|
||||
window.coinName = "@Model.Network.DisplayName.ToLowerInvariant()";
|
||||
</script>
|
||||
|
|
|
@ -80,91 +80,3 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="trezorimport" tabindex="-1" role="dialog" aria-labelledby="trezorimport" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form class="modal-content" form method="post" id="trezor-submit">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Import Trezor Wallet</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="trezor-loading" style="display: none;">
|
||||
<span class="fa fa-question-circle" style="color: orange"></span> <span>Detecting Trezor hardware wallet...</span>
|
||||
</p>
|
||||
<p id="trezor-error" class="text-danger" style="display: none;">
|
||||
<span class="fa fa-times-circle" style="color: red;"></span> <span class="hw-label">An error happened</span>
|
||||
</p>
|
||||
<p id="trezor-success" style="display: none;">
|
||||
<span class="fa fa-check-circle" style="color: green;"></span> <span class="hw-label">Trezor wallet detected! Name: <kbd id="trezor-devicename"></kbd></span>
|
||||
</p>
|
||||
|
||||
<div class="form-group display-when-trezor-connected" style="display: none">
|
||||
|
||||
<label class="control-label">Wallet address type</label>
|
||||
<select class="form-control" id="trezor-address-type-select">
|
||||
<option data-hide=".trezor-account-dropdown" selected>Select an address type</option>
|
||||
<option data-show="#trezor-account-dropdown-legacy" data-hide=".trezor-account-dropdown"> Legacy</option>
|
||||
@if (Model.Network.NBitcoinNetwork.Consensus.SupportSegwit)
|
||||
{
|
||||
<option data-show="#trezor-account-dropdown-p2sh" data-hide=".trezor-account-dropdown"> P2SH-Segwit</option>
|
||||
<option data-show="#trezor-account-dropdown-segwit" data-hide=".trezor-account-dropdown"> Segwit( Bech32 )</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@if (Model.Network.NBitcoinNetwork.Consensus.SupportSegwit)
|
||||
{
|
||||
<div class="form-group trezor-account-dropdown" style="display: none" id="trezor-account-dropdown-p2sh">
|
||||
|
||||
<label class="control-label">Wallet account</label>
|
||||
<select class="form-control">
|
||||
<option>Select a wallet account</option>
|
||||
@for (var i = 0; i < 20; i++)
|
||||
{
|
||||
<option
|
||||
data-derivation-suffix="-[p2sh]"
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.SegwitP2SH).Derive(i, true)"
|
||||
>Account @i (@Model.Network.GetRootKeyPath(DerivationType.SegwitP2SH).Derive(i, true))</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group trezor-account-dropdown" style="display: none" id="trezor-account-dropdown-segwit">
|
||||
|
||||
<label class="control-label">Wallet account</label>
|
||||
<select class="form-control">
|
||||
<option>Select a wallet account</option>
|
||||
@for (var i = 0; i < 20; i++)
|
||||
{
|
||||
<option
|
||||
data-derivation-suffix=""
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.Segwit).Derive(i, true)" href="#">Account @i (@Model.Network.GetRootKeyPath(DerivationType.Segwit).Derive(i, true))</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
<div class="form-group trezor-account-dropdown" style="display: none" id="trezor-account-dropdown-legacy">
|
||||
|
||||
<label class="control-label">Wallet account</label>
|
||||
<select class="form-control">
|
||||
<option>Select a wallet account</option>
|
||||
@for (var i = 0; i < 20; i++)
|
||||
{
|
||||
<option
|
||||
data-derivation-suffix="-[legacy]"
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.Legacy).Derive(i, true)">Account @i (@Model.Network.GetRootKeyPath(DerivationType.Legacy).Derive(i, true))</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button class="btn btn-primary" id="trezorsubmitbutton">Submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
$(document).ready(function() {
|
||||
var trezorInit = false;
|
||||
$(".check-for-trezor").on("click",
|
||||
function() {
|
||||
if (!trezorInit || !window.trezorDevice) {
|
||||
trezorClient.init();
|
||||
trezorInit = true;
|
||||
}
|
||||
});
|
||||
|
||||
$("[data-trezorkeypath]").on("click",
|
||||
function() {
|
||||
|
||||
$("#trezor-error").hide();
|
||||
var keypath = $(this).data("trezorkeypath");
|
||||
var suffix = $(this).data("derivation-suffix");
|
||||
var keys = keypath.split("/");
|
||||
if (trezorDevice != null) {
|
||||
var hardeningConstant = 0x80000000;
|
||||
|
||||
trezorDevice.waitForSessionAndRun(function(session) {
|
||||
|
||||
var path = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
|
||||
if (keys[i].endsWith("'")) {
|
||||
key = key.substring(0, key.length - 1);
|
||||
path.push((parseInt(key) | hardeningConstant) >>> 0);
|
||||
continue;
|
||||
}
|
||||
path.push(parseInt(key));
|
||||
}
|
||||
return session.getHDNode(path, window.coinName);
|
||||
})
|
||||
.then(function(hdNode) {
|
||||
$("#RootFingerprint").val(hdNode.parentFingerprint);
|
||||
$("#KeyPath").val(keys[keys.length - 1]);
|
||||
$("#DerivationScheme").val(hdNode.toBase58()+ suffix);
|
||||
$("#trezorsubmitbutton").show();
|
||||
}).catch(function(e){
|
||||
alert(e.message);
|
||||
|
||||
$("#trezor-error").text("An error occurred when communicating with the trezor device. try with a different USB port?").show();
|
||||
|
||||
})
|
||||
}
|
||||
});
|
||||
$("[data-hide]").on("click", function(){
|
||||
$($(this).data("hide")).hide();
|
||||
});
|
||||
$("[data-show]").on("click", function(){
|
||||
$($(this).data("show")).show();
|
||||
});
|
||||
|
||||
$(".trezor-account-dropdown select").on("input", function(){
|
||||
$(this).find(":selected").click();
|
||||
});
|
||||
|
||||
$("#trezor-address-type-select").on("input", function(){
|
||||
$(this).find(":selected").click();
|
||||
$("#RootFingerprint").val("");
|
||||
$("#KeyPath").val("");
|
||||
$("#DerivationScheme").val("");
|
||||
$("#trezorsubmitbutton").hide();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function onTrezorDeviceFound(device) {
|
||||
$(".display-when-trezor-connected").show();
|
||||
}
|
||||
function onTrezorDeviceLost(){
|
||||
$(".display-when-trezor-connected").hide();
|
||||
$("#RootFingerprint").val("");
|
||||
$(".trezor-account-dropdown").hide();
|
||||
$("#KeyPath").val("");
|
||||
$("#DerivationScheme").val("");
|
||||
$("#trezorsubmitbutton").hide();
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
window.deviceList = null;
|
||||
window.trezorClient = {
|
||||
init: function () {
|
||||
document.getElementById("trezor-loading").style.display = "block";
|
||||
window.trezorDeviceList = new trezor.DeviceList({
|
||||
config: window.trezorConfig || null,
|
||||
debug: true,
|
||||
transport: new trezorLink.Lowlevel(new trezorLink.WebUsb(), function () {
|
||||
return null;
|
||||
})
|
||||
});
|
||||
|
||||
trezorDeviceList.on("connect", trezorClient.onDeviceConnected);
|
||||
trezorDeviceList.on("connectUnacquired", function(e){
|
||||
e.steal.then(trezorClient.onDeviceConnected);
|
||||
});
|
||||
|
||||
trezorDeviceList.on("transport", function(){
|
||||
if (trezorDeviceList.asArray().length < 1 || trezorDeviceList.requestNeeded) {
|
||||
if (!navigator.usb) {
|
||||
document.getElementById("trezor-loading").style.display = "none";
|
||||
document.getElementById("trezor-error").style.display = "block";
|
||||
document.getElementById("trezor-error").innerHTML = 'Your browser does not support WebUsb. Please switch to a <a href="https://caniuse.com/#feat=webusb" target="_blank">supported browser</a> or request Trezor to implement <a href="https://github.com/trezor/trezord-go/issues/155" target="_blank">this feature</a>.';
|
||||
return;
|
||||
}
|
||||
trezorClient.requestDevice();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
requestDevice: function () {
|
||||
return trezorDeviceList.requestDevice().catch(function () {
|
||||
|
||||
document.getElementById("trezor-loading").style.display = "none";
|
||||
document.getElementById("trezor-error").style.display = "block";
|
||||
document.getElementById("trezor-error").innerText = 'Device could not be acquired. Do you have another app using the device?';
|
||||
})
|
||||
},
|
||||
onDeviceConnected: function (device) {
|
||||
window.trezorDevice = null;
|
||||
document.getElementById("trezor-error").style.display = "none";
|
||||
document.getElementById("trezor-error").innerText = 'Device could not be used.';
|
||||
device.on('disconnect', function () {
|
||||
window.trezorDevice = null;
|
||||
document.getElementById("trezor-error").style.display = "block";
|
||||
document.getElementById("trezor-error").innerText = 'Device was disconnected';
|
||||
document.getElementById("trezor-loading").style.display = "block";
|
||||
document.getElementById("trezor-success").style.display = "none";
|
||||
if (window.onTrezorDeviceLost) {
|
||||
window.onTrezorDeviceLost();
|
||||
}
|
||||
});
|
||||
if (device.isBootloader()) {
|
||||
document.getElementById("trezor-error").style.display = "block";
|
||||
document.getElementById("trezor-error").innerText = 'Device is in Bootloader, please reconnect it.';
|
||||
return;
|
||||
}
|
||||
if (!device.isInitialized()) {
|
||||
document.getElementById("trezor-error").style.display = "block";
|
||||
document.getElementById("trezor-error").innerText = 'Device is not yet setup.';
|
||||
return;
|
||||
}
|
||||
document.getElementById("trezor-loading").style.display = "none";
|
||||
document.getElementById("trezor-success").style.display = "block";
|
||||
window.trezorDevice = device;
|
||||
if (window.onTrezorDeviceFound) {
|
||||
document.getElementById("trezor-devicename").innerText = device.features.label;
|
||||
window.onTrezorDeviceFound(device);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
1
BTCPayServer/wwwroot/vendor/trezor/README.md
vendored
1
BTCPayServer/wwwroot/vendor/trezor/README.md
vendored
|
@ -1 +0,0 @@
|
|||
The contents of this folder was generated by https://github.com/btcpayserver/trezor-webpack-wrapper
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue