The Portabella SDK is the open source package that powers all interactions on Portabella. It handles:

  • generating new private keys
  • authenticating requests via signatures
  • encrypting and decrypting payloads
  • wrapping and unwrapping keys for collaboration purposes.

NPM: https://www.npmjs.com/package/@portabella/sdk GitHub: https://github.com/portabellainc/privanote

While we iron out the HTTP API documentation it's best to just look at the generated typedocs that come with the package.

At the most basic level here are some actions you migh be interested in doing:

Initialising the SDK#

You can initialise the SDK as follows:

import {ProjectSDK} from '@portabella/sdk';
const sdk = new ProjectSDK({
token: '<YOUR_PRIVATE_KEY>',
projectId: '<YOUR_PROJECT_ID>'

Before you read or write any data you'll need to prime the SDK for that action. If you're wanting to read data, make sure you call await sdk.fetchProject(), this forces the SDK to fetch the private key for the project so you can decrypt data.

If you want to write you can do await sdk.loadPublicKey() and that will fetch the projects public key so you can write data to it.

Creating a task#

Now that you've initialised the SDK you can create your first task, doing so looks a little like this:

const {id} = await sdk.addCard({ title: "My first card" });

You can refer to the generated typedocs for additional properties to pass through here. The SDK will handle all aspects of encryption.

Reading a task#

Reading a created task is as easy as created one. The SDK will handle all aspects of decryption.

const card = await sdk.fetchCard('<YOUR_CARD_ID>');