diff --git a/android/build.gradle b/android/build.gradle index 7ee3956..dd68ce8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -77,5 +77,5 @@ dependencies { implementation "androidx.browser:browser:1.2.0" - implementation("com.authsignal:authsignal-android:1.1.2") + implementation("com.authsignal:authsignal-android:2.0.1") } diff --git a/android/src/main/java/com/authsignal/react/AuthsignalEmailModule.kt b/android/src/main/java/com/authsignal/react/AuthsignalEmailModule.kt index 3561be2..895a18b 100644 --- a/android/src/main/java/com/authsignal/react/AuthsignalEmailModule.kt +++ b/android/src/main/java/com/authsignal/react/AuthsignalEmailModule.kt @@ -49,7 +49,7 @@ class AuthsignalEmailModule(private val reactContext: ReactApplicationContext) : val response = it.enroll(email) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -67,7 +67,7 @@ class AuthsignalEmailModule(private val reactContext: ReactApplicationContext) : val response = it.challenge() if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -85,7 +85,7 @@ class AuthsignalEmailModule(private val reactContext: ReactApplicationContext) : val response = it.verify(code) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { diff --git a/android/src/main/java/com/authsignal/react/AuthsignalPasskeyModule.kt b/android/src/main/java/com/authsignal/react/AuthsignalPasskeyModule.kt index d15e445..3ddb841 100644 --- a/android/src/main/java/com/authsignal/react/AuthsignalPasskeyModule.kt +++ b/android/src/main/java/com/authsignal/react/AuthsignalPasskeyModule.kt @@ -45,7 +45,7 @@ class AuthsignalPasskeyModule(private val reactContext: ReactApplicationContext) val response = it.signUp(token, username, displayName) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -63,7 +63,7 @@ class AuthsignalPasskeyModule(private val reactContext: ReactApplicationContext) val response = it.signIn(action, token) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { diff --git a/android/src/main/java/com/authsignal/react/AuthsignalPushModule.kt b/android/src/main/java/com/authsignal/react/AuthsignalPushModule.kt index 2c99d74..d020da0 100644 --- a/android/src/main/java/com/authsignal/react/AuthsignalPushModule.kt +++ b/android/src/main/java/com/authsignal/react/AuthsignalPushModule.kt @@ -43,7 +43,7 @@ class AuthsignalPushModule(private val reactContext: ReactApplicationContext) : val response = it.getCredential() if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -66,7 +66,7 @@ class AuthsignalPushModule(private val reactContext: ReactApplicationContext) : val response = it.addCredential(token, null) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -81,7 +81,7 @@ class AuthsignalPushModule(private val reactContext: ReactApplicationContext) : val response = it.removeCredential() if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -96,7 +96,7 @@ class AuthsignalPushModule(private val reactContext: ReactApplicationContext) : val response = it.getChallenge() if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -129,7 +129,7 @@ class AuthsignalPushModule(private val reactContext: ReactApplicationContext) : val response = it.updateChallenge(challengeId, approved, verificationCode) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { diff --git a/android/src/main/java/com/authsignal/react/AuthsignalSMSModule.kt b/android/src/main/java/com/authsignal/react/AuthsignalSMSModule.kt index e808609..5fd481d 100644 --- a/android/src/main/java/com/authsignal/react/AuthsignalSMSModule.kt +++ b/android/src/main/java/com/authsignal/react/AuthsignalSMSModule.kt @@ -53,7 +53,7 @@ class AuthsignalSMSModule(private val reactContext: ReactApplicationContext) : val response = it.enroll(phoneNumber) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -71,7 +71,7 @@ class AuthsignalSMSModule(private val reactContext: ReactApplicationContext) : val response = it.challenge() if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -89,7 +89,7 @@ class AuthsignalSMSModule(private val reactContext: ReactApplicationContext) : val response = it.verify(code) if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { diff --git a/android/src/main/java/com/authsignal/react/AuthsignalTOTPModule.kt b/android/src/main/java/com/authsignal/react/AuthsignalTOTPModule.kt index 88702d3..f7a5efb 100644 --- a/android/src/main/java/com/authsignal/react/AuthsignalTOTPModule.kt +++ b/android/src/main/java/com/authsignal/react/AuthsignalTOTPModule.kt @@ -47,7 +47,7 @@ class AuthsignalTOTPModule(private val reactContext: ReactApplicationContext) : val response = it.enroll() if (response.error != null) { - val errorCode = response.errorType ?: defaultError + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { @@ -67,7 +67,7 @@ class AuthsignalTOTPModule(private val reactContext: ReactApplicationContext) : val response = it.verify(code) if (response.error != null) { - val errorCode = response.errorType ?: "verify_error" + val errorCode = response.errorCode ?: defaultError promise.reject(errorCode, response.error) } else { diff --git a/ios/AuthsignalEmailModule.swift b/ios/AuthsignalEmailModule.swift index 33d9390..91eddff 100644 --- a/ios/AuthsignalEmailModule.swift +++ b/ios/AuthsignalEmailModule.swift @@ -37,7 +37,7 @@ class AuthsignalEmailModule: NSObject { let response = await authsignal!.enroll(email: emailStr) if (response.error != nil) { - reject(response.errorCode ?? "enroll_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let enrollResponse: [String: String?] = [ "userAuthenticatorId": response.data!.userAuthenticatorId, @@ -61,7 +61,7 @@ class AuthsignalEmailModule: NSObject { let response = await authsignal!.challenge() if (response.error != nil) { - reject(response.errorCode ?? "challenge_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let challengeResponse: [String: String?] = [ "challengeId": response.data!.challengeId, @@ -88,7 +88,7 @@ class AuthsignalEmailModule: NSObject { let response = await authsignal!.verify(code: codeStr) if (response.error != nil) { - reject(response.errorCode ?? "verify_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let verifyResponse: [String: Any?] = [ "isVerified": response.data!.isVerified, diff --git a/ios/AuthsignalPasskeyModule.swift b/ios/AuthsignalPasskeyModule.swift index 72d0223..b119462 100644 --- a/ios/AuthsignalPasskeyModule.swift +++ b/ios/AuthsignalPasskeyModule.swift @@ -41,7 +41,7 @@ class AuthsignalPasskeyModule: NSObject { let response = await authsignal!.signUp(token: tokenStr, username: usernameStr, displayName: displayNameStr) if (response.error != nil) { - reject(response.errorCode ?? "sign_up_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let signUpResponse: [String: String?] = [ "token": response.data!.token, @@ -77,7 +77,7 @@ class AuthsignalPasskeyModule: NSObject { ) if (response.error != nil) { - reject(response.errorCode ?? "sign_in_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let signInResponse: [String: Any?] = [ "isVerified": response.data!.isVerified, diff --git a/ios/AuthsignalPushModule.swift b/ios/AuthsignalPushModule.swift index 84860f0..504f65c 100644 --- a/ios/AuthsignalPushModule.swift +++ b/ios/AuthsignalPushModule.swift @@ -34,7 +34,7 @@ class AuthsignalPushModule: NSObject { let response = await authsignal.getCredential() if let error = response.error { - reject("getCredential error", error, nil) + reject(response.errorCode ?? "unexpected_error", error, nil) } else if let data = response.data { let credential: [String: String?] = [ "credentialId": data.credentialId, @@ -66,7 +66,7 @@ class AuthsignalPushModule: NSObject { let response = await authsignal.addCredential(token: tokenStr, keychainAccess: keychainAccess) if let error = response.error { - reject(response.errorCode ?? "add_credential_error", error, nil) + reject(response.errorCode ?? "unexpected_error", error, nil) } else { resolve(response.data) } @@ -86,7 +86,7 @@ class AuthsignalPushModule: NSObject { let response = await authsignal.removeCredential() if let error = response.error { - reject(response.errorCode ?? "remove_credential_error", error, nil) + reject(response.errorCode ?? "unexpected_error", error, nil) } else { resolve(response.data) } @@ -106,7 +106,7 @@ class AuthsignalPushModule: NSObject { let response = await authsignal.getChallenge() if let error = response.error { - reject(response.errorCode ?? "get_challenge_error", error, nil) + reject(response.errorCode ?? "unexpected_error", error, nil) } else if let data = response.data as? PushChallenge { let challenge: [String: String?] = [ "challengeId": data.challengeId, @@ -148,7 +148,7 @@ class AuthsignalPushModule: NSObject { ) if let error = response.error { - reject(response.errorCode ?? "update_challenge_error", error, nil) + reject(response.errorCode ?? "unexpected_error", error, nil) } else { resolve(response.data) } diff --git a/ios/AuthsignalSMSModule.swift b/ios/AuthsignalSMSModule.swift index 0720d63..93ea214 100644 --- a/ios/AuthsignalSMSModule.swift +++ b/ios/AuthsignalSMSModule.swift @@ -37,7 +37,7 @@ class AuthsignalSMSModule: NSObject { let response = await authsignal!.enroll(phoneNumber: phoneNumberStr) if (response.error != nil) { - reject(response.errorCode ?? "enroll_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let enrollResponse: [String: String?] = [ "userAuthenticatorId": response.data!.userAuthenticatorId, @@ -61,7 +61,7 @@ class AuthsignalSMSModule: NSObject { let response = await authsignal!.challenge() if (response.error != nil) { - reject(response.errorCode ?? "challenge_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let challengeResponse: [String: String?] = [ "challengeId": response.data!.challengeId, @@ -88,7 +88,7 @@ class AuthsignalSMSModule: NSObject { let response = await authsignal!.verify(code: codeStr) if (response.error != nil) { - reject(response.errorCode ?? "verify_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let verifyResponse: [String: Any?] = [ "isVerified": response.data!.isVerified, diff --git a/ios/AuthsignalTOTPModule.swift b/ios/AuthsignalTOTPModule.swift index 4b725d1..c48f51d 100644 --- a/ios/AuthsignalTOTPModule.swift +++ b/ios/AuthsignalTOTPModule.swift @@ -34,7 +34,7 @@ class AuthsignalTOTPModule: NSObject { let response = await authsignal!.enroll() if (response.error != nil) { - reject(response.errorCode ?? "enroll_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let enrollResponse: [String: String?] = [ "userAuthenticatorId": response.data!.userAuthenticatorId, @@ -63,7 +63,7 @@ class AuthsignalTOTPModule: NSObject { let response = await authsignal!.verify(code: codeStr) if (response.error != nil) { - reject(response.errorCode ?? "verify_error", response.error, nil) + reject(response.errorCode ?? "unexpected_error", response.error, nil) } else { let verifyResponse: [String: Any?] = [ "isVerified": response.data!.isVerified, diff --git a/package.json b/package.json index d2d340d..681480e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-authsignal", - "version": "1.1.2", + "version": "1.1.3", "description": "The official Authsignal React Native library.", "main": "lib/commonjs/index", "module": "lib/module/index",