]>
nmode's Git Repositories - signal-cli/blob - lib/src/main/java/org/asamk/signal/manager/storage/accounts/AccountsStore.java
ed6dec9701e27ce6d146ab0d95f08589e56f7040
1 package org
.asamk
.signal
.manager
.storage
.accounts
;
3 import org
.whispersystems
.signalservice
.api
.push
.ACI
;
4 import org
.whispersystems
.signalservice
.api
.util
.PhoneNumberFormatter
;
7 import java
.util
.Arrays
;
9 import java
.util
.stream
.Collectors
;
11 public class AccountsStore
{
13 private final File dataPath
;
15 public AccountsStore(final File dataPath
) {
16 this.dataPath
= dataPath
;
19 public Set
<String
> getAllNumbers() {
20 final var files
= dataPath
.listFiles();
26 return Arrays
.stream(files
)
29 .filter(file
-> PhoneNumberFormatter
.isValidNumber(file
, null))
30 .collect(Collectors
.toSet());
33 public String
getPathByNumber(String number
) {
37 public String
getPathByAci(ACI aci
) {
41 public void updateAccount(String path
, String number
, ACI aci
) {
42 // TODO remove number and uuid from all other accounts
43 if (!path
.equals(number
)) {
44 throw new UnsupportedOperationException("Updating number not supported yet");
48 public String
addAccount(String number
, ACI aci
) {
49 // TODO remove number and uuid from all other accounts