diff --git a/Sources/TorusUtils/TorusUtils.swift b/Sources/TorusUtils/TorusUtils.swift index 4c3ea98e..5fa7a6a2 100644 --- a/Sources/TorusUtils/TorusUtils.swift +++ b/Sources/TorusUtils/TorusUtils.swift @@ -63,6 +63,23 @@ open class TorusUtils: AbstractTorusUtils { idToken: String, extraParams: [String: Codable] = [:] ) async throws -> TorusKey { + let session = createURLSession() + var allowHostRequest = try makeUrlRequest(url: allowHost, httpMethod: .get) + allowHostRequest.addValue("torus-default", forHTTPHeaderField: "x-api-key") + allowHostRequest.addValue(verifier, forHTTPHeaderField: "origin") + allowHostRequest.addValue(verifier, forHTTPHeaderField: "verifier") + allowHostRequest.addValue(verifierParams.verifier_id, forHTTPHeaderField: "verifier_id") + allowHostRequest.addValue(verifierParams.verifier_id, forHTTPHeaderField: "verifierId") + allowHostRequest.addValue(clientId, forHTTPHeaderField: "clientId") + allowHostRequest.addValue(network.name, forHTTPHeaderField: "network") + allowHostRequest.addValue("true", forHTTPHeaderField: "enable_gating") + do { + _ = try await session.data(for: allowHostRequest) + } catch { + os_log("retrieveShares: signer allow: %@", log: getTorusLogger(log: TorusUtilsLogger.core, type: .error), type: .error, error.localizedDescription) + throw error + } + if isLegacyNetwork() { let result = try await legacyRetrieveShares(torusNodePubs: torusNodePubs, indexes: indexes, endpoints: endpoints, verifier: verifier, verifierId: verifierParams.verifier_id, idToken: idToken, extraParams: extraParams) return result