domain

package
v0.0.0-...-a4f6240 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindGrantByGrantID

func FindGrantByGrantID(grantID uuid.UUID) (*grant, error)

func FindGrantByToken

func FindGrantByToken(ctx context.Context, accessToken Token) (*grant, error)

func NewGrant

func NewGrant(subjectID uuid.UUID) *grant

func RegisterGrant

func RegisterGrant(ctx context.Context, g *grant) (*AccessToken, *RefreshToken, error)

Types

type AccessToken

type AccessToken [32]byte

func LeaseGrant

func LeaseGrant(ctx context.Context, refreshToken *RefreshToken) (*AccessToken, *grant, error)

func (*AccessToken) Key

func (token *AccessToken) Key() string

func (*AccessToken) MarshalJSON

func (token *AccessToken) MarshalJSON() ([]byte, error)

type Credential

type Credential struct {
	ID           uuid.UUID
	CredentialID []byte
	Status       string
	PublicKey    []byte
	User         *User
}

type CredentialRepository

type CredentialRepository interface {
	core.Repository[string, *Credential]
	FindByCredentialId(ctx context.Context, credentialId []byte) (*Credential, error)
	FindByUserID(ctx context.Context, userID uuid.UUID) ([]*Credential, error)
}

type CredentialService

type CredentialService struct {
	// contains filtered or unexported fields
}

func NewCredentialService

func NewCredentialService(credentialRepo CredentialRepository) *CredentialService

func (*CredentialService) CreateCredential

func (s *CredentialService) CreateCredential(ctx context.Context, credential *Credential) error

func (*CredentialService) DeleteById

func (s *CredentialService) DeleteById(ctx context.Context, credentialId string) error

func (*CredentialService) GetCredentialByCredentialID

func (s *CredentialService) GetCredentialByCredentialID(ctx context.Context, id []byte) (*Credential, error)

func (*CredentialService) GetCredentialByID

func (s *CredentialService) GetCredentialByID(ctx context.Context, id string) (*Credential, error)

func (*CredentialService) GetCredentialsByUserID

func (s *CredentialService) GetCredentialsByUserID(ctx context.Context, userId uuid.UUID) ([]*Credential, error)

type GrantRepo

type GrantRepo = core.Repository[uuid.UUID, *grant]

type GrantStore

type GrantStore = core.KeyValueStore[string, *grant]

type RefreshToken

type RefreshToken [48]byte

func (RefreshToken) Key

func (token RefreshToken) Key() string

func (*RefreshToken) MarshalJSON

func (token *RefreshToken) MarshalJSON() ([]byte, error)

type Token

type Token interface {
	Key() string
	MarshalJSON() ([]byte, error)
}

type User

type User struct {
	ID     uuid.UUID
	UserID []byte
	Status string
}

type UserRepository

type UserRepository interface {
	core.Repository[string, *User]
	FindByUserId(ctx context.Context, userId []byte) (*User, error)
	ExistsUserId(ctx context.Context, userId []byte) (bool, error)
}

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

func NewUserService

func NewUserService(userRepo UserRepository) *UserService

func (*UserService) CreateUser

func (s *UserService) CreateUser(ctx context.Context, user *User) error

func (*UserService) DeleteById

func (s *UserService) DeleteById(ctx context.Context, id string) error

func (*UserService) GetUserById

func (s *UserService) GetUserById(ctx context.Context, id string) (*User, error)

func (*UserService) GetUserByUserID

func (s *UserService) GetUserByUserID(ctx context.Context, userId []byte) (*User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL