Skip to content

Commit

Permalink
Add derived key param to more api (#63)
Browse files Browse the repository at this point in the history
* feat: add biometric to more api

* feat: remove password required in backup

* fix: remove dbg!
  • Loading branch information
XuNeal authored Feb 21, 2024
1 parent 4accb41 commit aef7b9e
Show file tree
Hide file tree
Showing 20 changed files with 1,012 additions and 743 deletions.
1 change: 0 additions & 1 deletion token-core/tcx-btc-kin/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,6 @@ mod tests {
}

mod ltc {
//todo: test error
use super::*;

#[test]
Expand Down
1 change: 1 addition & 0 deletions token-core/tcx-crypto/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ impl Crypto {
fn derive_key(&self, password: &str) -> Result<Vec<u8>> {
let mut derived_key: Credential = [0u8; CREDENTIAL_LEN];
self.kdf.derive_key(password.as_bytes(), &mut derived_key);

Ok(derived_key.to_vec())
}

Expand Down
88 changes: 0 additions & 88 deletions token-core/tcx-eth/src/api.rs

This file was deleted.

12 changes: 6 additions & 6 deletions token-core/tcx-eth/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pub mod address;
pub mod signer;
pub mod transaction;
pub mod transaction_types;

pub mod api;
pub mod transaction;

use core::result;

Expand All @@ -14,8 +14,8 @@ pub mod ethereum {
pub const CHAINS: [&str; 1] = ["ETHEREUM"];

pub type Address = EthAddress;
pub type TransactionInput = crate::api::EthTxInput;
pub type TransactionOutput = crate::api::EthTxOutput;
pub type MessageInput = crate::api::EthMessageInput;
pub type MessageOutput = crate::api::EthMessageOutput;
pub type TransactionInput = crate::transaction::EthTxInput;
pub type TransactionOutput = crate::transaction::EthTxOutput;
pub type MessageInput = crate::transaction::EthMessageInput;
pub type MessageOutput = crate::transaction::EthMessageOutput;
}
10 changes: 5 additions & 5 deletions token-core/tcx-eth/src/signer.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::address::pubkey_to_address;
use crate::api::{
use crate::transaction::{
EthMessageInput, EthMessageOutput, EthRecoverAddressInput, EthRecoverAddressOutput, EthTxInput,
EthTxOutput, SignatureType,
};
use crate::transaction::{Signature, Transaction, TransactionType};
use crate::transaction_types::{Signature, Transaction, TransactionType};
use crate::Result;
use ethereum_types::{Address, H256};
use std::str::FromStr;
Expand Down Expand Up @@ -82,7 +82,7 @@ impl TryFrom<&EthTxInput> for Transaction {
}

impl EthTxInput {
pub fn access_list(&self) -> Result<crate::transaction::AccessList> {
pub fn access_list(&self) -> Result<crate::transaction_types::AccessList> {
let mut ret_access_list = vec![];

for item in &self.access_list {
Expand All @@ -91,7 +91,7 @@ impl EthTxInput {
storage_keys.push(H256::from_str(key)?);
}

ret_access_list.push(crate::transaction::AccessListItem {
ret_access_list.push(crate::transaction_types::AccessListItem {
address: Address::from_slice(&Vec::from_0x_hex(&item.address)?),
storage_keys,
});
Expand Down Expand Up @@ -128,7 +128,7 @@ impl EthRecoverAddressInput {

#[cfg(test)]
mod test {
use crate::api::{
use crate::transaction::{
AccessList, EthMessageInput, EthMessageOutput, EthRecoverAddressInput, EthTxInput,
EthTxOutput, SignatureType,
};
Expand Down
Loading

0 comments on commit aef7b9e

Please sign in to comment.