         let content = request.content
 
         return try content
-            .decode(R.self)
+            .decode(Registration.self)
             .flatMap(to: Self.self) { registration in
                 if registration.password.count < 8 {
                     throw JWTKeychainError.weakPassword
                 }
                 return try Self(registration).save(on: request)
             }
-    }
-}
-
-extension JWTCustomPayloadKeychainUser where
-    Self: Model, Self.Database: QuerySupporting, Self.ID: StringInitializable
-{
-    public static func load(on request: Request) throws -> Future<Self> {
-        let payload: P = try request.payload()
-
-        guard let id = ID(string: payload.sub.value) else {
-            throw JWTKeychainError.invalidIdentifier
-        }
-
-        return try find(id, on: request).map(to: Self.self, userOrNotFound)
     }
 }
 

    }
}

public protocol JWTKeychainUser: JWTCustomPayloadKeychainUser where P == Payload {}

extension JWTCustomPayloadKeychainUser where Self: Model, Self.Database: QuerySupporting, Self: Content {
    public static func logIn(on request: Request) throws -> Future<Self> {
        guard
            let userIdentifierProperty = try reflectProperty(forKey: userIdentifierKey),
            let passwordProperty = try reflectProperty(forKey: passwordKey)
        else {
            // TODO: better error?
            throw JWTKeychainError.invalidIdentifier
        }

        let content = request.content

        return flatMap(
            to: Self.self,
            content[String.self, at: userIdentifierProperty.path],
            content[String.self, at: passwordProperty.path]
        ) { userIdentifier, password in
            return try query(on: request)
                .filter(userIdentifierKey, .equals, .data(userIdentifier))
                .first()
                .map(to: Self.self, userOrNotFound)
                .map(to: Self.self) { user in
                    guard
                        let password = password,
                        let created = Data(base64Encoded: user[keyPath: passwordKey].value),
                        try BCrypt.verify(password, created: created)
                    else {
                        throw JWTKeychainError.incorrectPassword
                    }

                    return user
            }
        }
    }


import Fluent
import Vapor

public protocol JWTKeychainUserLogin: Decodable {
    var password: String { get }
}

public protocol JWTKeychainUserPublic: Encodable {}

public protocol JWTKeychainUserRegistration: Decodable {
    var password: String { get }
}

public protocol JWTKeychainUserUpdate: Decodable {}

public protocol JWTCustomPayloadKeychainUser: Content, Model where
    Self.Database: QuerySupporting, Self.ID: StringInitializable
{
    associatedtype Login: JWTKeychainUserLogin
    associatedtype Payload: JWTKeychainPayload
//    associatedtype Public: JWTKeychainUserPublic
    associatedtype Registration: JWTKeychainUserRegistration
//    associatedtype Update: JWTKeychainUserUpdate

    static var bCryptCost: Int { get }

    static func logIn(with: Login, on: Request) throws -> Future<Self?>
    init(_: Registration) throws

    var password: HashedPassword { get }

//    func asPublic() throws -> Public
//    func update(_ : Update) throws -> Self
}

extension JWTCustomPayloadKeychainUser {
