For a "classic" feed (ed25519 keys, json encoding, a messages following this spec look like:
var msg = {
key: "ssb:message/classic/THxjTGPuXvvxnbnAV7xVuVXdhDcmoNtDDN0j3UTxcd8=",
value: {
previous:
"ssb:message/classic/Tq07Se6h1qwnQKbg_JTmMEjG4JP2aQAO0LM8tIoRtNk=",
author: "ssb:feed/classic/ye-QM09iPcDJD6YvQYjoQc7sLF_IFhmNbEqgdzQo3lQ=",
sequence: 29048,
timestamp: 1581539387846,
hash: "sha256",
content: "d01U1de...cSAajGGGz9K/CoAhdjz2DzfgonOfzArB/1q/Bg==.box2", // <<<
signature: "kPwB4e0...6oj+yjiMhuKH5iFMS8wOQCBV3SvmlAw==.sig.ed25519",
},
};
Note the msg.value.content
is of form <base64>.box2
See the envelope-spec for how to derive this ciphertext, noting:
feed_id
is a binary encoding ofmsg.value.author
(see BFE)prev_msg_id
is a binary encoding ofmsg.value.previous
(see BFE)- if
previous
isnull
, encode the key part ofprev_msg_id
as a zero-filled buffer of the same length you'd normally have (for that type/format combo)
- if
- the envelope-spec returns the ciphertext as a Buffer, while in this layers we:
- encode that as a base64 encoded string
- suffix it with
.box2
as a clear signal for unboxers
Before encryption the content of this message looked like:
var content = {
type: "announcment",
text: "I'm having a pool party, y'all should come over Saturday!",
recps: [
"ssb:identity/group/g_JTmMEjG4JP2aQAO0LM8tIoRtNkTq07Se6h1qwnQKb=.cloaked", // a group_id
"ssb:feed/classic/YjoQc7sLF_ye-QM09iPcDJdzQo3lQD6YvQIFhmNbEqg=", // a feed_id
],
};
After boxing this becomes:
var ciphertext = "d01U1depQ...CoAhdjz2DzfgonOfzArB/1q/Bg==.box2";
Reminder: boxing takes into account further context than just the content (feed_id
+ prev_msg_id
)
Scenarios:
- vector1: unboxing a message from a person you're in some groups with
- vector2: unboxing a message from a person you're in some groups with (previous: null)
- vector3: unboxing a direct message
- vector4: creating a boxed content to a group + individual