jr: popup now shows list of keypairs
generate button does not work, that's the next task
This commit is contained in:
@@ -60,11 +60,13 @@ import * as vdk_binary from './jex_include/local-vdk_binary-0.1.0/dist/vdk_bina
|
||||
export type {
|
||||
// global types
|
||||
// popup script call/return data
|
||||
p_data
|
||||
};
|
||||
|
||||
|
||||
export {
|
||||
// popup script api
|
||||
p_get_data,
|
||||
// background script api
|
||||
b_main
|
||||
};
|
||||
@@ -92,6 +94,12 @@ let TX_SIGN_TIMEOUT = 30*GB_MIN;
|
||||
//=============================================================================
|
||||
//=============================================================================
|
||||
|
||||
/**
|
||||
* data that is displayed in the popup window
|
||||
*/
|
||||
type p_data =
|
||||
{pubkey_ak_strs : Array<string>};
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//=============================================================================
|
||||
@@ -99,6 +107,37 @@ let TX_SIGN_TIMEOUT = 30*GB_MIN;
|
||||
//=============================================================================
|
||||
//=============================================================================
|
||||
|
||||
/**
|
||||
* Called by the popup script to get the data it's supposed to show
|
||||
*/
|
||||
async function
|
||||
p_get_data
|
||||
()
|
||||
: Promise<p_data>
|
||||
{
|
||||
console.log('popup p_data');
|
||||
|
||||
// type bi_state
|
||||
// = {keypairs: Array<bi_nacl_keypair>};
|
||||
// type bi_nacl_keypair
|
||||
// = {secretKey : Uint8Array,
|
||||
// publicKey : Uint8Array};
|
||||
let jr_state : bi_state = await bi_get_state();
|
||||
|
||||
// accumulator
|
||||
let akstrs : Array<string> = [];
|
||||
|
||||
for (let this_keypair of jr_state.keypairs) {
|
||||
let this_pubkey : Uint8Array = this_keypair.publicKey;
|
||||
let this_ak_str : string = await vdk_aeser.pubkey2ak_str(this_pubkey);
|
||||
akstrs.push(this_ak_str);
|
||||
}
|
||||
|
||||
// type p_data =
|
||||
// {pubkey_ak_strs : Array<string>};
|
||||
return {pubkey_ak_strs: akstrs};
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//=============================================================================
|
||||
|
||||
Reference in New Issue
Block a user