separate list of emojis for wallet into ts and rs files, added display_pazzle

pull/19/head
Niko 1 year ago
parent 9edfe806a5
commit 8cc441cb87
  1. 1
      Cargo.lock
  2. 1723
      ng-app/src/routes/Grid.svelte
  3. 1736
      ng-app/src/wallet_emojis.ts
  4. 1
      ng-wallet/Cargo.toml
  5. 1226
      ng-wallet/src/emojis.rs
  6. 30
      ng-wallet/src/lib.rs

1
Cargo.lock generated

@ -2535,6 +2535,7 @@ dependencies = [
"debug_print", "debug_print",
"getrandom 0.1.16", "getrandom 0.1.16",
"image", "image",
"lazy_static",
"p2p-net", "p2p-net",
"p2p-repo", "p2p-repo",
"rand 0.7.3", "rand 0.7.3",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -27,3 +27,4 @@ aes-gcm-siv = {version = "0.11.1", features = ["aes","heapless","getrandom","std
base64-url = "2.0.0" base64-url = "2.0.0"
async-std = { version = "1.12.0", features = ["attributes","unstable"] } async-std = { version = "1.12.0", features = ["attributes","unstable"] }
web-time = "0.2.0" web-time = "0.2.0"
lazy_static = "1.4.0"

File diff suppressed because it is too large Load Diff

@ -11,6 +11,8 @@
// extern crate slice_as_array; // extern crate slice_as_array;
#[macro_use] #[macro_use]
extern crate p2p_net; extern crate p2p_net;
#[macro_use]
extern crate lazy_static;
use p2p_net::log; use p2p_net::log;
@ -18,6 +20,8 @@ pub mod types;
pub mod bip39; pub mod bip39;
pub mod emojis;
use std::io::Cursor; use std::io::Cursor;
use crate::bip39::bip39_wordlist; use crate::bip39::bip39_wordlist;
@ -261,13 +265,23 @@ pub fn display_mnemonic(mnemonic: &[u16; 12]) -> Vec<String> {
res res
} }
pub fn display_pazzle(pazzle: Vec<u8>) -> Vec<String> { use crate::emojis::{EMOJIS, EMOJI_CAT};
// let res: Vec<String> = pazzle
// .into_iter() pub fn display_pazzle(pazzle: &Vec<u8>) -> Vec<String> {
// .map(|i| String::from(bip39_wordlist[*i as usize])) let res: Vec<String> = pazzle
// .collect(); .into_iter()
// res .map(|i| {
unimplemented!(); let cat = i >> 4;
let idx = i & 15;
let cat_str = EMOJI_CAT[cat as usize];
String::from(format!(
"{}:{}",
cat_str,
EMOJIS.get(cat_str).unwrap()[idx as usize].code
))
})
.collect();
res
} }
pub fn gen_shuffle_for_pazzle_opening(pazzle_length: u8) -> ShuffledPazzle { pub fn gen_shuffle_for_pazzle_opening(pazzle_length: u8) -> ShuffledPazzle {
@ -584,7 +598,7 @@ mod tests {
"wallet id: {:?}", "wallet id: {:?}",
base64_url::encode(&res.wallet.id().slice()) base64_url::encode(&res.wallet.id().slice())
); );
log!("pazzle {:?}", res.pazzle); log!("pazzle {:?}", display_pazzle(&res.pazzle));
log!("mnemonic {:?}", display_mnemonic(&res.mnemonic)); log!("mnemonic {:?}", display_mnemonic(&res.mnemonic));
log!("pin {:?}", pin); log!("pin {:?}", pin);

Loading…
Cancel
Save