Skip to main content

PHP server SDK v0.9.2

Installation

composer require blindnet/blindnet-sdk-php

Imports

require 'vendor/autoload.php';
use Blindnet\BlindnetSDKPHP\Blindnet;

Init

Initializes blindnet server SDK.

static function init(
string $appKey,
string $appId,
string $apiEndpoint = 'https://api.blindnet.io'
): Blindnet

Parameters

nametyperequireddescription
$appKeystringtrueApplication private key
$appIdstringtrueApplication ID
$apiEndpointstringfalseEndpoint of the blindnet server. Default value is https://api.blindnet.io. For testing, use https://test.blindnet.io.

Return type

Blindnet

createTempUserToken

Creates a token for non-registered users of your application, usually data senders. When this token is used for encrypting data, all users that belong to a specified group will have access to the encrypted data.

function createTempUserToken(string $groupId): string

Parameters

nametyperequireddescription
$groupIdstringtrueID of the group for which the data is being encrypted.

Return type

String

createUserToken

Creates a token for registered users of your application, usually data receivers.

function createUserToken(string $userId, string $groupId): string
nametyperequireddescription
$userIdstringtrueID of a registered user.
$groupIdstringtrueID of the group to which a registered user belongs.

Return type

String

forgetData

Deletes the encrypted data key from blindnet.

function forgetData(string $dataId)

Parameters

nametyperequireddescription
$dataIdstringtrueID of a data to be deleted.

Return type

bool

Errors

typedescription
AuthenticationErrorImplies invalid token, which further implies invalid application id or application key.
BlindnetServiceErrorImplies an error in the request to blindnet API.

revokeAccess

Deletes all encrypted data keys of a given user.

function revokeAccess(string $userId): bool

Parameters

nametyperequireddescription
$userIdstringtrueID of a user to revoke access to the encrypted data.

Return type

bool

Errors

typedescription
AuthenticationErrorImplies invalid token, which further implies invalid application id or application key.
BlindnetServiceErrorImplies an error in the request to blindnet API.

forgetUser

Deletes a user from blindnet.

function forgetUser(string $userId): bool

Parameters

nametyperequireddescription
$userIdstringtrueID of a user to delete.

Return type

bool

Errors

typedescription
AuthenticationErrorImplies invalid token, which further implies invalid application id or application key.
BlindnetServiceErrorImplies an error in the request to blindnet API.

forgetGroup

Deletes all encrypted data keys of a given user.
Deletes all users that belong to the group and all their encrypted data keys.

function forgetGroup(string $groupId): bool

Parameters

nametyperequireddescription
$groupIdstringtrueID of a group to delete.

Return type

bool

Errors

typedescription
AuthenticationErrorImplies invalid token, which further implies invalid application id or application key.
BlindnetServiceErrorImplies an error in the request to blindnet API.