mirror of
https://github.com/absmach/supermq.git
synced 2026-06-23 07:20:19 +00:00
f88e11bdb2
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
38 lines
657 B
Go
38 lines
657 B
Go
// Copyright (c) Abstract Machines
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package token
|
|
|
|
import (
|
|
"github.com/absmach/magistrala/auth"
|
|
"github.com/absmach/magistrala/pkg/apiutil"
|
|
)
|
|
|
|
type issueReq struct {
|
|
userID string
|
|
keyType auth.KeyType
|
|
}
|
|
|
|
func (req issueReq) validate() error {
|
|
if req.keyType != auth.AccessKey &&
|
|
req.keyType != auth.APIKey &&
|
|
req.keyType != auth.RecoveryKey &&
|
|
req.keyType != auth.InvitationKey {
|
|
return apiutil.ErrInvalidAuthKey
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type refreshReq struct {
|
|
refreshToken string
|
|
}
|
|
|
|
func (req refreshReq) validate() error {
|
|
if req.refreshToken == "" {
|
|
return apiutil.ErrMissingSecret
|
|
}
|
|
|
|
return nil
|
|
}
|