Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Authentication #6

Open
samiurprapon opened this issue Jul 12, 2021 · 0 comments
Open

Android: Authentication #6

samiurprapon opened this issue Jul 12, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@samiurprapon
Copy link
Member

samiurprapon commented Jul 12, 2021

Is your feature request related to a problem?

JWT token based Authentication system integrated with Retrofit followed by MVVM Architecture.

Describe the solution you'd like

  • initialize retrofit
  • API Endpoint details /server/README.md (/register, /login, /refresh)
  • Do not Store Refresh Token directly inside SharedPreference
  • Store Refresh token HASH. (Using SHA-256)

Additional context

SHA-256 implementation -

public static byte[] getSHA(String input) throws NoSuchAlgorithmException { 
        // Static getInstance method is called with hashing SHA 
        MessageDigest md = MessageDigest.getInstance("SHA-256"); 
  
        // digest() method called 
        // to calculate message digest of an input 
        // and return array of byte
        return md.digest(input.getBytes(StandardCharsets.UTF_8)); 
}
    
    public static String toHexString(byte[] hash) {
        // Convert byte array into signum representation 
        BigInteger number = new BigInteger(1, hash); 
  
        // Convert message digest into hex value 
        StringBuilder hexaString = new StringBuilder(number. toString(16)); 
  
        // Pad with leading zeros
        while (hexaString.length() < 32) { 
            hexaString.insert(0, '0'); 
        } 
  
        return hexaString.toString(); 
}
@samiurprapon samiurprapon added the enhancement New feature or request label Jul 12, 2021
samiurprapon added a commit that referenced this issue Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant