first public version, minor fixes

This commit is contained in:
Sergey Chernov 2023-01-19 11:28:06 +01:00
parent ba7fcb947e
commit 16e81dee25
5 changed files with 46 additions and 11 deletions

9
LICENSE.txt Normal file
View File

@ -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.

View File

@ -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>(), { TestSession() }) {
// This is a sample of your porvate API implementation:
// This is a sample of your custom API implementation:
on(api.loginName) {
currentLoginName
}

View File

@ -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")
}
}
}

View File

@ -292,8 +292,8 @@ class SuperloginClient<D, S : WithAdapter>(
} else null
}
} catch (t: Throwable) {
t.printStackTrace()
throw t
debug { "error while signign in: $t" }
null
}
}
}

View File

@ -157,6 +157,7 @@ internal class WsServerKtTest {
slc.register("foo", "passwd", TestData("nobar"))
}
slc.logout()
assertFalse{ slc.isLoggedIn }
assertNull(slc.dataKey)
assertIs<LoginState.LoggedOut>(slc.state.value)
assertEquals(null, slc.call(api.loginName))