Doc
The Doc
envelope allows storing data on chain with some great aditional features:
- Double encryption for added security.
- Add multiple recipients to an encrypted payload.
- Add multiple signers.
- Ability to add metadata within a protected header.
- Payload deterministic encryption keys.
By making use of these features, mintBlue users can:
- Save and retrieve files on chain.
- Own their own data by determining who gets access to the documents, using encryption.
- Authenticate data by adding one or more digital signatures
- Double encryption allows for selective disclosure of data. The first encryption layer can be disclosed by selected recipients while keeping the document private, stored in a second encryption layer.
- Encryption secrets are deterministic based on payload (sha256). This means you either have to have the data to decrypt it or the secret needs to be shared, allowing users to authenticate a document with the blockchain by having acces to the original document.
The maximum file size is 50MB per transaction.
Creating a Doc Envelope
Creating a new Doc
envelope to be stored on chain, can be achieved by adding a specific output object of type doc
and add it to the createTransaction
outputs
argument.
This output type requires the following properties:
Property | Type | Description |
---|---|---|
data (required) | Uint8Array | Raw file contents. |
signers (required) | Array<jose.JWK> | Array of JWK signing private keys. |
options | Object | Optional metadata to store with the envelope. See properties below. |
options.filename (optional) | String | Document's filename. |
options.mimetype (optional) | String | Document's mimetype. |
options.meta (optional) | Object | Any additional metadata provided as an object. |
receivers (optional) | Array<jose.JWK> | Array<String> | Array of JWK public keys or hexadecimal public keys. Used to encrypt data for third parties. |
iterations (optional) | Number | PBKDF2 iterations to perform (defaults to 200 000). |
Example
const data = new Uint8Array(Buffer.from('My file contents'));
const outputs = [
{
type: 'doc',
data: data,
options: {
filename: 'my-file.pdf',
mimetype: 'application/pdf',
},
signers: [jwkSignKey],
iterations: 200000,
receivers: [jwkReceiverKey],
},
];
// Replace [PROJECT_ID] below with yours.
const { txid, rawtx } = await client.createTransaction({project_id: '[PROJECT_ID]', outputs});
OP_RETURN
The following OP_RETURN
arguments are created when a Hash
envelope is published on a blockchain transaction.
Index | Description | Value |
---|---|---|
0 | Protocol ID | "doc" |
1 | Envelope | Serialized JWE/JWS |