diff --git a/management/server/account.go b/management/server/account.go index d48d35fe5..ecc706238 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -6,6 +6,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "net" + "strings" "sync" ) @@ -175,7 +176,7 @@ func (manager *AccountManager) AddPeer(setupKey string, peerKey string) (*Peer, // Empty setup key, create a new account for it. account, sk = newAccount() } else { - sk = &SetupKey{Key: setupKey} + sk = &SetupKey{Key: strings.ToUpper(setupKey)} account, err = manager.Store.GetAccountBySetupKey(sk.Key) if err != nil { return nil, status.Errorf(codes.NotFound, "unknown setupKey %s", setupKey) @@ -211,7 +212,7 @@ func newAccountWithId(accountId string) (*Account, *SetupKey) { log.Debugf("creating new account") - setupKeyId := uuid.New().String() + setupKeyId := strings.ToUpper(uuid.New().String()) setupKeys := make(map[string]*SetupKey) setupKey := &SetupKey{Key: setupKeyId} setupKeys[setupKeyId] = setupKey diff --git a/management/server/file_store.go b/management/server/file_store.go index 1ca56a7d1..a561c2e30 100644 --- a/management/server/file_store.go +++ b/management/server/file_store.go @@ -67,7 +67,7 @@ func restore(file string) (*FileStore, error) { store.PeerKeyId2AccountId = make(map[string]string) for accountId, account := range store.Accounts { for setupKeyId := range account.SetupKeys { - store.SetupKeyId2AccountId[strings.ToLower(setupKeyId)] = accountId + store.SetupKeyId2AccountId[strings.ToUpper(setupKeyId)] = accountId } for _, peer := range account.Peers { store.PeerKeyId2AccountId[peer.Key] = accountId @@ -133,7 +133,7 @@ func (s *FileStore) SaveAccount(account *Account) error { func (s *FileStore) GetAccountBySetupKey(setupKey string) (*Account, error) { - accountId, accountIdFound := s.SetupKeyId2AccountId[strings.ToLower(setupKey)] + accountId, accountIdFound := s.SetupKeyId2AccountId[strings.ToUpper(setupKey)] if !accountIdFound { return nil, status.Errorf(codes.NotFound, "provided setup key doesn't exists") }