Skip to content

Commit

Permalink
Add single sign in to noebs sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
adonese committed Aug 3, 2022
1 parent 8a2704f commit 74d85db
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/src/main/java/com/tuti/api/TutiApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,30 @@ public void SignIn(SignInRequest credentials, ResponseCallable<SignInResponse> o
sendRequest(RequestMethods.POST, serverURL + Operations.SIGN_IN, credentials, SignInResponse.class, TutiResponse.class, onResponse, onError, null);
}

/**
* OneTimeSignIn allows tutipay users to sign in via a code we send to their phone numbers
* Notice: this method ONLY works for tutipay registered devices, at the moment
* it doesn't support a sign in from a new device, as it relies on the user
* signing a message via their private key
* @param credentials
* @param onResponse
* @param onError
*/
public void OneTimeSignIn(SignInRequest credentials, ResponseCallable<SignInResponse> onResponse, ErrorCallable<TutiResponse> onError) {
sendRequest(RequestMethods.POST, serverURL + Operations.SINGLE_SIGN_IN, credentials, SignInResponse.class, TutiResponse.class, onResponse, onError, null);
}

/**
* GenerateOtpSignIn service used to request an otp to be sent to the user's registered sms phone number
*
* @param credentials
* @param onResponse
* @param onError
*/
public void GenerateOtpSignIn(SignInRequest credentials, ResponseCallable<SignInResponse> onResponse, ErrorCallable<TutiResponse> onError) {
sendRequest(RequestMethods.POST, serverURL + Operations.GENERATE_LOGIN_OTP, credentials, SignInResponse.class, TutiResponse.class, onResponse, onError, null);
}

/**
* RefreshToken used to refresh an existing token to keep user's session valid.
* @param credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
public class SignInRequest {
private String username;
private String password;

public String getMobile() {
return mobile;
}

public void setMobile(String mobile) {
this.mobile = mobile;
}

private String mobile;

public String getSignature() {
Expand Down
2 changes: 2 additions & 0 deletions lib/src/main/java/com/tuti/model/Operations.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class Operations {
public static final String ACCOUNT_TRANSFER = "account";
public static final String CHANGE_IPIN = "ipin";
public static final String SIGN_IN = "login";
public static final String SINGLE_SIGN_IN = "otp/login";
public static final String GENERATE_LOGIN_OTP = "otp";
public static final String SIGN_UP = "register";
public static final String GET_CARDS = "get_cards";
public static final String ADD_CARD = "add_card";
Expand Down

0 comments on commit 74d85db

Please sign in to comment.