Skip to content

Commit

Permalink
Merge pull request #26 from KeystoneHQ/release-fix
Browse files Browse the repository at this point in the history
compitible with old signature
  • Loading branch information
aaronisme authored Jul 29, 2021
2 parents 2a061a7 + 632d670 commit a7569f1
Showing 1 changed file with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,30 +105,36 @@ private void updateUI() {
}

private void showQrCode(JSONObject signed) {
WatchWallet watchWallet = WatchWallet.getWatchWallet(mActivity);
if (watchWallet.equals(WatchWallet.METAMASK)) {
try {
try {
WatchWallet watchWallet = WatchWallet.getWatchWallet(mActivity);
if (watchWallet.equals(WatchWallet.METAMASK)) {
try {
if (signed != null) {
signed.remove("abi");
signed.remove("chainId");
byte[] signature = Hex.decode(signed.getString("signature"));
UUID uuid = UUID.fromString(signed.getString("signId"));
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
byteBuffer.putLong(uuid.getMostSignificantBits());
byteBuffer.putLong(uuid.getLeastSignificantBits());
byte[] requestId = byteBuffer.array();
EthSignature ethSignature = new EthSignature(signature, requestId);
mBinding.qrcode.qrcode.setData(ethSignature.toUR().toString());
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
if (signed != null) {
signed.remove("abi");
signed.remove("chainId");
byte[] signature = Hex.decode(signed.getString("signature"));
UUID uuid = UUID.fromString(signed.getString("signId"));
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
byteBuffer.putLong(uuid.getMostSignificantBits());
byteBuffer.putLong(uuid.getLeastSignificantBits());
byte[] requestId = byteBuffer.array();
EthSignature ethSignature = new EthSignature(signature, requestId);
mBinding.qrcode.qrcode.setData(ethSignature.toUR().toString());
mBinding.qrcode.qrcode.setData(Hex.toHexString(signed.toString().getBytes(StandardCharsets.UTF_8)));
}
} catch (JSONException e) {
e.printStackTrace();
}
} else {
if (signed != null) {
signed.remove("abi");
signed.remove("chainId");
mBinding.qrcode.qrcode.setData(Hex.toHexString(signed.toString().getBytes(StandardCharsets.UTF_8)));
}
}catch (Exception e){
signed.remove("abi");
signed.remove("chainId");
mBinding.qrcode.qrcode.setData(Hex.toHexString(signed.toString().getBytes(StandardCharsets.UTF_8)));
}
}

Expand Down

0 comments on commit a7569f1

Please sign in to comment.