Android Open Source - AndrOTP Account






From Project

Back to project page AndrOTP.

License

The source code is released under:

MIT License

If you think the Android project AndrOTP listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package lol.otp;
/* w  w  w  . j  a v  a 2s . c  om*/
import java.util.Locale;

import org.apache.commons.codec.binary.Base32;

/**
 * Current key for debug: "6yof 6u6b pvgp j34k 2zc5 jzl2 d3eu bjmr"
 * 
 * @author ganich_j
 *
 */
public class Account {
  private long  id = 0;
  private String  originalSecret = "00000000000000000000000000000000";
  private byte[]  decodedSecret = null;
  private String  accountName = "unknown";
  private String  code = "000000";
  
  public Account() {
  }
  
  public Account(String name, String secret) {
    Base32 codec = new Base32();
    
    accountName = name;
    originalSecret = secret.replaceAll("\\s+","").toUpperCase(Locale.US);
    decodedSecret = codec.decode(originalSecret);
  }

  public String getOriginalSecret() {
    return originalSecret;
  }

  public void setOriginalSecret(String originalSecret) {
    Base32 codec = new Base32();
    this.originalSecret = originalSecret;
    decodedSecret = codec.decode(originalSecret);
  }

  public byte[] getDecodedSecret() {
    return decodedSecret;
  }

  public void setDecodedSecret(byte[] decodedSecret) {
    this.decodedSecret = decodedSecret;
  }

  public String getAccountName() {
    return accountName;
  }

  public void setAccountName(String accountName) {
    this.accountName = accountName;
  }
  
  public String getCode() {
    return code;
  }
  
  public void setCode(String code) {
    this.code = code;
  }
  
  public void setId(long id) {
    this.id = id;
  }
  
  public long getId() {
    return (this.id);
  }
}




Java Source Code List

lol.otp.AccountListAdapter.java
lol.otp.Account.java
lol.otp.AccountsDataSource.java
lol.otp.MainActivity.java
lol.otp.MySQLiteHelper.java
lol.otp.TOTPUtility.java