Secret resource
You can provide configuration data for multiple Microvisor-empowered IoT devices using the Secret resource. Secrets are intended as a way to upload confidential data to the Twilio cloud so it need not be baked into application code. Instead, the application code running on the device retrieves the Secret when it needs the information.
Unlike Configs, Secrets' values cannot be accessed via the API once they have been created. The retrieval actions listed below will return Secrets' metadata, not their values.
Each Secret is a key:value pair which your application code can access using Microvisor System Calls.
Keys are text identifiers of up to 100 characters in length. They must be unique for a given account.
Values must also be supplied as text, of up to 4096 characters in length. If you wish to make binary data available to your devices, you will need to encode it as text before creating the Secret. For example, you might used base64 encoding. Your application must decode the value back to binary after acquiring it from the Twilio cloud.
Secret resources are accessed at this endpoint:
_10https://microvisor.twilio.com/v1/Secrets
Secret resources are accessible from all devices associated with an account. For Secrets that are made available to specific devices, please see Device Secrets.
Resource properties
key
type: string
The secret key; up to 100 characters.
date_rotated
type: string<date-time>
url
type: string<uri>
The absolute URL of the Secret.
POST https://microvisor.twilio.com/v1/Secrets
Request body parameters
Key
type: stringRequired
The secret key; up to 100 characters.
Value
type: stringRequired
The secret value; up to 4096 characters.
_10// Download the helper library from https://www.twilio.com/docs/node/install
_10// Find your Account SID and Auth Token at twilio.com/console
_10// and set the environment variables. See http://twil.io/secure
_10const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10const authToken = process.env.TWILIO_AUTH_TOKEN;
_10const client = require('twilio')(accountSid, authToken);
_10client.microvisor.v1.accountSecrets
_10 .create({key: 'key_name', value: 'value'})
_10 .then(account_secret => console.log(account_secret.key));
_10 "date_rotated": "2021-01-01T12:34:56Z",
_10 "url": "https://microvisor.twilio.com/v1/Secrets/first"
URI parameters
Key
type: string
The secret key; up to 100 characters.
_10// Download the helper library from https://www.twilio.com/docs/node/install
_10// Find your Account SID and Auth Token at twilio.com/console
_10// and set the environment variables. See http://twil.io/secure
_10const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10const authToken = process.env.TWILIO_AUTH_TOKEN;
_10const client = require('twilio')(accountSid, authToken);
_10client.microvisor.v1.accountSecrets('Key_name')
_10 .then(account_secret => console.log(account_secret.key));
_10 "date_rotated": "2021-01-01T12:34:57Z",
_10 "url": "https://microvisor.twilio.com/v1/Secrets/first"
DELETE https://microvisor.twilio.com/v1/Secrets/{Key}
URI parameters
Key
type: string
The secret key; up to 100 characters.
_10// Download the helper library from https://www.twilio.com/docs/node/install
_10// Find your Account SID and Auth Token at twilio.com/console
_10// and set the environment variables. See http://twil.io/secure
_10const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10const authToken = process.env.TWILIO_AUTH_TOKEN;
_10const client = require('twilio')(accountSid, authToken);
_10client.microvisor.v1.accountSecrets('key_name').remove();