From c7d2477dd7bd3f4d7d43fc43120e3b34cfd4234d Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Wed, 25 Oct 2023 01:22:48 +0100 Subject: [PATCH] chore: fix signature example --- actix-web-lab/CHANGELOG.md | 1 - actix-web-lab/examples/discord_webhook.rs | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/actix-web-lab/CHANGELOG.md b/actix-web-lab/CHANGELOG.md index 61ffb4d4..e35693bd 100644 --- a/actix-web-lab/CHANGELOG.md +++ b/actix-web-lab/CHANGELOG.md @@ -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 diff --git a/actix-web-lab/examples/discord_webhook.rs b/actix-web-lab/examples/discord_webhook.rs index 86fb4b5a..400fa3b0 100644 --- a/actix-web-lab/examples/discord_webhook.rs +++ b/actix-web-lab/examples/discord_webhook.rs @@ -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 = - Lazy::new(|| PublicKey::from_bytes(APP_PUBLIC_KEY_BYTES).unwrap()); +static APP_PUBLIC_KEY: Lazy = + Lazy::new(|| VerifyingKey::from_bytes(APP_PUBLIC_KEY_BYTES).unwrap()); #[derive(Debug)] struct DiscordWebhook {