Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
61ab749
Add keys integration tests
elizabethengelman Mar 27, 2025
64ccc1a
Test creating a new account and signing with secure store key
elizabethengelman Apr 1, 2025
74fb8a3
WIP: create a StellarEntry::new impl for ledger-tests
elizabethengelman Apr 1, 2025
b8a4dd3
Use Secret's signer fn to get the signer
elizabethengelman Apr 1, 2025
22000ff
Update secure store integration test
elizabethengelman Apr 1, 2025
36b542a
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 1, 2025
4ef50ea
Clippy
elizabethengelman Apr 1, 2025
68b6905
Cargo fmt
elizabethengelman Apr 1, 2025
e281147
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 2, 2025
8579eb1
Fix feature name for secure store tests
elizabethengelman Apr 3, 2025
acfa969
Move secure store create_account test and put behind feature
elizabethengelman Apr 3, 2025
8b21b94
Move key it tests that use secure store to secure store test
elizabethengelman Apr 3, 2025
917f129
Move secure store tests
elizabethengelman Apr 8, 2025
1c468de
Cargo fmt:
elizabethengelman Apr 9, 2025
d7348b9
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 9, 2025
19985d5
Cleanup
elizabethengelman Apr 10, 2025
9e69263
Add secure-store-tests to makefile e2e-test
elizabethengelman Apr 10, 2025
b02383b
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 11, 2025
ae9ecd5
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 14, 2025
e0d0add
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 15, 2025
99079e6
Remove secure-store-tests feature, and mocked credential impl
elizabethengelman Apr 17, 2025
bffcb5b
Remove unused fns
elizabethengelman Apr 17, 2025
cfb9738
Small tweak to secure store it test
elizabethengelman Apr 21, 2025
7bf14df
Fix
elizabethengelman Apr 21, 2025
96ff9af
Install gnome-keyring for linux it tests
elizabethengelman Apr 21, 2025
51fa225
Move secure store tests to integration
elizabethengelman Apr 21, 2025
b1aefe4
Move gnome-keyring install to rpc-tests workflow
elizabethengelman Apr 21, 2025
eb12792
Start dbus and gnome-keyring for linux integration tests
elizabethengelman Apr 22, 2025
e98dab5
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 22, 2025
cd0a575
Enable additional-libs for rpc-tests
elizabethengelman Apr 22, 2025
3322074
fixup! Start dbus and gnome-keyring for linux integration tests
elizabethengelman Apr 22, 2025
d2c7da0
Temporarily comment out excluding other os in rpc-tests
elizabethengelman Apr 22, 2025
ab9ecc6
Update starting gnome-keyring for linux integration tests
elizabethengelman Apr 22, 2025
6b288a4
Add exclude back in so that only Linux x64 is run on pull requests
elizabethengelman Apr 23, 2025
7a505b4
Tweak rpc-tests.yml
elizabethengelman Apr 23, 2025
8f759e6
Merge branch 'main' into fix/secure-storage-signing
elizabethengelman Apr 28, 2025
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
15 changes: 13 additions & 2 deletions .github/workflows/rpc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,20 @@ jobs:
- uses: actions/checkout@v4
- uses: stellar/actions/rust-cache@main
- run: rustup update
- run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev
- run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev gnome-keyring
if: runner.os == 'Linux'
- run: cargo build
- name: Start gnome-keyring
if: runner.os == 'Linux'
# run gnome-keyring with 'foobar' as password for the login keyring
# this will create a new login keyring and unlock it
# the login password doesn't matter, but the keyring must be unlocked for the tests to work
# this is based on the ci workflow in the keyring crate repo
run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'
- name: Check GNOME Keyring
if: runner.os == 'Linux'
run: |
gnome-keyring-daemon
- run: cargo build --features additional-libs
- run: rustup target add wasm32-unknown-unknown
- run: make build-test-wasms
- run: SOROBAN_PORT=8000 cargo test --features it --package soroban-test --test it -- integration --test-threads=1
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ default = []
it = []
emulator-tests = ["stellar-ledger/emulator-tests"]
version_lt_23 = []
version_gte_23 = []
version_gte_23 = []
1 change: 1 addition & 0 deletions cmd/crates/soroban-test/tests/it/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod dotenv;
mod hello_world;
mod init;
mod keys;
mod secure_store;
mod snapshot;
mod tx;
mod util;
Expand Down
17 changes: 17 additions & 0 deletions cmd/crates/soroban-test/tests/it/integration/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ async fn fund() {
.success();
}

#[tokio::test]
async fn secret() {
let sandbox = &TestEnv::new();
sandbox
.new_assert_cmd("keys")
.arg("generate")
.arg("test2")
.assert()
.success();
sandbox
.new_assert_cmd("keys")
.arg("secret")
.arg("test2")
.assert()
.success();
}

#[tokio::test]
#[allow(clippy::too_many_lines)]
async fn overwrite_identity() {
Expand Down
98 changes: 98 additions & 0 deletions cmd/crates/soroban-test/tests/it/integration/secure_store.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
use predicates::prelude::predicate;
use soroban_cli::tx::ONE_XLM;
use soroban_test::{AssertExt, TestEnv};

fn secure_store_key(sandbox: &TestEnv, name: &str) -> String {
sandbox
.new_assert_cmd("keys")
.args(["generate", "--fund", "--secure-store", name])
.assert()
.success()
.stdout_as_str();

sandbox
.new_assert_cmd("keys")
.args(["address", name])
.assert()
.success()
.stdout_as_str()
}

// test that we can create a create-account tx and sign it with a secure-store key
#[tokio::test]
async fn create_account() {
let sandbox = &TestEnv::new();
let secure_store_address = secure_store_key(sandbox, "secure-store");

sandbox
.new_assert_cmd("keys")
.args(["generate", "--no-fund", "new"])
.assert()
.success();
let new_address = sandbox
.new_assert_cmd("keys")
.args(["address", "new"])
.assert()
.success()
.stdout_as_str();

let client = sandbox.network.rpc_client().unwrap();
let secure_account = client.get_account(&secure_store_address).await.unwrap();

let starting_balance = ONE_XLM * 100;
sandbox
.new_assert_cmd("tx")
.args([
"new",
"create-account",
"--destination",
new_address.as_str(),
"--starting-balance",
starting_balance.to_string().as_str(),
"--source",
"secure-store",
])
.assert()
.success()
.stdout_as_str();

let secure_account_after = client.get_account(&secure_store_address).await.unwrap();
assert!(secure_account_after.balance < secure_account.balance);

let new_account = client.get_account(&new_address).await.unwrap();
assert_eq!(new_account.balance, starting_balance);
}

#[tokio::test]
async fn get_secret_key() {
let sandbox = &TestEnv::new();
sandbox
.new_assert_cmd("keys")
.args(["generate", "secret-key-test", "--secure-store"])
.assert()
.success();
sandbox
.new_assert_cmd("keys")
.arg("secret")
.arg("secret-key-test")
.assert()
.stderr(predicate::str::contains("does not reveal secret key"))
.failure();
}

#[tokio::test]
async fn public_key_with_secure_store() {
let sandbox = &TestEnv::new();
sandbox
.new_assert_cmd("keys")
.args(["generate", "public-key-test", "--secure-store"])
.assert()
.success();
sandbox
.new_assert_cmd("keys")
.arg("public-key")
.arg("public-key-test")
.assert()
.stdout(predicate::str::contains("G"))
.success();
}
10 changes: 4 additions & 6 deletions cmd/soroban-cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{

use crate::{
print::Print,
signer::{self, LocalKey, Signer, SignerKind},
signer,
xdr::{self, SequenceNumber, Transaction, TransactionEnvelope},
Pwd,
};
Expand Down Expand Up @@ -89,12 +89,10 @@ impl Args {

#[allow(clippy::unused_async)]
pub async fn sign(&self, tx: Transaction) -> Result<TransactionEnvelope, Error> {
let key = self.key_pair()?;
let key = &self.source_account.resolve_secret(&self.locator)?;
let signer = key.signer(self.hd_path, Print::new(false)).await?;
let network = &self.get_network()?;
let signer = Signer {
kind: SignerKind::Local(LocalKey { key }),
print: Print::new(false),
};

Ok(signer.sign_tx(tx, network).await?)
}

Expand Down
Loading