forked from samiurprapon/Aether
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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 Tokendirectly 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();
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request