craig says i need more callbacks
This commit is contained in:
+3
-4
@@ -8,7 +8,6 @@
|
|||||||
"js" : ["dist/content.js"]}],
|
"js" : ["dist/content.js"]}],
|
||||||
"browser_action" : {"default_icon" : "art/jrx-icon-32.png",
|
"browser_action" : {"default_icon" : "art/jrx-icon-32.png",
|
||||||
"default_title" : "Jæck Russell",
|
"default_title" : "Jæck Russell",
|
||||||
"default_popup" : "popup.html"},
|
"default_popup" : "pages/popup.html"},
|
||||||
"background" : {"page" : "background.html"},
|
"background" : {"page" : "pages/background.html"},
|
||||||
"content_security_policy" : "script-src 'self'; object-src 'self'",
|
"permissions" : ["storage", "history"]}
|
||||||
"permissions" : ["storage"]}
|
|
||||||
|
|||||||
-4096
File diff suppressed because it is too large
Load Diff
@@ -76,7 +76,7 @@
|
|||||||
And i discovered a future potential pitfall
|
And i discovered a future potential pitfall
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script src="./dist/jex_include/local-tweetnacl-1.0.3/dist/nacl.js"></script>
|
<script src="../dist/jex_include/local-tweetnacl-1.0.3/dist/nacl.js"></script>
|
||||||
|
|
||||||
<!-- same but for blakejs
|
<!-- same but for blakejs
|
||||||
<script src="./dist/jex_include/local-blakejs-1.2.1/dist/index.js"></script>
|
<script src="./dist/jex_include/local-blakejs-1.2.1/dist/index.js"></script>
|
||||||
@@ -85,6 +85,6 @@
|
|||||||
<!--
|
<!--
|
||||||
this is a non-issue
|
this is a non-issue
|
||||||
-->
|
-->
|
||||||
<script type="module" src="./dist/background.js"></script>
|
<script type="module" src="../dist/background.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Is this message good or bad?</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Is this message good or bad?</h1>
|
||||||
|
|
||||||
|
<pre id="message"></pre>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<button id="good">Good</button>
|
||||||
|
<br>
|
||||||
|
<button id="bad">Bad</button>
|
||||||
|
|
||||||
|
<script type="module" src="./msg_confirm.js"></script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
console.log('ur mom');
|
||||||
|
var result = null;
|
||||||
|
document.getElementById('good').onclick = () => { console.log('click good'); result = 'good' }
|
||||||
|
document.getElementById('bad').onclick = () => { console.log('click bad'); result = 'bad' }
|
||||||
|
|
||||||
|
browser.runtime.onMessage.addListener((msg) => {
|
||||||
|
console.error("ERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRROR");
|
||||||
|
console.log('msg', msg);
|
||||||
|
//document.getElementById("message").innerHTML = msg_str;
|
||||||
|
|
||||||
|
//const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||||
|
|
||||||
|
//while (true) {
|
||||||
|
// if (result === 'good') {
|
||||||
|
// console.log('good');
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// else if (result === 'bad') {
|
||||||
|
// console.log('bad');
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// await sleep(100);
|
||||||
|
//}
|
||||||
|
});
|
||||||
@@ -2,10 +2,6 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<!--
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="./ext/bootstrap-5.3.0-alpha3-dist/css/bootstrap.min.css">
|
|
||||||
-->
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
background: #d6efff;
|
background: #d6efff;
|
||||||
@@ -19,7 +15,7 @@
|
|||||||
|
|
||||||
<table width="100%" style="background: #dad1ff; border: 2px solid #6c5d96; border-radius: 5px;">
|
<table width="100%" style="background: #dad1ff; border: 2px solid #6c5d96; border-radius: 5px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="./art/jrx-icon-48.png" style="width: 32px; height: 32px;"></td>
|
<td><img src="../art/jrx-icon-48.png" style="width: 32px; height: 32px;"></td>
|
||||||
<td style="font-size: 32px; text-align: center; font-weight: bold">
|
<td style="font-size: 32px; text-align: center; font-weight: bold">
|
||||||
JÆCK RUSSELL
|
JÆCK RUSSELL
|
||||||
</td>
|
</td>
|
||||||
@@ -29,7 +25,7 @@
|
|||||||
<div style="margin-top: 5px; width: 95%; background: #d9ffd6; border: 1px solid #6c5d96; border-radius: 5px;">
|
<div style="margin-top: 5px; width: 95%; background: #d9ffd6; border: 1px solid #6c5d96; border-radius: 5px;">
|
||||||
<table >
|
<table >
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="./art/keypair.svg" style="width: 32px; height: 32px;"></td>
|
<td><img src="../art/keypair.svg" style="width: 32px; height: 32px;"></td>
|
||||||
<td style="justify-content: center; font-size: 28px; text-align: center; font-weight: bold">
|
<td style="justify-content: center; font-size: 28px; text-align: center; font-weight: bold">
|
||||||
KEYPAIRS
|
KEYPAIRS
|
||||||
</td>
|
</td>
|
||||||
@@ -63,7 +59,7 @@
|
|||||||
<div style="margin-top: 5px; width: 95%; background: #d9ffd6; border: 1px solid #6c5d96; border-radius: 5px;">
|
<div style="margin-top: 5px; width: 95%; background: #d9ffd6; border: 1px solid #6c5d96; border-radius: 5px;">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="./art/keypair.svg" style="width: 32px; height: 32px;"></td>
|
<td><img src="../art/keypair.svg" style="width: 32px; height: 32px;"></td>
|
||||||
<td style="justify-content: center; font-size: 28px; text-align: center; font-weight: bold">
|
<td style="justify-content: center; font-size: 28px; text-align: center; font-weight: bold">
|
||||||
KEYPAIRS
|
KEYPAIRS
|
||||||
</td>
|
</td>
|
||||||
+18
-5
@@ -319,7 +319,8 @@ bi_msg_handler_content
|
|||||||
case "message.sign":
|
case "message.sign":
|
||||||
console.log('jr bg content message handler message sign');
|
console.log('jr bg content message handler message sign');
|
||||||
let msg_str : string = msg.data.params.message;
|
let msg_str : string = msg.data.params.message;
|
||||||
return w2a_ok(msg_sign(msg_str, secret_key));
|
let resultt = await msg_sign(msg_str, secret_key)
|
||||||
|
return w2a_ok(resultt);
|
||||||
|
|
||||||
// right now just sign tx
|
// right now just sign tx
|
||||||
case "transaction.sign":
|
case "transaction.sign":
|
||||||
@@ -347,12 +348,24 @@ bi_msg_handler_content
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
function
|
async function
|
||||||
msg_sign
|
msg_sign
|
||||||
(msg_str : string,
|
(msg_str : string,
|
||||||
secret_key : Uint8Array)
|
secret_key : Uint8Array)
|
||||||
: {signature : string}
|
: Promise<{signature : string}>
|
||||||
{
|
{
|
||||||
|
console.log('a');
|
||||||
|
// does the user want to sign the message
|
||||||
|
let confirm_window = await browser.windows.create({url : '../pages/msg_confirm.html',
|
||||||
|
type : 'popup'});
|
||||||
|
console.log('b');
|
||||||
|
// @ts-ignore shut the fuck up
|
||||||
|
let tabid : number = confirm_window.tabs[0].id;
|
||||||
|
console.log('tabid', tabid);
|
||||||
|
|
||||||
|
let result = await browser.tabs.sendMessage(tabid, {msg_str : msg_str});
|
||||||
|
console.log('result', result);
|
||||||
|
|
||||||
// use nacl detached signatures
|
// use nacl detached signatures
|
||||||
// https://github.com/aeternity/aepp-sdk-js/blob/5df22dd297abebc0607710793a7234e6761570d4/src/utils/crypto.ts#L141-L143
|
// https://github.com/aeternity/aepp-sdk-js/blob/5df22dd297abebc0607710793a7234e6761570d4/src/utils/crypto.ts#L141-L143
|
||||||
// https://github.com/aeternity/aepp-sdk-js/blob/5df22dd297abebc0607710793a7234e6761570d4/src/utils/crypto.ts#L160-L167
|
// https://github.com/aeternity/aepp-sdk-js/blob/5df22dd297abebc0607710793a7234e6761570d4/src/utils/crypto.ts#L160-L167
|
||||||
@@ -587,14 +600,14 @@ bi_get_state
|
|||||||
// if there is such a state, get it
|
// if there is such a state, get it
|
||||||
// @ts-ignore ts doesn't understand querying if a key exists
|
// @ts-ignore ts doesn't understand querying if a key exists
|
||||||
if (!!(gotten_state.jr_state)) {
|
if (!!(gotten_state.jr_state)) {
|
||||||
console.log('foo');
|
console.log('jr state exists');
|
||||||
// TS doesn't know we've proven the key exists and so therefore this is
|
// TS doesn't know we've proven the key exists and so therefore this is
|
||||||
// of type bis_state
|
// of type bis_state
|
||||||
return bi_s2i(gotten_state as bis_state);
|
return bi_s2i(gotten_state as bis_state);
|
||||||
}
|
}
|
||||||
// otherwise return default state
|
// otherwise return default state
|
||||||
else {
|
else {
|
||||||
console.log('bar');
|
console.log('jr no state... generating');
|
||||||
// set the state
|
// set the state
|
||||||
let default_i_state : bi_state = bi_state_default();
|
let default_i_state : bi_state = bi_state_default();
|
||||||
await bi_set_state(default_i_state);
|
await bi_set_state(default_i_state);
|
||||||
|
|||||||
Reference in New Issue
Block a user