Encryptor
Create a channel for a secret and upload an encryption
POST /encryptions
Description
Secrets are secured within a channel of a PAD instance. To create an encryption Channel
, you must upload an Encryption
object to the server. At any time, the decryptor can retrieve the Encryption
object using the hash of the token value, which acts as an identifier of the channel. The decryptor may choose to retrieve the Encryption
object immediately in order to independently store the encrypted values, or may only do so when a decryption is requested. In any case, no decryption can occur unless the decryptor has posted a data request and sufficient trustees and validators have responded. Read the code samples section for details and information about how to construct Encryption
objects.
To facilitate updating the Encryption
object securely in some use cases (Find-me, for example), you can send a channel key along with this request. This ensures only you who has the private key counterpart of the channel key can change the Encryption
object in this channel.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
| body | true | none | |
| body | string | true | A PEM-encoded (public) verification key for the channel |
Example
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | Succeeded | ||
401 | API key is missing or invalid | ||
409 | Conflict |
200 OK
The encryption has been successfully uploaded onto the server.
Example
401 Unauthorized
API key is missing or incorrect.
Example
409 Conflict
A channel with the same token already exists. The client should use another token or update the encryption on the channel.
Example
Get encryption status
GET /encryptions/{token-hash}/status
Description
This retrieves the status of an encryption
, namely whether or not the data has been requested by the decryptor. If a request has been made, then this status also gives which trustees and validators have responded to the data request. This information is retrieved and provided by the PAD server. To eliminate the need to trust the PAD service, this data should be checked for consistency with trustee attestations of the ledger state.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
| path | true | Hash value of the token in hexadecimal |
Example
GET /encryptions/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/status
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | Succeeded | Inline | |
401 | API key is missing or invalid; Or the client lacks permission |
200 OK
Successfully retrieved the status of an Encryption
.
Schema
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
| boolean | true | none | none |
| object | true | none | none |
» | true | none | none | |
» | boolean | true | none | none |
» | false | none | none | |
» | false | none | none | |
» | array<TrusteeId> | false | none | none |
» | array<ValidatorId> | false | none | none |
Example
401 Unauthorized
API key is missing or incorrect.
Example
Update encryption
PUT /encryptions/{token-hash}
Description
In some use cases (e.g. Find-me), secrets may be generated as a stream of data and the decryptor can make a request for only the most recent secret. This endpoint allows the encryptor to update the Encryption
after establishing an encryption channel.
To ensure only you can use this endpoint, you must sign the Encryption
object with the channel private key.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
| path | true | Hash value of the token | |
| body | string<Encryption> | true | The new, stringified encryption object |
| body | true | The signature with the channel private key against |
Example
PUT /encryptions/d033713dd14552c060c55746afdb989cfee8e624ae94a932d79fd25630f728a4
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | Succeeded | ||
400 | Bad Request | Tokens in path and body are inconsistent | |
401 | API key is missing or invalid; Or the client lacks permission |
200 OK
The Encryption
is successfully updated.
Example
400 Bad Request
The request failed because tokens in path and body are inconsistent.
Example
401 Unauthorized
Api key is missing or incorrect.
Example
Schemas
TrusteeId
ID of a trustee. It contains only alphanumerical characters, underscores (_) and dashes (-). It has length inclusively between 3 and 30.
Example
Schema
Type | Restrictions |
---|---|
string |
|
ValidatorId
ID of a validator. It contains only alphanumerical characters, underscores (_) and dashes (-). It has length inclusively between 3 and 30.
Example
Schema
Type | Restrictions |
---|---|
string |
|
Encryption
An Encryption
is identified by tokenHash
and the instance in which it lives. It contains the ciphertext encrypted by both the decryptor's key and a fresh symmetric key k
. It also contains the encrypted shares of k
for the trustees and validators. For more details, read the code samples page.
Example
Schema
Name | Type | Required | Description |
---|---|---|---|
| string | true | none |
| true | none | |
| dict<TrusteeId, object> | true | none |
» [ | object | true | none |
»» | string | true | none |
»» | true | none | |
| dict<ValidatorId, object> | true | none |
» [ | object | true | none |
»» | true | none | |
| true | none |
Sha256
A Sha256 hash value as a hexidecimal string.
Example
Schema
Type | Restrictions |
---|---|
string |
|
DateTime
A timestamp in ISO 8601 format.
Example
Schema
Type | Restrictions |
---|---|
string | - |
Trustee
An object listing details of a trustee, including its ID, human-readable description/name, its role (Trustee
) and its public keys.
Example
Schema
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
| true |
| none | |
| string | true |
| none |
| enum | true | none | none |
| string | true | none | PEM-encoded (public) encryption key of the trustee. Used by encryptors at encryption time |
| string | true | none | PEM-encoded (public) verification key of trustee |
Enumerated Values
Property | Value |
---|---|
role |
|
Validator
An object listing details of a validator, including its ID, human-readable description/name, its role (Validator
) and its public keys.
Example
Schema
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
| true | - | none | |
| string | true |
| none |
`role | enum` | true | none | none |
| string | true | none | PEM-encoded (public) encryption key of the validator. Used by encryptors at encryption time |
| string | true | none | PEM-encoded (public) verification key of validator |
Enumerated Values
Property | Value |
---|---|
role |
|
Base64
A base64-encoded binary data.
Example
Schema
Type | Restrictions |
---|---|
string | none |
Ciphertext
A piece of asymmetrically encrypted ciphertext. It is created by first generating a symmetric ephemeral key, encrypt symmetrically the message using the ephemeral key, then encrypt asymmetrically the ephemeral key by an encryption key. All binary data are encoded in base64. For details, read the code samples.
Example
Schema
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
| object | true | none | Cipher of a message encrypted with an ephemeral key |
» | true | none | none | |
» | true | none | none | |
| true | none | The ephemeral key encrypted by an asymmetric encryption key |
PadInstanceMetadata
Information about a PAD instance. That includes the instance name, its list of trustees, the trustee threshold, the list of validators and the validator threshold.
Example
Schema
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
| true | none | none | |
| array<TrusteeId> | true | none | none |
| integer | true | none | none |
| array<ValidatorId> | true | none | none |
| integer | true | none | none |
ApiResponse
Example
Schema
Name | Type | Required | Description |
---|---|---|---|
| boolean | true | The request is successful or not |
| string | true | none |
Token
A 128-bit random string kept secret between the encryptor and decryptor after encryption stage and before data request stage. It identifies a data request. Its hash value identifies an encryption
. The decryptor posts it on the ledger at data request stage.
Example
Schema
Type | Restrictions |
---|---|
string |
|
PadName
ID of a PAD instance. Its length must be inclusively between 4 and 30. It should contains only lowercase letters, digits, periods (.
) or dashes (-
). It must start with a lowercase letter.
It is seldom used as a request parameter because the API key in the request already identifies a PAD instance.
Example
Schema
Type | Restrictions |
---|---|
string |
|
Last updated