Skip to main content

Module crypto

Module crypto 

Source
Expand description

Implementations of Crypto Cheatcodes.

Re-exportsΒ§

use crate::Cheatcode; πŸ”’
use crate::CheatcodesCore; πŸ”’
use crate::Error; πŸ”’
use crate::Result; πŸ”’
use alloy_primitives::Address; πŸ”’
use alloy_primitives::B256; πŸ”’
use alloy_primitives::U256; πŸ”’
use alloy_primitives::keccak256; πŸ”’
use alloy_signer::Signer; πŸ”’
use alloy_signer::SignerSync; πŸ”’
use alloy_signer_local::MnemonicBuilder; πŸ”’
use alloy_signer_local::PrivateKeySigner; πŸ”’
use alloy_signer_local::coins_bip39::ChineseSimplified; πŸ”’
use alloy_signer_local::coins_bip39::ChineseTraditional; πŸ”’
use alloy_signer_local::coins_bip39::Czech; πŸ”’
use alloy_signer_local::coins_bip39::English; πŸ”’
use alloy_signer_local::coins_bip39::French; πŸ”’
use alloy_signer_local::coins_bip39::Italian; πŸ”’
use alloy_signer_local::coins_bip39::Japanese; πŸ”’
use alloy_signer_local::coins_bip39::Korean; πŸ”’
use alloy_signer_local::coins_bip39::Portuguese; πŸ”’
use alloy_signer_local::coins_bip39::Spanish; πŸ”’
use alloy_signer_local::coins_bip39::Wordlist; πŸ”’
use alloy_sol_types::SolValue; πŸ”’
use foundry_common::tempo::configurable_account; πŸ”’
use foundry_common::tempo::configurable_account::p256_public_key; πŸ”’
use foundry_common::tempo::configurable_account::quorum; πŸ”’
use foundry_common::tempo::configurable_account::sign_p256_low_s; πŸ”’
use foundry_common::wallet::derive_private_key; πŸ”’
use foundry_common::wallet::derive_private_key_with_language; πŸ”’
use k256::AffinePoint; πŸ”’
use k256::EncodedPoint; πŸ”’
use k256::FieldBytes; πŸ”’
use k256::FieldElement; πŸ”’
use k256::ProjectivePoint; πŸ”’
use k256::Scalar; πŸ”’
use k256::ecdsa::SigningKey; πŸ”’
use k256::ecdsa::hazmat; πŸ”’
use k256::elliptic_curve::bigint::ArrayEncoding; πŸ”’
use k256::elliptic_curve::bigint::U256 as K256U256; πŸ”’
use k256::elliptic_curve::group::Group; πŸ”’
use k256::elliptic_curve::ops::Reduce; πŸ”’
use k256::elliptic_curve::sec1::FromEncodedPoint; πŸ”’
use k256::elliptic_curve::sec1::ToEncodedPoint; πŸ”’
use p256::ecdsa::SigningKey as P256SigningKey; πŸ”’
use base64::Engine; πŸ”’
use base64::engine::general_purpose::URL_SAFE_NO_PAD; πŸ”’
use ed25519_consensus::Signature as Ed25519Signature; πŸ”’
use ed25519_consensus::SigningKey as Ed25519SigningKey; πŸ”’
use ed25519_consensus::VerificationKey as Ed25519VerificationKey; πŸ”’
use sha2::Digest; πŸ”’
use sha2::Sha256; πŸ”’
use std::collections::BTreeMap; πŸ”’
use tempo_primitives::transaction::ConfigurableAccountConfig as TempoAccountConfig; πŸ”’
use tempo_primitives::transaction::ConfigurableAccountOwner as TempoAccountOwner; πŸ”’
use tempo_primitives::transaction::ConfigurableAccountSignature; πŸ”’
use tempo_primitives::transaction::KeychainSignature; πŸ”’
use tempo_primitives::transaction::MAX_CONFIGURABLE_ACCOUNT_SIGNATURES; πŸ”’
use tempo_primitives::transaction::PrimitiveSignature; πŸ”’
use tempo_primitives::transaction::TempoSignature; πŸ”’
use tempo_primitives::transaction::configurable_account_digest; πŸ”’
use tempo_primitives::transaction::tt_signature::WebAuthnSignature; πŸ”’
use tempo_primitives::transaction::tt_signature::derive_p256_address; πŸ”’
use crate::Vm::*; πŸ”’

ConstantsΒ§

DEFAULT_DERIVATION_PATH_PREFIX πŸ”’
The BIP32 default derivation path prefix.
PRIVATE_KEY_SIGNER_CACHE_LIMIT πŸ”’

FunctionsΒ§

create_ed25519_key πŸ”’
create_wallet πŸ”’
Using a given private key, return its public ETH address, its public key affine x and y coordinates, and its private key (see the β€˜Wallet’ struct)
derive_key πŸ”’
derive_key_str πŸ”’
derive_wallets πŸ”’
derive_wallets_str πŸ”’
encode_affine_point πŸ”’
encode_compact_sig πŸ”’
encode_full_sig πŸ”’
encode_projective_point πŸ”’
inject_wallet πŸ”’
owner_key_address πŸ”’
Returns the owner address of key.
parse_affine_point πŸ”’
parse_field_element πŸ”’
parse_private_key πŸ”’
parse_private_key_p256 πŸ”’
parse_projective_point πŸ”’
parse_signing_key_ed25519 πŸ”’
parse_wallet πŸ”’
public_key_ed25519 πŸ”’
reduce_ec_scalar πŸ”’
sign πŸ”’
sign_cached πŸ”’
sign_configurable_account πŸ”’
Signs inner as the configurable account account with the fewest of keys that form a quorum the node accepts: at most 8 approvals, sorted by owner, the last of which reaches the threshold.
sign_ed25519 πŸ”’
sign_keychain πŸ”’
sign_owner_approval πŸ”’
Signs digest with an owner key as a Tempo primitive signature.
sign_p256 πŸ”’
sign_with_nonce πŸ”’
Signs digest on secp256k1 using a user-supplied ephemeral nonce k (no RFC6979).
sign_with_wallet πŸ”’
tempo_account_config πŸ”’
Converts a cheatcode configurable account config to Tempo’s.
validate_private_key πŸ”’
verify_ed25519 πŸ”’
with_private_key_signer πŸ”’