Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(backend): Remove signing apis #2369

Merged
merged 12 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ k256 = "0.13"
lazy_static = "1.5.0"
pocket-ic = "2.2.0"
pretty_assertions = "1.4.0"
bitcoin = "0.32.2"
strum = "0.26.3"
strum_macros = "0.26.4"
2 changes: 1 addition & 1 deletion scripts/test.backend.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

POCKET_IC_SERVER_VERSION=3.0.1
OISY_UPGRADE_VERSIONS="v0.0.13,v0.0.19,v0.0.25"
OISY_UPGRADE_VERSIONS="v0.0.13,v0.0.19"

# If a backend wasm file exists at the root, it will be used for the tests.

Expand Down
1 change: 0 additions & 1 deletion src/backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"
crate-type = ["cdylib"]

[dependencies]
bitcoin = { workspace = true }
candid = { workspace = true }
ethers-core = { workspace = true }
futures = { workspace = true }
Expand Down
17 changes: 0 additions & 17 deletions src/backend/backend.did
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type AddUserCredentialRequest = record {
type ApiEnabled = variant { ReadOnly; Enabled; Disabled };
type Arg = variant { Upgrade; Init : InitArg };
type ArgumentValue = variant { Int : int32; String : text };
type BitcoinNetwork = variant { mainnet; regtest; testnet };
type CanisterStatusResultV2 = record {
controller : principal;
status : CanisterStatusType;
Expand Down Expand Up @@ -114,16 +113,6 @@ type Result = variant { Ok; Err : AddUserCredentialError };
type Result_1 = variant { Ok : UserProfile; Err : GetUserProfileError };
type Result_2 = variant { Ok : MigrationReport; Err : text };
type Result_3 = variant { Ok; Err : text };
type SignRequest = record {
to : text;
gas : nat;
value : nat;
max_priority_fee_per_gas : nat;
data : opt text;
max_fee_per_gas : nat;
chain_id : nat;
nonce : nat;
};
type Stats = record {
user_profile_count : nat64;
custom_token_count : nat64;
Expand Down Expand Up @@ -161,11 +150,8 @@ type UserTokenId = record { chain_id : nat64; contract_address : text };
service : (Arg) -> {
add_user_credential : (AddUserCredentialRequest) -> (Result);
bulk_up : (blob) -> ();
caller_btc_address : (BitcoinNetwork) -> (text);
caller_eth_address : () -> (text);
config : () -> (Config) query;
create_user_profile : () -> (UserProfile);
eth_address_of : (principal) -> (text);
get_canister_status : () -> (CanisterStatusResultV2);
get_user_profile : () -> (Result_1) query;
http_request : (HttpRequest) -> (HttpResponse) query;
Expand All @@ -175,15 +161,12 @@ service : (Arg) -> {
migrate_user_data_to : (principal) -> (Result_2);
migration : () -> (opt MigrationReport) query;
migration_stop_timer : () -> (Result_3);
personal_sign : (text) -> (text);
remove_user_token : (UserTokenId) -> ();
set_custom_token : (CustomToken) -> ();
set_guards : (Guards) -> ();
set_many_custom_tokens : (vec CustomToken) -> ();
set_many_user_tokens : (vec UserToken) -> ();
set_user_token : (UserToken) -> ();
sign_prehash : (text) -> (text);
sign_transaction : (SignRequest) -> (text);
stats : () -> (Stats) query;
step_migration : () -> ();
}
20 changes: 0 additions & 20 deletions src/backend/src/bitcoin_utils.rs

This file was deleted.

25 changes: 0 additions & 25 deletions src/backend/src/guards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,3 @@ pub fn may_read_user_data() -> Result<(), String> {
Err("User data cannot be read at this time due to a migration.".to_string())
}
}

/// Is getting threshold public keys is enabled?
pub fn may_read_threshold_keys() -> Result<(), String> {
caller_is_not_anonymous()?;
if read_config(|s| s.api.unwrap_or_default().threshold_key.readable()) {
Ok(())
} else {
Err("Reading threshold keys is disabled.".to_string())
}
}
/// Caller is allowed AND reading threshold keys is enabled.
pub fn caller_is_allowed_and_may_read_threshold_keys() -> Result<(), String> {
caller_is_allowed()?;
may_read_threshold_keys()
}

/// Is signing with threshold keys is enabled?
pub fn may_threshold_sign() -> Result<(), String> {
caller_is_not_anonymous()?;
if read_config(|s| s.api.unwrap_or_default().threshold_key.writable()) {
Ok(())
} else {
Err("Threshold signing is disabled.".to_string())
}
}
Loading