Fix response body of /3pid/bind to match spec

- synapse did not check/validate the response as per spec until 0.99.5 it seems
- mxisd was never compliant also
This commit is contained in:
Max Dor
2019-05-30 13:26:38 +02:00
parent 544f8e59f0
commit 0ddd086bda
11 changed files with 65 additions and 22 deletions

View File

@@ -30,6 +30,18 @@ import java.util.Objects;
public interface SignatureManager {
/**
* Sign the message with the default domain and add the signature to the <code>signatures</code> key.
* <p>
* If the key does not exist yet, it is created. If the key exist, the produced signature will be merged with any
* existing ones.
*
* @param message The message to sign with the default domain and add the produced signature to
* @return The provided message with the new signature
* @throws IllegalArgumentException If the <code>signatures</code> key exists and its value is not a JSON object
*/
JsonObject signMessageGson(JsonObject message) throws IllegalArgumentException;
/**
* Sign the message and add the signature to the <code>signatures</code> key.
* <p>
@@ -39,7 +51,7 @@ public interface SignatureManager {
* @param domain The domain under which the signature should be added
* @param message The message to sign and add the produced signature to
* @return The provided message with the new signature
* @throws IllegalArgumentException If the <code>signatures</code> value is not a JSON object
* @throws IllegalArgumentException If the <code>signatures</code> key exists and its value is not a JSON object
*/
default JsonObject signMessageGson(String domain, JsonObject message) throws IllegalArgumentException {
JsonElement signEl = message.remove(EventKey.Signatures.get());