package net.sergeych.superlogin import kotlinx.serialization.Serializable import net.sergeych.parsec3.CommandHost import net.sergeych.parsec3.WithAdapter import net.sergeych.unikrypto.PublicKey @Serializable data class RegistrationArgs( val loginName: String, val loginId: ByteArray, val loginPublicKey: PublicKey, val derivationParams: PasswordDerivationParams, val restoreId: ByteArray, val restoreData: ByteArray ) @Serializable sealed class AuthenticationResult { @Serializable data class Success( val loginToken: ByteArray, ): AuthenticationResult() @Serializable object LoginUnavailable: AuthenticationResult() @Serializable object RestoreIdUnavailable: AuthenticationResult() } @Serializable data class LoginArgs( val loginId: ByteArray, val packedSignedRecord: ByteArray ) @Serializable data class LoginData( val encryptedPrivateKey: ByteArray, val loginNonce: ByteArray ) class SuperloginServerApi : CommandHost() { val registerUser by command() val loginUserByToken by command() val requestUserLoginParams by command() /** * Get resstoreData by restoreId: password reset procedure start. */ val requestUserLogin by command() // val performLogin by command