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

Feat/os keychain followup #1770

Open
wants to merge 8 commits into
base: feat/os_keychain
Choose a base branch
from

Conversation

elizabethengelman
Copy link
Contributor

@elizabethengelman elizabethengelman commented Dec 2, 2024

What

This PR is based on #1703 and adds some additional compatibility with the secure store like keys rm and keys add.

  • keys rm
  • keys add
  • manual test on Mac OS
    • add the key: cargo run keys add --secure-store --entry-name alice alice
    • make sure we can get the address from the new key: cargo run keys address alice
    • make sure we can sign & send with the new key:
        stello contract deploy --wasm target/test-wasms/hello_world.wasm  --build-only --network testnet --source alice | \
        stello tx simulate --network testnet --source alice | \
        stello tx sign --network testnet --sign-with-key alice | \
        stello tx send --network testnet
    
    • remove the key: stello keys rm alice
    • make sure it is no longer in the list or the keychain
  • manual test on Linux
    • add the key: cargo run keys add --secure-store --entry-name alice alice
    • make sure we can get the address from the new key: cargo run keys address alice
    • make sure we can sign & send with the new key:
        stello contract deploy --wasm target/test-wasms/hello_world.wasm  --build-only --network testnet --source alice | \
        stello tx simulate --network testnet --source alice | \
        stello tx sign --network testnet --sign-with-key alice | \
        stello tx send --network testnet
    
    • remove the key: stello keys rm alice
    • make sure it is no longer in the list or the keychain
  • manual test on Windows
    • add the key: cargo run keys add --secure-store --entry-name alice alice
    • make sure we can get the address from the new key: cargo run keys address alice
    • make sure we can sign & send with the new key:
        stello contract deploy --wasm target/test-wasms/hello_world.wasm  --build-only --network testnet --source alice | \
        stello tx simulate --network testnet --source alice | \
        stello tx sign --network testnet --sign-with-key alice | \
        stello tx send --network testnet
    
    • remove the key: stello keys rm alice
    • make sure it is no longer in the list or the keychain

Why

I wanted to keep #1703 from getting too big so it was easier to review.

Known limitations

[TODO or N/A]

@elizabethengelman elizabethengelman force-pushed the feat/os-keychain-followup branch 2 times, most recently from 244508d to a97ccbb Compare December 2, 2024 20:59
@elizabethengelman elizabethengelman force-pushed the feat/os-keychain-followup branch 3 times, most recently from df3543a to 3311a50 Compare December 3, 2024 17:18
@elizabethengelman elizabethengelman force-pushed the feat/os-keychain-followup branch 4 times, most recently from c39bf60 to fe02078 Compare December 6, 2024 16:19
@elizabethengelman elizabethengelman marked this pull request as ready for review December 6, 2024 16:58
let entry = StellarEntry::new(&entry_name)?;
match entry.delete_password() {
Ok(()) => {}
Err(e) if e.to_string() == keyring::Error::NoEntry.to_string() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Err(e) if e.to_string() == keyring::Error::NoEntry.to_string() => {
Err(keyring::Error::NoEntry) => {

Is e equal to the the error? Does this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this line is a bit weird, thanks for reminding me! The thing I was running into is that e an error wrapped in custom errors twice, if that makes sense => locator::Error -> signer::keyring::Error -> keyring::Error. So, matching directly on keyring::Error::NoEntry wasn't working.

I just pushed up an update so we're not comparing the error strings. Lmk what you think!

@elizabethengelman elizabethengelman force-pushed the feat/os-keychain-followup branch from c0bfc66 to f4e2913 Compare December 12, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog (Not Ready)
Development

Successfully merging this pull request may close these issues.

2 participants