An open API service indexing awesome lists of open source software.

https://github.com/decentralised-dataexchange/bb-consent-android-privacy-dashboard

This repository hosts source code for the reference implementation of the GovStack Consent Building Block Android Privacy Dashboard towards individuals.
https://github.com/decentralised-dataexchange/bb-consent-android-privacy-dashboard

Last synced: 3 months ago
JSON representation

This repository hosts source code for the reference implementation of the GovStack Consent Building Block Android Privacy Dashboard towards individuals.

Awesome Lists containing this project

README

          


GovStack Consent BB Privacy Dashboard (Android SDK)






About
Configuration
Integration
Release Status
Contributing
Licensing

## About

This repository hosts source code for the reference implementation of the GovStack Consent Building Block Privacy Dashboard towards individuals.

## Release Status

Released. Refer to the [wiki page](https://github.com/decentralised-dataexchange/bb-consent-docs/wiki/wps-and-deliverables) for the latest status of the deliverables.

## Installation

Gradle:
```gradle
dependencies {
implementation 'com.github.decentralised-dataexchange:bb-consent-android-privacy-dashboard:'
}
```

Maven:
```xml

com.github.decentralised-dataexchange
bb-consent-android-privacy-dashboard

```

## Initialisation

#### Privacy Dasboard
We can initiate the privacy dashboard by calling the below.
```
PrivacyDashboard.showPrivacyDashboard().withApiKey()
.withUserId()
.withBaseUrl().start(this)
```
We can also show the privacy dashboard with `accessToken`. For that use the below
```
.withAccessToken()
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`

To set the language we just need to add the following before the `start(this)`
```
.withLocale()
```

To enable user requests we just need to add the following before the `start(this)`
```
.enableUserRequest()
```

To enable Ask me we just need to add the following before the `start(this)`
```
.enableAskMe()
```

## Supported Functions

#### Data Sharing UI

Register activity for result to get the response back from the Data sharing UI
```
var resultLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val data: Intent? = result.data
if (data != null) {
Log.d("Data Agreement Record", data.getStringExtra("data_agreement_record") ?: "")
}
}
}
```
To initiate the Data sharing UI
```
val intent = DataSharingUI.showDataSharingUI()
.withApiKey()
.withUserId()
.withThirdPartyApplication(,)
.withBaseUrl()
.get(this)

resultLauncher.launch(intent)
```
We can also show the privacy dashboard with `accessToken`. For that use the below
```
.withAccessToken()
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`

To set the secondary button's text. Use the following before the `start(this)`
```
.secondaryButtonText()
```
In response, it will return a json string as follows. `Null` if the process failed
```
{
"id": "********************",
"dataAgreementId": "********************",
"dataAgreementRevisionId": "********************",
"dataAgreementRevisionHash": "*******************************",
"individualId": "********************",
"optIn": Boolean,
"state": "*********",
"signatureId": ""
}
```
#### Opt-in to Data Agreement
This function is used to provide the 3PP developer to opt-in to a data agreement.
```
PrivacyDashboard.optInToDataAgreement(
dataAgreementId = ,
baseUrl = ,
apiKey = ,
userId =
)
```
We can also use `accessToken` to opt-in to data agreement. For that use
```
accessToken =
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`

In response, it will return a json string as follows. `Null` if the process failed
```
{
"id": "********************",
"dataAgreementId": "********************",
"dataAgreementRevisionId": "********************",
"dataAgreementRevisionHash": "*******************************",
"individualId": "********************",
"optIn": Boolean,
"state": "*********",
"signatureId": ""
}
```
#### Fetch Data Agreement
This function is used to fetch the data agreement using `dataAgreementId`
```
PrivacyDashboard.getDataAgreement(
dataAgreementId = ,
baseUrl = ,
apiKey = ,
userId =
)
```
We can also use `accessToken` to opt-in to data agreement. For that use
```
accessToken =
```
> **_Note:_** If we have `accessToken` then no need to pass `API key` and `User ID`

In response, it will return a json string.
#### Show data agreement policy
To show data agreement policy, fetch the data agreement with the above API, pass the response in this
```
PrivacyDashboard.showDataAgreementPolicy()
.withDataAgreement()
.withLocale("en")
.start(this)
```
#### Individual Functions
##### To Create an Individual
```
PrivacyDashboard.createAnIndividual(
baseUrl = ,
apiKey = ,
)
```
there is also optional fields to pass `name`, `email` and `phone`
##### To fetch an Individual
```
PrivacyDashboard.fetchTheIndividual(
baseUrl = ,
apiKey = ,
individualId =
)
```
##### To update an Individual
```
PrivacyDashboard.updateTheIndividual(
baseUrl = ,
apiKey = ,
name = ,
email = ,
phone = ,
individualId =
)
```
##### To fetch all individuals
```
PrivacyDashboard.updateTheIndividual(
baseUrl = ,
apiKey = ,
offset = ,
limit =
)
```

## Release Status

Refer to the [wiki page](https://github.com/decentralised-dataexchange/bb-consent-docs/wiki/wps-and-deliverables) for the latest status of the deliverables.

## Other resources

* Wiki - https://github.com/decentralised-dataexchange/consent-dev-docs/wiki

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