https://github.com/decentralised-dataexchange/presentation-exchange-sdk-android
https://github.com/decentralised-dataexchange/presentation-exchange-sdk-android
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/decentralised-dataexchange/presentation-exchange-sdk-android
- Owner: decentralised-dataexchange
- License: apache-2.0
- Created: 2024-03-07T16:04:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T13:52:43.000Z (over 1 year ago)
- Last Synced: 2024-11-05T14:48:31.629Z (over 1 year ago)
- Language: Kotlin
- Size: 98.6 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Presentation Exchange SDK (Android)
About •
Contributing •
Licensing
## About
This repository hosts source code for presentation exchange SDK.
## Usage
1. Add the JitPack repository to your build file
```kotlin
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```
2. Add the dependency
```kotlin
implementation 'com.github.decentralised-dataexchange:presentation-exchange-sdk-android:'
```
Note: In order to fix `slf4j` `java.lang.NullPointerException` found in versions >= 2.0.10, do override the transitive dependency by specifying the below:
```kotlin
implementation('org.slf4j:slf4j-api') {
version {
strictly '2.0.9'
}
}
```
3. Example usage of the SDK:
```kotlin
import com.github.decentraliseddataexchange.presentationexchangesdk.PresentationExchange
import com.github.decentraliseddataexchange.presentationexchangesdk.models.MatchedCredential
import com.google.gson.Gson
fun main() {
val pex = PresentationExchange()
val inputDescriptor =
"""{"id":"9a18d1b5-13ac-4fbc-8c12-d5916740ce1d","constraints":{"fields":[{"path":["${'$'}.address.city"]}]}}"""
val credentialsList = listOf(
"""{"type":["Passport"],"name":"John","dob":"14-Mar-70","address":{"city":"Stockholm","state":"Stockholm"}}""",
)
val matches: List = pex.matchCredentials(inputDescriptor, credentialsList)
println(Gson().toJson(matches))
}
```
Will output:
```json
[
{
"index": 0,
"fields": [
{
"index": 0,
"path": {
"path": "$.address.city",
"index": 0,
"value": "Stockholm"
}
}
]
}
]
```
## Contributing
Feel free to improve the plugin and send us a pull request. If you find any problems, please create an issue in this repo.
## Licensing
Copyright (c) 2023-25 LCubed AB (iGrant.io), Sweden
Licensed under the Apache 2.0 License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
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.