-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Make implicit_provider
optional
#23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
fn can_provide_crypto(&self) -> Result<ProviderID> { | ||
match self.implicit_provider { | ||
ProviderID::Core => Err(Error::Client(ClientErrorKind::InvalidProvider)), | ||
_ => Ok(()), | ||
None => Err(Error::Client(ClientErrorKind::NoProvider)), | ||
Some(ProviderID::Core) => Err(Error::Client(ClientErrorKind::InvalidProvider)), | ||
Some(crypto_provider) => Ok(crypto_provider), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty nice!
src/core/basic_client.rs
Outdated
/// and it is the responsibility of the user to identify and set an appropriate | ||
/// one. As such, it is critical that before attempting to use cryptographic | ||
/// operations users call [`list_providers`](#method.list_providers) | ||
/// and [`list_provider_operations`](#method.list_provider_operations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not totally related with this PR but is there a reason why using list_provider_operations
instead of list_opcodes
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that sounded more developer-friendly to me at the time, but maybe the low-level one should be named consistently - I'll change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think so too.
This commit makes the `implicit_provider` optional, allowing the `BasicClient` to start with no such provider. When in this state, core operations are allowed but crypto operations will fail with `NoProvider`. Signed-off-by: Ionut Mihalcea <ionut.mihalcea@arm.com>
a87e0ff
to
734d3a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This commit makes the
implicit_provider
optional, allowing theBasicClient
to start with no such provider. When in this state, coreoperations are allowed but crypto operations will fail with
NoProvider
.Signed-off-by: Ionut Mihalcea ionut.mihalcea@arm.com