https://github.com/accelbyte/accelbyte-gdpr-java-sdk
https://github.com/accelbyte/accelbyte-gdpr-java-sdk
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/accelbyte/accelbyte-gdpr-java-sdk
- Owner: AccelByte
- License: mit
- Created: 2023-08-10T05:25:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-17T12:03:31.000Z (almost 2 years ago)
- Last Synced: 2024-04-17T13:28:46.941Z (almost 2 years ago)
- Language: Java
- Size: 63.5 KB
- Stars: 0
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# AccelByte GDPR Java SDK
GDPR SDK for integrating Java services with AGS (AccelByte Gaming Services) GDPR service.
This GDPR SDK could be used by participant services to integrate into AGS GDPR workflow.
There are 3 GDPR workflow that this GDPR SDK supported:
1. Right to data portability
2. Right to erasure (right to be forgotten)
3. Right to restrict processing
The participant services will hook their _**concrete GDPRHandler implementation**_ (that contains 3 functionalities above) into this GDPR SDK.
Under the hood, this GDPR SDK was using gRPC protocol for communication with AGS GDPR service:
```
+---------------+ +-------------------+
| AGS | gRPC | Your Java Service |
| GDPR Service -+------------->| (gRPC Server) |
| (gRPC Client) | | |
+---------------+ +-------------------+
```
## Requirements
Minimum Java version: Java 1.8
## Setup
### Gradle
```shell
dependencies {
implementation "net.accelbyte.sdk:gdpr-sdk:1.0.0"
}
```
### Maven
```shell
net.accelbyte.sdk
gdpr-sdk
1.0.0
```
[GDPR SDK jar downloads](https://search.maven.org/artifact/net.accelbyte.sdk/gdpr-sdk/1.0.0/jar) are available from Maven Central.
## Usage
### Create Concrete Implementation of [GDPRHandler](src/main/java/net/accelbyte/gdpr/sdk/GDPRHandler.java) interface
Create new class to implement [GDPRHandler](src/main/java/net/accelbyte/gdpr/sdk/GDPRHandler.java) interface:
```java
public class MyGDPRHandler implements GDPRHandler {
@Override
public DataGenerationResult ProcessDataGeneration(String namespace, String userId, boolean isPublisherNamespace) {
log.info("collecting user data...");
// your implementation here...
// example result
DataGenerationResult result = new DataGenerationResult();
result.setData("module1", "{\"data\":\"lorem ipsum dolor sit amet\"}".getBytes());
result.setData("module2", "{\"key1\":\"lorem ipsum\",\"key2\":\"dolor sit amet\"}".getBytes());
return result;
}
@Override
public void ProcessDataDeletion(String namespace, String userId, boolean isPublisherNamespace) {
log.info("deleting user data...");
// your implementation here...
}
@Override
public void ProcessDataRestriction(String namespace, String userId, boolean restrict, boolean isPublisherNamespace) {
log.info("restrict processing user data...");
// your implementation here...
}
}
```
### Initialize gRPC Server with [GDPRService](src/main/java/net/accelbyte/gdpr/sdk/GDPRService.java) class
In your main implementation, hook your Concrete Implementation of [GDPRHandler](src/main/java/net/accelbyte/gdpr/sdk/GDPRHandler.java) into [GDPRService](src/main/java/net/accelbyte/gdpr/sdk/GDPRService.java) class:
```java
GDPRHandler myGDPRHandler = new MyGDPRHandler();
GDPRService.SetHandler(myGDPRHandler);
```
Start gRPC Server with [GDPRService](src/main/java/net/accelbyte/gdpr/sdk/GDPRService.java) class:
```java
Server server = ServerBuilder
.forPort(8081)
.addService(new GDPRService()).build();
server.start();
server.awaitTermination();
```