gdprsdk

package module
v0.0.0-...-2582988 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 4 Imported by: 0

README

AccelByte GDPR Go SDK

GDPR SDK for integrating Go 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 go function of 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 Go Service |
| GDPR Service -+------------->|  (gRPC Server)  |
| (gRPC Client) |              |                 |
+---------------+              +-----------------+

Usage

Install GDPR SDK
go get -u github.com/AccelByte/accelbyte-gdpr-go-sdk
Initialize GDPR SDK

Import GDPR SDK references:

import (
    "github.com/AccelByte/accelbyte-gdpr-go-sdk"
    "github.com/AccelByte/accelbyte-gdpr-go-sdk/pkg/object"
)

Create a new GDPR SDK gRPC server:

yourGrpcServer := grpc.NewServer()
	
// initialize GDPR SDK gRPC
gdprSDK := gdprsdk.NewGdprGrpc()
gdprSDK.RegisterGRPC(yourGrpcServer)

lis, err := net.Listen("tcp", ":8081")
if err = yourGrpcServer.Serve(lis); err != nil {
    fmt.Errorf("%v", err)
}
Hook your GDPR functionalities into GDPR SDK
// register data generation handler (workflow: Right to data portability)
gdprSDK.SetDataGenerationHandler(func(namespace, userID string, isPublisherNamespace bool) (*object.DataGenerationResult, error) {
    logrus.Info("collecting user data...")
	
    // your implementation here...
	
    // example result
    return &object.DataGenerationResult{
        Data: map[string][]byte{
            "module1": []byte("{\"data\":\"lorem ipsum dolor sit amet\"}"),
            "module2": []byte("[\"lorem\",\"ipsum\",\"dolor\",\"sit\",\"amet\"]"),
        },
    }, nil
})

// register data deletion handler (workflow: Right to erasure) 
gdprSDK.SetDataDeletionHandler(func(namespace, userID string, isPublisherNamespace bool) error {
    logrus.Info("deleting user data...")
	
    // your implementation here...
	
    return nil
})

// register data restriction handler (workflow: Right to restrict processing) 
gdprSDK.SetDataRestrictionHandler(func(namespace, userID string, restrict, isPublisherNamespace bool) error {
    logrus.Info("restrict processing user data...")

    // your implementation here...

    return nil
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GdprGrpc

type GdprGrpc struct {
	// contains filtered or unexported fields
}

func NewGdprGrpc

func NewGdprGrpc() *GdprGrpc

func (GdprGrpc) RegisterGRPC

func (sdk GdprGrpc) RegisterGRPC(server *grpc.Server)

func (GdprGrpc) SetDataDeletionHandler

func (sdk GdprGrpc) SetDataDeletionHandler(handler object.DataDeletionHandler)

func (GdprGrpc) SetDataGenerationHandler

func (sdk GdprGrpc) SetDataGenerationHandler(handler object.DataGenerationHandler)

func (GdprGrpc) SetDataRestrictionHandler

func (sdk GdprGrpc) SetDataRestrictionHandler(handler object.DataRestrictionHandler)

Directories

Path Synopsis
pkg
pb

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL