- Added the go-nanoid library for generating unique IDs, enhancing user ID management. - Refactored user provider methods to improve clarity and consistency, including updates to user retrieval and authentication processes. - Adjusted user model fields to align with new ID generation strategy, ensuring compliance with best practices. - Cleaned up code by removing obsolete test files and improving overall structure for better maintainability.
57 lines
1.7 KiB
Go
57 lines
1.7 KiB
Go
package user
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/yaoapp/kun/maps"
|
|
)
|
|
|
|
// User MFA Management
|
|
|
|
// GenerateMFASecret generates a new TOTP secret for user
|
|
func (u *DefaultUser) GenerateMFASecret(ctx context.Context, userID string, issuer string, accountName string) (string, string, error) {
|
|
// TODO: implement
|
|
return "", "", nil
|
|
}
|
|
|
|
// EnableMFA enables multi-factor authentication for user
|
|
func (u *DefaultUser) EnableMFA(ctx context.Context, userID string, secret string, code string) error {
|
|
// TODO: implement
|
|
return nil
|
|
}
|
|
|
|
// DisableMFA disables multi-factor authentication for user
|
|
func (u *DefaultUser) DisableMFA(ctx context.Context, userID string, code string) error {
|
|
// TODO: implement
|
|
return nil
|
|
}
|
|
|
|
// VerifyMFACode verifies a TOTP code for user
|
|
func (u *DefaultUser) VerifyMFACode(ctx context.Context, userID string, code string) (bool, error) {
|
|
// TODO: implement
|
|
return false, nil
|
|
}
|
|
|
|
// GenerateRecoveryCodes generates new recovery codes for user and stores their hash
|
|
func (u *DefaultUser) GenerateRecoveryCodes(ctx context.Context, userID string) ([]string, error) {
|
|
// TODO: implement
|
|
return nil, nil
|
|
}
|
|
|
|
// VerifyRecoveryCode verifies and consumes a recovery code
|
|
func (u *DefaultUser) VerifyRecoveryCode(ctx context.Context, userID string, code string) (bool, error) {
|
|
// TODO: implement
|
|
return false, nil
|
|
}
|
|
|
|
// IsMFAEnabled checks if MFA is enabled for a user
|
|
func (u *DefaultUser) IsMFAEnabled(ctx context.Context, userID string) (bool, error) {
|
|
// TODO: implement
|
|
return false, nil
|
|
}
|
|
|
|
// GetMFAConfig retrieves MFA configuration for a user
|
|
func (u *DefaultUser) GetMFAConfig(ctx context.Context, userID string) (maps.MapStrAny, error) {
|
|
// TODO: implement
|
|
return nil, nil
|
|
}
|