Skip to content

Commit

Permalink
feat: Upgrade to firebolt 1.1.0 (#565)
Browse files Browse the repository at this point in the history
* feat: Upgrade to firebolt 1.1.0

* fix: challengeResponse not parsing parameters. challengeError not being registered

* fix: challengeResponse not parsing parameters. challengeError not being registered
  • Loading branch information
kpears201 authored Jul 12, 2024
1 parent 0d6e888 commit af98bb5
Show file tree
Hide file tree
Showing 3 changed files with 1,551 additions and 481 deletions.
20 changes: 16 additions & 4 deletions core/main/src/firebolt/handlers/provider_registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use ripple_sdk::{
fb_openrpc::FireboltOpenRpcMethod,
fb_pin::PinChallengeResponse,
provider::{
ChallengeResponse, ExternalProviderResponse, FocusRequest, ProviderResponse,
ProviderResponsePayload, ProviderResponsePayloadType,
ChallengeResponse, ExternalProviderError, ExternalProviderResponse, FocusRequest,
ProviderResponse, ProviderResponsePayload, ProviderResponsePayloadType,
},
},
gateway::rpc_gateway_api::CallContext,
Expand All @@ -58,6 +58,7 @@ impl ProviderRegistrar {
payload_type: ProviderResponsePayloadType,
mut params_sequence: ParamsSequence,
) -> Option<ProviderResponse> {
let _: Option<CallContext> = params_sequence.next().ok(); // ignore CallContext
match payload_type {
ProviderResponsePayloadType::ChallengeResponse => {
let external_provider_response: Result<
Expand Down Expand Up @@ -85,6 +86,17 @@ impl ProviderRegistrar {
});
}
}
ProviderResponsePayloadType::ChallengeError => {
let external_provider_error: Result<ExternalProviderError, CallError> =
params_sequence.next();

if let Ok(r) = external_provider_error {
return Some(ProviderResponse {
correlation_id: r.correlation_id,
result: ProviderResponsePayload::ChallengeError(r.error),
});
}
}
_ => error!("get_provider_response: Unsupported payload type"),
}

Expand Down Expand Up @@ -190,8 +202,8 @@ impl ProviderRegistrar {

// Register error function
if let Some(method) = provider_set.error.clone() {
let error_method = method.name.clone().leak();

let error_method =
FireboltOpenRpcMethod::name_with_lowercase_module(&method.name).leak();
rpc_module
.register_async_method(
error_method,
Expand Down
Loading

0 comments on commit af98bb5

Please sign in to comment.