Skip to content

Commit

Permalink
chore: fix signature example
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Oct 25, 2023
1 parent 187dbfa commit c7d2477
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion actix-web-lab/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- Remove `sse::{SseSendError, SseTrySendError, SseData, SseMessage}` type aliases.
- Remove `web::Redirect` responder and `web::redirect()` function.
- Remove `guard::Acceptable` guard type.
- Update `ed25519-dalek` dependency to `2`.

## 0.19.2

Expand Down
8 changes: 4 additions & 4 deletions actix-web-lab/examples/discord_webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ use actix_web::{
use actix_web_lab::extract::{Json, RequestSignature, RequestSignatureScheme};
use async_trait::async_trait;
use bytes::{BufMut as _, BytesMut};
use ed25519_dalek::{PublicKey, Signature, Verifier as _};
use ed25519_dalek::{Signature, Verifier as _, VerifyingKey};
use hex_literal::hex;
use once_cell::sync::Lazy;
use rustls::{Certificate, PrivateKey, ServerConfig};
use rustls_pemfile::{certs, pkcs8_private_keys};
use tracing::info;

const APP_PUBLIC_KEY_BYTES: &[u8] =
const APP_PUBLIC_KEY_BYTES: &[u8; 32] =
&hex!("d7d9a14753b591be99a0c5721be8083b1e486c3fcdc6ac08bfb63a6e5c204569");

static SIG_HDR_NAME: HeaderName = HeaderName::from_static("x-signature-ed25519");
static TS_HDR_NAME: HeaderName = HeaderName::from_static("x-signature-timestamp");
static APP_PUBLIC_KEY: Lazy<PublicKey> =
Lazy::new(|| PublicKey::from_bytes(APP_PUBLIC_KEY_BYTES).unwrap());
static APP_PUBLIC_KEY: Lazy<VerifyingKey> =
Lazy::new(|| VerifyingKey::from_bytes(APP_PUBLIC_KEY_BYTES).unwrap());

#[derive(Debug)]
struct DiscordWebhook {
Expand Down

0 comments on commit c7d2477

Please sign in to comment.