MCPcopy Create free account
hub / github.com/SwishHQ/spread / CreateAuthKey

Method CreateAuthKey

src/service/auth_key.service.go:25–37  ·  view source on GitHub ↗
(name string, username string)

Source from the content-addressed store, hash-verified

23}
24
25func (s *authKeyService) CreateAuthKey(name string, username string) (string, error) {
26 authKey := &model.AuthKey{
27 Name: name,
28 Key: utils.GenerateAuthKey(),
29 IsValid: true,
30 CreatedBy: username,
31 }
32 authKey, err := s.authKeyRepository.Insert(authKey)
33 if err != nil {
34 return "", err
35 }
36 return authKey.Key, nil
37}
38
39func (s *authKeyService) GetByAuthKey(key string) (*model.AuthKey, error) {
40 authKey, err := s.authKeyRepository.GetById(key)

Callers

nothing calls this directly

Calls 2

GenerateAuthKeyFunction · 0.92
InsertMethod · 0.65

Tested by

no test coverage detected