reenable some features
This commit is contained in:
parent
9abc7519d4
commit
81d8d7bfcc
4 changed files with 11 additions and 10 deletions
|
@ -15,9 +15,8 @@ base64 = "0.13"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
err-derive = "0.3"
|
err-derive = "0.3"
|
||||||
|
|
||||||
dryoc = { version = "0.4", optional = true }
|
dryoc = { version = "0.5", optional = true }
|
||||||
serde = { version = "1.0", optional = true, default-features = false, features = ["derive"] }
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
#default = [ "dryoc", "serde" ]
|
default = [ "dryoc", "serde" ]
|
||||||
#default = [ "serde" ]
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pub mod decode;
|
mod decode;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ use crate::is_string_char;
|
||||||
|
|
||||||
pub use decode::*;
|
pub use decode::*;
|
||||||
|
|
||||||
pub const STR_INLINE_MAX: usize = 18;
|
pub(crate) const STR_INLINE_MAX: usize = 18;
|
||||||
|
|
||||||
pub type Pos = u32;
|
pub(crate) type Pos = u32;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct ITerm(Pos);
|
pub struct ITerm(Pos);
|
||||||
|
|
|
@ -38,8 +38,8 @@ pub fn compute_signature(message: &[u8], secret_key: &sign::SecretKey) -> sign::
|
||||||
|
|
||||||
/// Verify the ed25519 signature of a message using a public key
|
/// Verify the ed25519 signature of a message using a public key
|
||||||
pub fn verify_signature(
|
pub fn verify_signature(
|
||||||
signature: &sign::Signature,
|
signature: sign::Signature,
|
||||||
message: &[u8],
|
message: Vec<u8>,
|
||||||
public_key: &sign::PublicKey,
|
public_key: &sign::PublicKey,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
sign::SignedMessage::from_parts(signature.clone(), message)
|
sign::SignedMessage::from_parts(signature.clone(), message)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//! A text-based data format for cryptographic network protocols.
|
//! A text-based data format for cryptographic network protocols.
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
|
//! #[cfg(feature = "dryoc")] {
|
||||||
//! use nettext::enc::*;
|
//! use nettext::enc::*;
|
||||||
//! use nettext::dec::*;
|
//! use nettext::dec::*;
|
||||||
//! use nettext::crypto::*;
|
//! use nettext::crypto::*;
|
||||||
|
@ -46,10 +47,11 @@
|
||||||
//!
|
//!
|
||||||
//! let [verb, arg1, arg2, pubkey] = object2.seq_of().unwrap();
|
//! let [verb, arg1, arg2, pubkey] = object2.seq_of().unwrap();
|
||||||
//! let pubkey = pubkey.public_key().unwrap();
|
//! let pubkey = pubkey.public_key().unwrap();
|
||||||
//! assert!(verify_signature(&signature, payload.raw(), &pubkey));
|
//! assert!(verify_signature(signature, payload.raw().to_vec(), &pubkey));
|
||||||
//!
|
//!
|
||||||
//! assert_eq!(verb.string().unwrap(), "CALL");
|
//! assert_eq!(verb.string().unwrap(), "CALL");
|
||||||
//! assert_eq!(arg1.string().unwrap(), "myfunction");
|
//! assert_eq!(arg1.string().unwrap(), "myfunction");
|
||||||
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! The value of `signed_payload` would be as follows:
|
//! The value of `signed_payload` would be as follows:
|
||||||
|
|
Loading…
Reference in a new issue