Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package com.authsignal.react

import android.util.Log
import com.authsignal.inapp.AuthsignalInApp
import com.authsignal.models.api.AppAttestation
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.module.annotations.ReactModule
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -57,15 +55,9 @@ class AuthsignalInAppModule(private val reactContext: ReactApplicationContext) :
_requireUserAuthentication: Boolean,
_keychainAccess: String?,
username: String?,
appAttestationMap: ReadableMap?,
appAttestation: Boolean,
promise: Promise
) {
val appAttestation = appAttestationMap?.let { map ->
val attestationToken = map.getString("token") ?: return@let null
val keyId = if (map.hasKey("keyId")) map.getString("keyId") else null
AppAttestation(token = attestationToken, keyId = keyId)
}

launch(promise) {
val response = it.addCredential(
token = token,
Expand Down
2 changes: 1 addition & 1 deletion ios/AuthsignalInAppModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ @interface RCT_EXTERN_MODULE(AuthsignalInAppModule, NSObject)
withRequireUserAuthentication:(BOOL)requireUserAuthentication
withKeychainAccess:(NSString)keychainAccess
withUsername:(NSString)username
withAppAttestation:(NSDictionary)appAttestation
withAppAttestation:(BOOL)appAttestation
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject)

Expand Down
11 changes: 1 addition & 10 deletions ios/AuthsignalInAppModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AuthsignalInAppModule: NSObject {
withRequireUserAuthentication requireUserAuthentication: Bool,
withKeychainAccess keychainAccess: NSString?,
withUsername username: NSString?,
withAppAttestation appAttestationDict: NSDictionary?,
withAppAttestation appAttestation: Bool,
resolve: @escaping RCTPromiseResolveBlock,
reject: @escaping RCTPromiseRejectBlock
) -> Void {
Expand All @@ -73,15 +73,6 @@ class AuthsignalInAppModule: NSObject {
let keychainAccess = getKeychainAccess(value: keychainAccess as String?)
let usernameStr = username as String?

var appAttestation: AppAttestation? = nil
if let dict = appAttestationDict,
let attestationToken = dict["token"] as? String {
appAttestation = AppAttestation(
token: attestationToken,
keyId: dict["keyId"] as? String
)
}

Task.init {
let response = await authsignal.addCredential(
token: tokenStr,
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": "2.8.0-alpha.2",
"version": "2.8.0-alpha.3",
"description": "The official Authsignal React Native library.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
2 changes: 1 addition & 1 deletion react-native-authsignal.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.private_header_files = "ios/**/*.h"

s.dependency "React-Core"
s.dependency 'Authsignal', '2.4.0-alpha.2'
s.dependency 'Authsignal', '2.4.0-alpha.3'

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
Expand Down
2 changes: 1 addition & 1 deletion src/NativeAuthsignalInAppModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Spec extends TurboModule {
withRequireUserAuthentication: boolean,
withKeychainAccess: string | null,
withUsername: string | null,
withAppAttestation: Object | null
withAppAttestation: boolean
): Promise<Object | null>;
removeCredential(username: string | null): Promise<boolean>;
verify(
Expand Down
2 changes: 1 addition & 1 deletion src/inapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class AuthsignalInApp {
requireUserAuthentication,
keychainAccess ?? null,
username ?? null,
appAttestation ?? null
appAttestation ?? false
)) as AppCredential;

return { data };
Expand Down
7 changes: 1 addition & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,11 @@ export interface VerifyResponse {
failureReason?: string;
}

export interface AppAttestation {
token: string;
keyId?: string;
}

export interface AddCredentialInput {
token?: string;
requireUserAuthentication?: boolean;
keychainAccess?: KeychainAccess;
appAttestation?: AppAttestation;
appAttestation?: boolean;
}

export interface AppChallenge {
Expand Down
Loading