Add support for comments and reblogging to Blog Client

Comments and reblogs need to depend on the post they refer to.
Since message dependencies are limited to one group,
the post and also the comments need to be wrapped
when commented on or reblogged to another blog.

For this reason, in addition to comments, two new wrapping message types
are introduced. They retain all data of the original messages and allow
for reconstruction and signature verification.

This commit breaks backwards compatibility with old blog posts.
It removes the content type, title and parent ID from the post
message structure.
This commit is contained in:
Torsten Grote
2016-08-11 19:34:52 -03:00
parent 743fc7dd1f
commit 3dd3a18694
29 changed files with 874 additions and 320 deletions

View File

@@ -1,8 +1,10 @@
package org.briarproject.api.blogs;
import org.briarproject.api.FormatException;
import org.briarproject.api.data.BdfList;
import org.briarproject.api.identity.LocalAuthor;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.Message;
import org.briarproject.api.sync.MessageId;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -11,9 +13,30 @@ import java.security.GeneralSecurityException;
public interface BlogPostFactory {
BlogPost createBlogPost(@NotNull GroupId groupId, @Nullable String title,
long timestamp, @Nullable MessageId parent,
@NotNull LocalAuthor author, @NotNull String contentType,
@NotNull byte[] body)
BlogPost createBlogPost(@NotNull GroupId groupId, long timestamp,
@Nullable MessageId parent, @NotNull LocalAuthor author,
@NotNull String body)
throws FormatException, GeneralSecurityException;
Message createBlogComment(GroupId groupId, LocalAuthor author,
@Nullable String comment, MessageId originalId, MessageId wrappedId)
throws FormatException, GeneralSecurityException;
/** Wraps a blog post */
Message createWrappedPost(GroupId groupId, byte[] descriptor,
long timestamp, BdfList body)
throws FormatException;
/** Re-wraps a previously wrapped post */
Message createWrappedPost(GroupId groupId, BdfList body)
throws FormatException;
/** Wraps a blog comment */
Message createWrappedComment(GroupId groupId, byte[] descriptor,
long timestamp, BdfList body, MessageId currentId)
throws FormatException;
/** Re-wraps a previously wrapped comment */
Message createWrappedComment(GroupId groupId, BdfList body,
MessageId currentId) throws FormatException;
}