Skip to content

Commit dd4addd

Browse files
authored
opaque-debug: release v0.3.1 (#1054)
1 parent 6918595 commit dd4addd

File tree

6 files changed

+105
-24
lines changed

6 files changed

+105
-24
lines changed

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opaque-debug/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## 0.3.1 (2024-03-01)
8+
### Added
9+
- Support for generic parameters ([#1053])
10+
11+
[#1053]: https://github.com/RustCrypto/utils/pull/1053
12+
13+
## 0.3.0 (2020-06-11)

opaque-debug/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[package]
22
name = "opaque-debug"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
authors = ["RustCrypto Developers"]
55
license = "MIT OR Apache-2.0"
66
description = "Macro for opaque Debug trait implementation"
77
documentation = "https://docs.rs/opaque-debug"
88
repository = "https://github.com/RustCrypto/utils"
99
edition = "2018"
10+
readme = "README.md"

opaque-debug/LICENSE-MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018-2019 The RustCrypto Project Developers
1+
Copyright (c) 2018-2024 The RustCrypto Project Developers
22

33
Permission is hereby granted, free of charge, to any
44
person obtaining a copy of this software and associated

opaque-debug/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# [RustCrypto]: Opaque Debug
2+
3+
[![crate][crate-image]][crate-link]
4+
[![Docs][docs-image]][docs-link]
5+
[![Build Status][build-image]][build-link]
6+
![Apache2/MIT licensed][license-image]
7+
![Rust Version][rustc-image]
8+
[![Project Chat][chat-image]][chat-link]
9+
10+
Macro for opaque Debug trait implementation.
11+
12+
## License
13+
14+
Licensed under either of:
15+
16+
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
17+
* [MIT license](http://opensource.org/licenses/MIT)
18+
19+
at your option.
20+
21+
### Contribution
22+
23+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
24+
25+
[//]: # (badges)
26+
27+
[crate-image]: https://img.shields.io/crates/v/opaque-debug.svg
28+
[crate-link]: https://crates.io/crates/opaque-debug
29+
[docs-image]: https://docs.rs/opaque-debug/badge.svg
30+
[docs-link]: https://docs.rs/opaque-debug/
31+
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
32+
[rustc-image]: https://img.shields.io/badge/rustc-1.41+-blue.svg
33+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
34+
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260052-utils
35+
[build-image]: https://github.com/RustCrypto/utils/workflows/opaque-debug/badge.svg?branch=master&event=push
36+
[build-link]: https://github.com/RustCrypto/utils/actions/workflows/opaque-debug.yml
37+
38+
[//]: # (general links)
39+
40+
[RustCrypto]: https://github.com/rustcrypto

opaque-debug/src/lib.rs

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
1-
//! Macro for opaque `Debug` trait implementation.
1+
//! Macro for opaque [`Debug`] trait implementation.
2+
//!
3+
//! In many cases it's convenient to have `Debug` implementation for all crate types,
4+
//! e.g. to allow deriving of `Debug` in user-defined structs. But at the same time, using
5+
//! the default derive macro can be a security hazard since it cause leaking of sensitive
6+
//! information, for example, through uncareful logging.
7+
//!
8+
//! This crate introduces the [`implement!`] macro which creates an opaque [`Debug`]
9+
//! implementation, which does not expose any internal type data.
10+
//!
11+
//! # Examples
12+
//! ```
13+
//! pub struct CryptoStuff {
14+
//! key: [u8; 16],
15+
//! }
16+
//!
17+
//! opaque_debug::implement!(CryptoStuff);
18+
//!
19+
//! let val = CryptoStuff { key: [42; 16] };
20+
//! assert_eq!(format!("{:?}", val), "CryptoStuff { ... }")
21+
//! ```
22+
//!
23+
//! The macro also support generic paramters:
24+
//! ```
25+
//! pub struct GenricCryptoStuff<K> {
26+
//! key: K,
27+
//! }
28+
//!
29+
//! opaque_debug::implement!(GenricCryptoStuff<K>);
30+
//!
31+
//! let val = GenricCryptoStuff { key: [42u8; 16] };
32+
//! assert_eq!(format!("{:?}", val), "GenricCryptoStuff<[u8; 16]> { ... }")
33+
//! ```
234
#![no_std]
335
#![doc(
436
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
@@ -19,12 +51,7 @@ macro_rules! format_params {
1951
};
2052
}
2153

22-
/// Macro for defining opaque `Debug` implementation.
23-
///
24-
/// It will use the following format: "StructName { ... }". While it's
25-
/// convenient to have it (e.g. for including into other structs), it could be
26-
/// undesirable to leak internal state, which can happen for example through
27-
/// uncareful logging.
54+
/// Macro for implementing an opaque `Debug` implementation.
2855
#[macro_export]
2956
macro_rules! implement {
3057
($struct:ident <$($params:ident),+>) => {

0 commit comments

Comments
 (0)