Function ssb_verify_signatures::verify_message [−][src]
pub fn verify_message<T: AsRef<[u8]>>(msg: T) -> Result<(), Error>
Verify the signature of an entire ssb message that has key
and value
.
It expects the messages to be the JSON encoded message of shape: {key: "", value: {}}
Example
use ssb_verify_signatures::verify_message; let valid_message = r##"{ "key": "%kmXb3MXtBJaNugcEL/Q7G40DgcAkMNTj3yhmxKHjfCM=.sha256", "value": { "previous": "%IIjwbJbV3WBE/SBLnXEv5XM3Pr+PnMkrAJ8F+7TsUVQ=.sha256", "author": "@U5GvOKP/YUza9k53DSXxT0mk3PIrnyAmessvNfZl5E0=.ed25519", "sequence": 8, "timestamp": 1470187438539, "hash": "sha256", "content": { "type": "contact", "contact": "@ye+QM09iPcDJD6YvQYjoQc7sLF/IFhmNbEqgdzQo3lQ=.ed25519", "following": true, "blocking": false }, "signature": "PkZ34BRVSmGG51vMXo4GvaoS/2NBc0lzdFoVv4wkI8E8zXv4QYyE5o2mPACKOcrhrLJpymLzqpoE70q78INuBg==.sig.ed25519" }, "timestamp": 1571140551543 }"##; let result = verify_message(valid_message.as_bytes()); assert!(result.is_ok());