TozStore Quickstart

Securely store your sensitive information with our end to end encryption

Overview

With TozStore securing your data is easy, as our platform and SDKs do all of the cryptography for you. Integrating TozStore is a simple process:

  1. Create an account at the Tozny Dashboard and create your registration token here. This registration token is what lets you create your clients.

  2. Using the SDK of your choice, create a client with your new registration token and begin writing encrypted data to TozStore.

1. Install SDK

We provide a number of SDK's in different languages, feel free to choose the one that best suits your needs.

Python

Node (Javascript)

Ruby

Go

PHP

CLI

Java (Android)

iOS (Swift)

2. Create a Client

Creating a client is a quick process, but remember that these credentials are private and should be handled with care. If these credentials are lost there is no way to recover your data, as we do not store them by default.

Python
import e3db
token = 'YOUR_REGISTRATION_TOKEN_HERE'
client_name = 'example name'
public_key, private_key = e3db.Client.generate_keypair()
# Register your client
client_info = e3db.Client.register(token, client_name, public_key)
config = e3db.Config(
client_info.client_id,
client_info.api_key_id,
client_info.api_secret,
public_key,
private_key
)
# To save this Configuration to disk, do the following:
config.write()
# Instantiate your client to communicate with TozStore
client = e3db.Client(config())

3. Encrypt Your Data

Tozny's SDKs handle the encryption for you, all you need to provide is the data. See Record Structure for details on how you can best structure your data.

Python
Javascript
PHP
Go
Ruby
Java
Swift
import e3db
client = e3db.Client(
# config
)
record_type = 'contact'
data = {
'first_name': 'Jon',
'last_name': 'Snow',
'phone': '555-555-1212'
}
metadata = {
'house' : 'Stark'
}
record = client.write(record_type, data, metadata)
const e3db = require('e3db')
let client = new e3db.Client(/* config */)
async function main() {
let data = {
'first_name': 'Jon',
'last_name': 'Snow',
'phone': '555-555-1212',
}
let metadata = {
'house' : 'Stark'
}
let record = await client.write('contact', data, metadata)
console.log('Wrote record ' + record.meta.recordId)
}
main()
<?php
$data = [
'name' => 'Jon Snow',
'what_he_knows' => 'Nothing',
];
$metadata = [
'house' => 'Stark'
];
// 'test-contact' represents our data type
$record = $client->write('test-contact', $data, $metadata);
//record contains the newly created value
$record_id = $record->meta->record_id;
?>
// Create data for a record
var recordData map[string]string
recordType := "contact"
recordData["first_name"] = "Jon"
recordData["last_name"] = "Snow"
recordData["phone"] = "555-555-1212"
// Create optional metadata for the record
//(metadata can be used for searching)
var metadata map[string]string
matadata["realm"] = "The North"
metadata["pet"] = "Ghost"
// Encrypt and save the record
recordID, err := client.Write(
context.Background(),
recordType,
recordData,
metadata
)
if err != nil {
//Error handling omitted
}
fmt.Println("Wrote record: " + recordID)
record = client.write('contact', {
:first_name => 'Jon',
:last_name => 'Snow',
:phone => '555-555-1212'
})
printf("Wrote record %s\n", record.meta.record_id)
Client client = ...; // Get a client instance
Map<String, String> lyric = new HashMap<>();
lyric.put("line", "Say I'm the only bee in your bonnet");
lyric.put("song", "Birdhouse in Your Soul");
lyric.put("artist", "They Might Be Giants");
String recordType = "lyric";
client.write(recordType, new RecordData(lyric), null, new ResultHandler<Record>() {
@Override
public void handle(Result<Record> r) {
if(! r.isError()) {
// record written successfully
Record record = r.asValue();
// Log or print record ID, e.g.:
System.out.println("Record ID: " + record.meta().recordId());
}
else {
// an error occurred
throw new RuntimeException(r.asError().other());
}
}
}
);
// Wrap message in RecordData type to designate
// it as sensitive information for encryption
let recordData = RecordData(cleartext: ["SSN": "123-45-6789"])
// Can optionally include arbitrary metadata as `plain`
// where neither keys nor values are encrypted
e3db.write(type: "UserInfo", data: recordData, plain: ["Sent from": "my iPhone"]) { result in
switch result {
// The operation was successful, here's the record
case .success(let record):
// `record.meta` holds metadata associated
// with the record, such as type.
print("Wrote record! \(record.meta.recordId)")
case .failure(let error):
print("An error occurred attempting to write the data: \(error)")
}
}
}

Have questions? Contact us at help@tozny.com