From 16e81dee25af4be3348c0c69b5345775eb358e1f Mon Sep 17 00:00:00 2001 From: sergeych Date: Thu, 19 Jan 2023 11:28:06 +0100 Subject: [PATCH] first public version, minor fixes --- LICENSE.txt | 9 ++++++ README.md | 31 ++++++++++++++++--- build.gradle.kts | 12 ++++--- .../client/SuperloginClient.kt | 4 +-- .../kotlin/net/sergeych/WsServerKtTest.kt | 1 + 5 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..2e5f4db --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright 2023 Sergey S. Chernov + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 9b5cbb1..3aa5d31 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# Superlogin utilities +# Superlogin MP library -> Work in progress, too early to use. +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -This project targets to provide command set of multiplatform tools to faciliate restore access with non-recoverable passwords by providing a backup `secret` string as the only way to reset the password. +> Current stable version 0.2.1. + +This project targets to provide command set of multiplatform tools to faciliate restore access with non-recoverable passwords by providing a backup `secret` string as the only way to reset the password. It is ready to use in android, web and server apps (native target is not yet supported because of the encryption layer not yet supporting it) This technology is required in the systems where user data are not disclosed to anybody else, as an attempt to allow lost password reset by mean of a `secret` string that could be kept somewhere in a safe place. It allows password and protected content updates to be recoverable with a `secret`. @@ -14,9 +16,28 @@ It also contains useful tools for this type of application: - `AccessControlObject` to contain recoverable password-protected data with a backup `secret` word to restore access. +- as it is based on [parsec3](https://gitea.sergeych.net/SergeychWorks/parsec3) library and therefore allow pushes, etc. + +__Important note__. The library is yet in LTS stage, it undergoes a heavy testing in a few beta-stage commercial products, it could contain bugs and/or get incompatible updates soon. As with all free software, use it on you risk. + ## Setup -Currently, complie it and publish into mavenLocal, and use from there. Soon will be published to some public maven repo. +It is published in the universa public mvn: +~~~ +repositories { + // ... + maven("https://maven.universablockchain.com/") +} +~~~ + +and add in dependencies like: + +~~~ +dependencies { + //... + implementation("net.sergeych:unikrypto:1.2.5") +} +~~~ ## Usage with ktor server @@ -24,7 +45,7 @@ Use module for initialization like this: ~~~ fun Application.testServerModule() { superloginServer(TestApiServer(), { TestSession() }) { - // This is a sample of your porvate API implementation: + // This is a sample of your custom API implementation: on(api.loginName) { currentLoginName } diff --git a/build.gradle.kts b/build.gradle.kts index d77b5c3..7befeec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ val logback_version="1.2.10" group = "net.sergeych" -version = "0.2.1-SNAPSHOT" +version = "0.2.1" repositories { mavenCentral() @@ -51,7 +51,7 @@ kotlin { api("net.sergeych:unikrypto:1.2.2-SNAPSHOT") api("net.sergeych:parsec3:0.4.1-SNAPSHOT") api("net.sergeych:boss-serialization-mp:0.2.4-SNAPSHOT") - api("net.sergeych:unikrypto:1.2.2-SNAPSHOT") + api("net.sergeych:unikrypto:1.2.5") } } val commonTest by getting { @@ -79,10 +79,14 @@ kotlin { publishing { repositories { maven { + val mavenUser: String by project + val mavenPassword: String by project url = uri("https://maven.universablockchain.com/") credentials { - username = System.getenv("maven_user") - password = System.getenv("maven_password") + username = mavenUser + password = mavenPassword +// username = System.getenv("maven_user") +// password = System.getenv("maven_password") } } } diff --git a/src/commonMain/kotlin/net.sergeych.superlogin/client/SuperloginClient.kt b/src/commonMain/kotlin/net.sergeych.superlogin/client/SuperloginClient.kt index 7443b81..b92e725 100644 --- a/src/commonMain/kotlin/net.sergeych.superlogin/client/SuperloginClient.kt +++ b/src/commonMain/kotlin/net.sergeych.superlogin/client/SuperloginClient.kt @@ -292,8 +292,8 @@ class SuperloginClient( } else null } } catch (t: Throwable) { - t.printStackTrace() - throw t + debug { "error while signign in: $t" } + null } } } diff --git a/src/jvmTest/kotlin/net/sergeych/WsServerKtTest.kt b/src/jvmTest/kotlin/net/sergeych/WsServerKtTest.kt index 5da44f3..6f73dd0 100644 --- a/src/jvmTest/kotlin/net/sergeych/WsServerKtTest.kt +++ b/src/jvmTest/kotlin/net/sergeych/WsServerKtTest.kt @@ -157,6 +157,7 @@ internal class WsServerKtTest { slc.register("foo", "passwd", TestData("nobar")) } slc.logout() + assertFalse{ slc.isLoggedIn } assertNull(slc.dataKey) assertIs(slc.state.value) assertEquals(null, slc.call(api.loginName))