Skip to content

Commit

Permalink
Remove user authentication push params
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisfisher committed Sep 3, 2024
1 parent 08a1150 commit 19a4726
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 35 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ dependencies {

implementation "androidx.browser:browser:1.2.0"

implementation("com.authsignal:authsignal-android:1.0.10")
implementation("com.authsignal:authsignal-android:1.0.11")
}

if (isNewArchitectureEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,10 @@ public void getCredential(Promise promise) {
@ReactMethod
public void addCredential(
String token,
boolean userAuthenticationRequired,
int timeout,
int authorizationType,
Promise promise) {
if (authsignalPush != null) {
authsignalPush
.addCredentialAsync(
token,
null,
userAuthenticationRequired,
timeout,
authorizationType
)
.addCredentialAsync(token, null)
.thenAcceptAsync(response -> {
if (response.getErrorType() != null && response.getErrorType().equals("TYPE_TOKEN_NOT_SET")) {
promise.reject("tokenNotSetError", "TOKEN_NOT_SET");
Expand Down
1 change: 0 additions & 1 deletion ios/AuthsignalPushModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ @interface RCT_EXTERN_MODULE(AuthsignalPushModule, NSObject)
rejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(addCredential:(NSString)token
withUserAuthenticationRequired:(BOOL)userAuthenticationRequired
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)

Expand Down
5 changes: 1 addition & 4 deletions ios/AuthsignalPushModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class AuthsignalPushModule: NSObject {

@objc func addCredential(
_ token: NSString?,
withUserAuthenticationRequired userAuthenticationRequired: Bool,
resolver resolve: @escaping RCTPromiseResolveBlock,
rejecter reject: @escaping RCTPromiseRejectBlock
) -> Void {
Expand All @@ -61,9 +60,7 @@ class AuthsignalPushModule: NSObject {
}

let tokenStr = token as String?
let keychainAccess: KeychainAccess = userAuthenticationRequired ?
.whenPasscodeSetThisDeviceOnly :
.whenUnlockedThisDeviceOnly
let keychainAccess: KeychainAccess = .whenUnlockedThisDeviceOnly

Task.init {
let response = await authsignal.addCredential(token: tokenStr, keychainAccess: keychainAccess)
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.0.7",
"version": "1.0.8",
"description": "The official Authsignal React Native library.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
20 changes: 2 additions & 18 deletions src/push.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NativeModules, Platform } from 'react-native';
import { NativeModules } from 'react-native';
import { LINKING_ERROR } from './error';
import type {
AuthsignalResponse,
Expand Down Expand Up @@ -27,7 +27,6 @@ const AuthsignalPushModule = NativeModules.AuthsignalPushModule

interface AddCredentialInput {
token?: string;
userAuthenticationRequired?: boolean;
}

interface UpdateChallengeInput {
Expand Down Expand Up @@ -69,26 +68,11 @@ export class AuthsignalPush {

async addCredential({
token,
userAuthenticationRequired = false,
}: AddCredentialInput): Promise<AuthsignalResponse<boolean>> {
await this.ensureModuleIsInitialized();

const timeout = userAuthenticationRequired ? 60 : 0;
const authorizationType = 0;

try {
const data =
Platform.OS === 'android'
? await AuthsignalPushModule.addCredential(
token,
userAuthenticationRequired,
timeout,
authorizationType
)
: await AuthsignalPushModule.addCredential(
token,
userAuthenticationRequired
);
const data = await AuthsignalPushModule.addCredential(token);

return { data };
} catch (ex) {
Expand Down

0 comments on commit 19a4726

Please sign in to comment.