Removed checked exception from LoginCredential constructor
This commit is contained in:
@ -27,11 +27,12 @@ public final class GroupMessage extends Message {
|
||||
*
|
||||
* @param id unique ID
|
||||
* @param senderID the ID of the user who sends the message
|
||||
* @param recipientID the ID of the user who receives the message
|
||||
* @param groupID the ID of the group which receives the message
|
||||
* @param creationDate the creation date of the message
|
||||
* @param text the text content of the message
|
||||
* @param attachment the attachment of the message, if present
|
||||
* @param status the current {@link MessageStatus} of the message
|
||||
* @param status the current {@link Message.MessageStatus} of the
|
||||
* message
|
||||
* @param forwarded whether this message was forwarded
|
||||
* @param memberStatuses a map of all members and their status according to this
|
||||
* {@link GroupMessage}
|
||||
|
@ -30,16 +30,22 @@ public class LoginCredentials implements Serializable {
|
||||
* @param password the password of the user (will be converted to a hash)
|
||||
* @param registration signifies that these credentials are used for user
|
||||
* registration instead of user login
|
||||
* @throws NoSuchAlgorithmException if the algorithm used is unknown
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public LoginCredentials(String identifier, char[] password, boolean registration) throws NoSuchAlgorithmException {
|
||||
public LoginCredentials(String identifier, char[] password, boolean registration) {
|
||||
this.identifier = identifier;
|
||||
passwordHash = getSha256(toByteArray(password));
|
||||
this.registration = registration;
|
||||
}
|
||||
|
||||
private byte[] getSha256(byte[] input) throws NoSuchAlgorithmException { return MessageDigest.getInstance("SHA-256").digest(input); }
|
||||
private byte[] getSha256(byte[] input) {
|
||||
try {
|
||||
return MessageDigest.getInstance("SHA-256").digest(input);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// This will never happen
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] toByteArray(char[] chars) {
|
||||
byte[] bytes = new byte[chars.length * 2];
|
||||
|
Reference in New Issue
Block a user