diff options
author | Edoardo La Greca | 2025-08-18 21:09:11 +0200 |
---|---|---|
committer | Edoardo La Greca | 2025-08-18 21:09:11 +0200 |
commit | 7341ead2aade10ea1b833e94275277658741883a (patch) | |
tree | 46495f24c54278d50aa0da5046822fbe502f3f14 /lib/src/main/kotlin/Authenticator.kt | |
parent | 1e50cf9c224d03896f176f3718ff80ef1659e9c2 (diff) |
switch to multi-module project structure
Diffstat (limited to 'lib/src/main/kotlin/Authenticator.kt')
-rw-r--r-- | lib/src/main/kotlin/Authenticator.kt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/src/main/kotlin/Authenticator.kt b/lib/src/main/kotlin/Authenticator.kt new file mode 100644 index 0000000..2d501ae --- /dev/null +++ b/lib/src/main/kotlin/Authenticator.kt @@ -0,0 +1,20 @@ +/** + * The Authenticator interface provides methods for authenticating a user over an established protocol connection. + */ +interface Authenticator { + /** + * Authenticate a user identified by the given [username] and whose authenticity is confirmed by the given [key]. + * The authentication protocol can read and write data within the underlying connection using [readFun] and + * [writeFun]. + * + * @param username The name the user goes by. + * @param key The confirmation of the user's identity and authenticity. It could be any public, private, or derived + * (e.g. mixed with something else or hashed) datum, possibly shared between the server and the client, such as a + * UTF-8-encoded password or a raw public key. + * @param readFun A function to read incoming data from the underlying connection. + * @param writeFun A function to write outgoing data into the underlying connection. + * @throws except.FailedAuthenticationException if the authentication could not be performed. A human-readable + * reason for the failure can be provided if necessary. + */ + fun authenticate(username: String, key: List<UByte>, readFun: () -> List<UByte>, writeFun: (b: List<UByte>) -> Unit) +}
\ No newline at end of file |