chore: fix

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-09-24 01:14:50 +02:00
parent ca532681e5
commit 8a648c98cc
10 changed files with 24 additions and 24 deletions

View File

@@ -16,18 +16,18 @@ pub struct Metadata {
}
pub fn wrap<'a>(domain: &'a str, entity: &'a str, content: &'a [u8]) -> Vec<u8> {
let output = serde_json::to_vec(&Envelope {
serde_json::to_vec(&Envelope {
content: general_purpose::URL_SAFE_NO_PAD.encode(content),
metadata: Metadata {
domain: domain.to_string(),
entity: entity.to_string(),
},
})
.unwrap();
output
.unwrap()
}
pub fn unwrap<'a>(message: &'a [u8]) -> Result<(Vec<u8>, Metadata), EnvelopeError> {
pub fn unwrap(message: &[u8]) -> Result<(Vec<u8>, Metadata), EnvelopeError> {
let envelope: Envelope = serde_json::from_slice(message).map_err(EnvelopeError::JsonError)?;
Ok((