CorvusUser
public final class CorvusUser : CorvusModel
extension CorvusUser: CorvusModelAuthenticatable
A default implementation of a user for basic authentication.
-
The corresponding database schema.
Declaration
Swift
public static let schema: String
-
The unique identifier of the model in the database.
Declaration
Swift
@CorvusUser .ID public var id: UUID? { get set }
-
The name of the user.
Declaration
Swift
@CorvusUser .Field public var username: String { get set }
-
The hashed password of the user, used during authentication.
Declaration
Swift
@CorvusUser .Field public var password: String { get set }
-
Provides public access to the User’s initializer.
Declaration
Swift
public init()
-
Creates a user with its given properties.
Declaration
Swift
public init( id: UUID? = nil, username: String, password: String )
Parameters
id
The identifier of the user, auto generated if not provided.
username
The username of the user.
password
The hashed password of the user.
-
Verifies a given string by checking if it matches a user’s password.
Throws
An error if encryption fails.Declaration
Swift
public func verify(password: String) throws -> Bool
Parameters
password
The password to verify.
Return Value
True if the provided password matches the user’s, false if not.