Dever v0.0.2

This commit is contained in:
Codex committed 2026-11-27 06:03:56 +00:00
commit e6e175ebcf
816 files changed
+120349

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
use dever_runtime::{crypto, task, Bytes};
for size in [16, 32, 1024] {
let secret = @generate@(size).unwrap();
assert_eq!(format!("{secret:?}"), "Secret([REDACTED])");
let message = Bytes::from_static(b"public-test-message");
let first = crypto::hmac_sha256(&secret, &message);
let second = crypto::hmac_sha256(&secret, &message);
assert!(crypto::constant_time_eq(&first, &second));
let different = @sign@(size, &message).unwrap();
assert!(!crypto::constant_time_eq(&first, &different));
assert!(@captured@(size));
@handled@(size).unwrap();
task::run(true, 1, async |scope| @spawned@(scope, size).await).unwrap().unwrap();
}
for size in [i64::MIN, 0, 15, 1025, i64::MAX] {
let error = @generate@(size).unwrap_err();
assert!(format!("{error:?}").contains("token length must be between 16 and 1024 bytes"));
assert!(!@captured@(size));
assert!(@handled@(size).is_err());
assert!(task::run(true, 1, async |scope| @spawned@(scope, size).await).unwrap().is_err());
}