Changed Token size from 64 chars -> 16

pull/21/head
Niclas Thobaben 2022-02-14 21:46:37 +01:00
parent 984912ab70
commit b1cb69080a
2 changed files with 7 additions and 1 deletions

View File

@ -37,7 +37,11 @@ public class Account {
@GenericGenerator(name = "uuid", strategy ="org.hibernate.id.UUIDGenerator")
@Type(type = "uuid-char")
private UUID guid;
private String name;
@Column(length = Relay.TOKEN_NUM_CHARS)
private String token;
@ElementCollection(fetch = FetchType.EAGER)

View File

@ -20,7 +20,9 @@ import java.util.UUID;
@Service
public class Relay {
public static final int TOKEN_NUM_BITS = 256;
public static final int TOKEN_NUM_BITS = 64;
public static final int TOKEN_NUM_CHARS = TOKEN_NUM_BITS / 4;
private final Random RANDOM = new SecureRandom();
private final AccountRepository accountRepository;