The following explores how the delegation key will be used to sign operations during document editing. What exactly is the key signing and how does it end up in operation history.
The message that gets signed for each operation is proposed to be a triplet:
powerhouse document model operation with its parametersThe size of a digital signature can vary depending on the specific algorithm used for signing. Commonly used algorithms for digital signatures include RSA and ECDSA (Elliptic Curve Digital Signature Algorithm).
Example Message Structure
Given the detailed signature content requirements, our message to be signed could be structured as a JSON object, which includes the above.
{
"timestamp": "2023-03-10T14:48:00Z",
"operation": {
"type": "ADD_LINE_ITEM",
"input": {
"walletIndex": 0,
"month": "2023-03",
"budgetCategory": "Operational Expenses",
"amount": 5000
}
},
"previousStateHash": "4a6f75849b...[truncated]",
"context": {
"branch": "main",
"scope": "global",
"documentID": "doc-123456789"
},
"signature": "MEUCIQDx5tLXiJh3GfQ+KdG...[truncated]"
}
With EIP-712 we’ll use a standard for typed structured data hashing and signing in metamask, aiming to improve the user experience when interacting with signed data. It allows users to see exactly what they're signing, in a human-readable format, instead of just signing a hexadecimal hash.
{
"documentID": "unique-document-identifier",
"documentState": {
// Current state of the document
},
"operationHistory": [
{
"operation": "CREATE_DOCUMENT",
"parameters": {
// Parameters of the operation
},
"timestamp": 1622547600,
"signature": "signature-for-operation-1"
},
{
"operation": "ADD_LINE_ITEM",
"parameters": {
// Parameters of the operation
},
"timestamp": 1622548600,
"signature": "signature-for-operation-2"
}
// More operations as the document evolves
],
"signatures": [
"signature-for-operation-1",
"signature-for-operation-2"
// Additional signatures corresponding to each subsequent operation.
// Adding list of signatures could be optional.
]
}