Initial commit: Open sourcing all of the Maple Open Technologies code.
This commit is contained in:
commit
755d54a99d
2010 changed files with 448675 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
package session
|
||||
|
||||
// Repository interface defines data access operations for sessions
|
||||
type Repository interface {
|
||||
// Save stores a session
|
||||
Save(session *Session) error
|
||||
|
||||
// Get retrieves the current session
|
||||
Get() (*Session, error)
|
||||
|
||||
// Delete removes the current session
|
||||
Delete() error
|
||||
|
||||
// Exists checks if a session exists
|
||||
Exists() (bool, error)
|
||||
}
|
||||
30
native/desktop/maplefile/internal/domain/session/model.go
Normal file
30
native/desktop/maplefile/internal/domain/session/model.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package session
|
||||
|
||||
import "time"
|
||||
|
||||
// Session represents a user authentication session (domain entity)
|
||||
type Session struct {
|
||||
UserID string
|
||||
Email string
|
||||
AccessToken string
|
||||
RefreshToken string
|
||||
ExpiresAt time.Time
|
||||
CreatedAt time.Time
|
||||
|
||||
// Encrypted user data for password verification (stored during login)
|
||||
Salt string // Base64 encoded salt for password derivation
|
||||
EncryptedMasterKey string // Base64 encoded encrypted master key
|
||||
EncryptedPrivateKey string // Base64 encoded encrypted private key
|
||||
PublicKey string // Base64 encoded public key
|
||||
KDFAlgorithm string // Key derivation algorithm: "PBKDF2-SHA256"
|
||||
}
|
||||
|
||||
// IsExpired checks if the session has expired
|
||||
func (s *Session) IsExpired() bool {
|
||||
return time.Now().After(s.ExpiresAt)
|
||||
}
|
||||
|
||||
// IsValid checks if the session is valid (not expired and has tokens)
|
||||
func (s *Session) IsValid() bool {
|
||||
return !s.IsExpired() && s.AccessToken != "" && s.RefreshToken != ""
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue