Pure pre-implementation
of Web Authentication: An API for accessing Public Key Credentials Level 2
This library allows you to use WebAuthn JSON without self-implementation.
Assume that uses this library with CredentialManager
But your app doesn't need to depend on GMS APIs.
Inspired by webauthn-json
- PublicKeyCredentialDescriptor
- AuthenticatorAttestationResponse
- AuthenticatorAssertionResponse
- CredentialCreationOptions
- CredentialRequestOptions
Set your settings.gradle
like below
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
Set your build.gradle
like below
dependencies {
// moshi
implementation 'io.github.ryunen344.webauthn:webauthn2-json-moshi:${version}'
// kotlinx.serialization
implementation 'io.github.ryunen344.webauthn:webauthn2-json-serialization:${version}'
}
Set your settings.gradle
like below
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Set your build.gradle
like below
dependencies {
// moshi
implementation 'com.github.RyuNen344.WebAuthnKt:webauthn2-json-moshi:${version}'
// kotlinx.serialization
implementation 'com.github.RyuNen344.WebAuthnKt:webauthn2-json-serialization:${version}'
}
you need to use WebAuthnAdapterHelper to setup moshi
val moshi = Moshi.Builder().apply(WebAuthnAdapterHelper()::setup).build()
val adapter = moshi.adapter(PublicKeyCredentialCreationOptions::class.java)
val json = adapter.fromJson(PublicKeyCredentialCreationOptionsJSON)
you can use serializers, directly
Json {}.encodeToString(
PublicKeyCredentialRequestOptions.serializer(),
PublicKeyCredentialRequestOptionsJSON
)
Copyright 2023 RyuNen344
Copyright 2015 Square, Inc.
Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.