Skip to content

Commit

Permalink
Bump android sdk to 2.0 (#29)
Browse files Browse the repository at this point in the history
* Bump android sdk version

* wip
  • Loading branch information
chrisfisher authored Oct 22, 2024
1 parent 1779552 commit f5048f4
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions ios/AuthsignalEmailModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions ios/AuthsignalPasskeyModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions ios/AuthsignalPushModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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,
Expand Down Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions ios/AuthsignalSMSModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions ios/AuthsignalTOTPModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit f5048f4

Please sign in to comment.