Tozny
Search…
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
Ruby
Go
PHP
CLI

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
1
import e3db
2
3
token = 'YOUR_REGISTRATION_TOKEN_HERE'
4
client_name = 'example name'
5
6
public_key, private_key = e3db.Client.generate_keypair()
7
8
# Register your client
9
client_info = e3db.Client.register(token, client_name, public_key)
10
11
config = e3db.Config(
12
client_info.client_id,
13
client_info.api_key_id,
14
client_info.api_secret,
15
public_key,
16
private_key
17
)
18
19
# To save this Configuration to disk, do the following:
20
config.write()
21
22
# Instantiate your client to communicate with TozStore
23
client = e3db.Client(config())
Copied!

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