mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
No need to unwrap Bytes before adding to dictionary.
This commit is contained in:
@@ -61,15 +61,14 @@ class ForumManagerImpl implements ForumManager {
|
|||||||
try {
|
try {
|
||||||
BdfDictionary meta = new BdfDictionary();
|
BdfDictionary meta = new BdfDictionary();
|
||||||
meta.put("timestamp", p.getMessage().getTimestamp());
|
meta.put("timestamp", p.getMessage().getTimestamp());
|
||||||
if (p.getParent() != null)
|
if (p.getParent() != null) meta.put("parent", p.getParent());
|
||||||
meta.put("parent", p.getParent().getBytes());
|
|
||||||
if (p.getAuthor() != null) {
|
if (p.getAuthor() != null) {
|
||||||
Author a = p.getAuthor();
|
Author a = p.getAuthor();
|
||||||
BdfDictionary author = new BdfDictionary();
|
BdfDictionary authorMeta = new BdfDictionary();
|
||||||
author.put("id", a.getId().getBytes());
|
authorMeta.put("id", a.getId());
|
||||||
author.put("name", a.getName());
|
authorMeta.put("name", a.getName());
|
||||||
author.put("publicKey", a.getPublicKey());
|
authorMeta.put("publicKey", a.getPublicKey());
|
||||||
meta.put("author", author);
|
meta.put("author", authorMeta);
|
||||||
}
|
}
|
||||||
meta.put("contentType", p.getContentType());
|
meta.put("contentType", p.getContentType());
|
||||||
meta.put("local", true);
|
meta.put("local", true);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class ForumPostValidator extends BdfMessageValidator {
|
|||||||
KeyParser keyParser = crypto.getSignatureKeyParser();
|
KeyParser keyParser = crypto.getSignatureKeyParser();
|
||||||
PublicKey key = keyParser.parsePublicKey(author.getPublicKey());
|
PublicKey key = keyParser.parsePublicKey(author.getPublicKey());
|
||||||
// Serialise the data to be signed
|
// Serialise the data to be signed
|
||||||
BdfList signed = BdfList.of(g.getId(), timestamp, parentId,
|
BdfList signed = BdfList.of(g.getId(), timestamp, parent,
|
||||||
authorList, contentType, body);
|
authorList, contentType, body);
|
||||||
// Verify the signature
|
// Verify the signature
|
||||||
Signature signature = crypto.getSignature();
|
Signature signature = crypto.getSignature();
|
||||||
@@ -100,10 +100,10 @@ class ForumPostValidator extends BdfMessageValidator {
|
|||||||
// Return the metadata
|
// Return the metadata
|
||||||
BdfDictionary meta = new BdfDictionary();
|
BdfDictionary meta = new BdfDictionary();
|
||||||
meta.put("timestamp", timestamp);
|
meta.put("timestamp", timestamp);
|
||||||
if (parentId != null) meta.put("parent", parentId);
|
if (parent != null) meta.put("parent", parent);
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
BdfDictionary authorMeta = new BdfDictionary();
|
BdfDictionary authorMeta = new BdfDictionary();
|
||||||
authorMeta.put("id", author.getId().getBytes());
|
authorMeta.put("id", author.getId());
|
||||||
authorMeta.put("name", author.getName());
|
authorMeta.put("name", author.getName());
|
||||||
authorMeta.put("publicKey", author.getPublicKey());
|
authorMeta.put("publicKey", author.getPublicKey());
|
||||||
meta.put("author", authorMeta);
|
meta.put("author", authorMeta);
|
||||||
|
|||||||
@@ -83,8 +83,7 @@ class MessagingManagerImpl implements MessagingManager, AddContactHook,
|
|||||||
try {
|
try {
|
||||||
BdfDictionary meta = new BdfDictionary();
|
BdfDictionary meta = new BdfDictionary();
|
||||||
meta.put("timestamp", m.getMessage().getTimestamp());
|
meta.put("timestamp", m.getMessage().getTimestamp());
|
||||||
if (m.getParent() != null)
|
if (m.getParent() != null) meta.put("parent", m.getParent());
|
||||||
meta.put("parent", m.getParent().getBytes());
|
|
||||||
meta.put("contentType", m.getContentType());
|
meta.put("contentType", m.getContentType());
|
||||||
meta.put("local", true);
|
meta.put("local", true);
|
||||||
meta.put("read", true);
|
meta.put("read", true);
|
||||||
|
|||||||
Reference in New Issue
Block a user