Skip to content

Commit

Permalink
make static for gettoken and rename signer
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Jul 11, 2024
1 parent ebd3234 commit 670dd98
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public final class AWSCognitoAuthPlugin: AWSCognitoAuthPluginBehavior {
}

extension AWSCognitoAuthPlugin {
public func getUserPoolAccessToken() async throws -> String {
public static func getUserPoolAccessToken() async throws -> String {
let authSession = try await Amplify.Auth.fetchAuthSession()
guard let tokenResult = getTokenString(from: authSession) else {
let error = AuthError.unknown("Did not receive a valid response from fetchAuthSession for get token.")
Expand All @@ -76,7 +76,7 @@ extension AWSCognitoAuthPlugin {
}
}

private func getTokenString(from authSession: AuthSession) -> Result<String, AuthError>? {
private static func getTokenString(from authSession: AuthSession) -> Result<String, AuthError>? {
if let result = (authSession as? AuthCognitoTokensProvider)?.getCognitoTokens() {
switch result {
case .success(let tokens):
Expand All @@ -96,11 +96,11 @@ import AwsCommonRuntimeKit // CommonRuntimeKit.initialize()

extension AWSCognitoAuthPlugin {

public static func sigV4SignedRequest(_ urlRequest: URLRequest,
region: Swift.String,
credentialsProvider: AWSClientRuntime.CredentialsProviding = AmplifyAWSCredentialsProvider(),
signingName: Swift.String = "appsync",
date: ClientRuntime.Date = Date()) async throws -> URLRequest {
public static func sigV4SignedAppSyncRequest(_ urlRequest: URLRequest,
region: Swift.String,
credentialsProvider: AWSClientRuntime.CredentialsProviding = AmplifyAWSCredentialsProvider(),
signingName: Swift.String = "appsync",
date: ClientRuntime.Date = Date()) async throws -> URLRequest {
let requestBuilder = try createAppSyncSdkHttpRequestBuilder(
urlRequest: urlRequest)
CommonRuntimeKit.initialize()
Expand Down

0 comments on commit 670dd98

Please sign in to comment.