Skip to content

Commit

Permalink
fix auth request
Browse files Browse the repository at this point in the history
  • Loading branch information
llbartekll committed Dec 1, 2023
1 parent 8083877 commit 52fa7b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Auth/AuthDecryptionService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ public class AuthDecryptionService {
public func decryptAuthRequest(topic: String, ciphertext: String) throws -> AuthRequest {
let (rpcRequest, _, _): (RPCRequest, String?, Data) = try serializer.deserialize(topic: topic, encodedEnvelope: ciphertext)
setPairingMetadata(rpcRequest: rpcRequest, topic: topic)
if let request = try rpcRequest.params?.get(AuthRequest.self) {
return request
if let params = try rpcRequest.params?.get(AuthRequestParams.self),
let id = rpcRequest.id {
let authRequest = AuthRequest(id: id, topic: topic, payload: params.payloadParams, requester: params.requester.metadata)
return authRequest
} else {
throw Errors.couldNotDecodeTypeFromCiphertext
}
Expand Down

0 comments on commit 52fa7b8

Please sign in to comment.