model

package
v0.0.0-...-46fdcb5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDTokenKey      = "id-token"
	SessionTokenKey = "session-token"
	IDKey           = "id"
	SignKey         = "secret"
	DefaultExpires  = 86400 // 1 day
)
View Source
const Age = 2592000 * time.Second // 30 days

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(id string, sign string) (string, error)

func GetID

func GetID(token string, sign string) (string, error)

func GetUIDCtx

func GetUIDCtx(ctx context.Context) string

func SetUIDCtx

func SetUIDCtx(ctx context.Context, uid string) context.Context

func ValidToken

func ValidToken(token string, sign string) error

Types

type Article

type Article struct {
	ID          string   `json:"id"`
	URL         string   `json:"url"`
	Title       string   `json:"title"`
	Thumbnail   string   `json:"thumbnail"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
}

type Auth

type Auth struct {
	ID           string         `json:"id"`
	UserID       UserID         `json:"userId"`
	IDToken      IDToken        `json:"idToken"`
	PublicKey    *rsa.PublicKey `json:"publicKey"`
	RefreshToken RefreshToken   `json:"refreshToken"`
	ExpiresIn    int            `json:"expiresIn"`
	Expires      time.Time      `json:"expires"`
}

func (Auth) Verify

func (auth Auth) Verify() error

type Code

type Code struct {
	CodeID    CodeID
	SessionID SessionID
}

type CodeID

type CodeID string

type EMail

type EMail string

type ExpiresIn

type ExpiresIn time.Duration

type IDToken

type IDToken string // FirebaseのIDTokenではなく独自のトークン

type Password

type Password string

type RefreshToken

type RefreshToken string // FirebaseTokenとかの命名の方がよいかも

type Session

type Session struct {
	SessionID SessionID      `json:"id"`
	UserID    UserID         `json:"user_id"`
	PublicKey *rsa.PublicKey `json:"key"`
}

type SessionID

type SessionID string

type SessionToken

type SessionToken string

type Signature

type Signature string

type User

type User struct {
	UserID UserID
}

type UserID

type UserID string

Jump to

Keyboard shortcuts

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