Update a Policy
Policies can be updated by the Key Owner. The update process replaces the existing policy with a new one.
Process Overview
- Define New Policy: The user defines the new policy rules in JSON format.
- Submit Request: The user creates a request payload containing the
key_idand thenew_policy. - Sign Request: The request is signed by the Key Owner (User) to ensure authenticity.
- Node Validation & Update: The Node validates the signature and the new policy content. Then, it calculates the MAC for the new policy and updates the record in the database.
Upon receiving the request, the Node performs the following:
- Authentication: Authenticates the request using the provided signatures (e.g.
user_sig,WPBE_sig). - Integrity Check: Retrieves the existing policy and verifies its MAC to ensure it hasn't been tampered with.
- MAC Calculation: The Node calculates the MAC from the
new_policycontent. - Update: The existing policy is replaced with the
new_policy, and the new MAC is stored.
Update Policy in Silent Network
Example
Follow this instruction to setup your Wallet Backend
curl -X POST "http://<YOUR_WALLET_BACKEND_ENDPOINT>/v2/rest/updatePolicy" \
-H "Content-Type: application/json" \
-d '{
"payload": {
"keyId": "YOUR_KEY_ID_HERE",
"policy": {
"version": "1.0",
"description": "EIP-191 Policy",
"rules": [{
"description": "Allow specific message",
"issuer": [{"type": "UserId", "id": "alice"}],
"action": "allow",
"chain_type": "ethereum",
"conditions": [{
"transaction_type": "eip191",
"transaction_attr": "message",
"operator": "eq",
"value": "Sign me"
}]
}]
}
},
"userSignatures": { ... }
}'