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: Expose account keys #144

Merged
merged 2 commits into from
Jul 12, 2022
Merged

chore: Expose account keys #144

merged 2 commits into from
Jul 12, 2022

Conversation

ChaoticTempest
Copy link
Member

Addresses #142

Exposes the account keys. Might be a little weird that it's exposed just as a SecretKey type instead of something like a KeyPair type. This is due to SecretKey being a KeyPair itself containing the PublicKey. WDYT? Is the return type good enough just as SecretKey or should we do something like (PublicKey, SecretKey)?

/// Get the keys of this account. The public key can be retrieved from the secret key.
pub fn keys(&self) -> SecretKey {
SecretKey(self.signer.0.secret_key.clone())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is fine to only return SecretKey, but I would argue that keys is not a good name in this case because of plurality. Maybe just key or secret_key while leaving the clarification that public key can be retrieved from the secret key?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, noting it's probably best if we keep this representation internally, and then this method can return &SecretKey. Cloning implicitly feels weird

Copy link
Member Author

Choose a reason for hiding this comment

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

Gotcha, I'll re-work how InMemorySigner is represented internally but shouldn't be too big of a deal to expose it as a &SecretKey

Copy link
Member Author

Choose a reason for hiding this comment

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

alright should be good. Ready to be re-reviewed whenever you guys get the chance

Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

Not completely sure how this Signer type. I suppose it has to do with creating TLAs? Maybe you can clarify how you plan to fit this in cleanly?

@ChaoticTempest
Copy link
Member Author

Not completely sure how this Signer type.

Reading in between the lines, but I'm guessing you meant to say how does the Signer type work? Signer is mainly used to sign transactions and hold keys, but good catch since this detail doesn't necessarily need to be exposed to the user. I'll make a ticket to evaluate if we can clean this up in another PR

@ChaoticTempest ChaoticTempest merged commit 2c82743 into main Jul 12, 2022
@ChaoticTempest ChaoticTempest deleted the chore/expose-account-keys branch July 12, 2022 22:29
@frol frol mentioned this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants