|
53 | 53 | //! First, Alice uses `EphemeralSecret::new()` and then
|
54 | 54 | //! `PublicKey::from()` to produce her secret and public keys:
|
55 | 55 | //!
|
56 |
| -#![cfg_attr(feature = "docsrs", doc = "```")] |
57 |
| -#![cfg_attr(not(feature = "docsrs"), doc = "```ignore")] |
| 56 | +//! ```rust |
58 | 57 | //! use rand_core::OsRng;
|
59 | 58 | //! use x25519_dalek::{EphemeralSecret, PublicKey};
|
60 | 59 | //!
|
|
64 | 63 | //!
|
65 | 64 | //! Bob does the same:
|
66 | 65 | //!
|
67 |
| -#![cfg_attr(feature = "docsrs", doc = "```")] |
68 |
| -#![cfg_attr(not(feature = "docsrs"), doc = "```ignore")] |
| 66 | +//! ```rust |
69 | 67 | //! # use rand_core::OsRng;
|
70 | 68 | //! # use x25519_dalek::{EphemeralSecret, PublicKey};
|
71 | 69 | //! let bob_secret = EphemeralSecret::new(OsRng);
|
|
76 | 74 | //! loudly meows `bob_public` back to Alice. Alice now computes her
|
77 | 75 | //! shared secret with Bob by doing:
|
78 | 76 | //!
|
79 |
| -#![cfg_attr(feature = "docsrs", doc = "```")] |
80 |
| -#![cfg_attr(not(feature = "docsrs"), doc = "```ignore")] |
| 77 | +//! ```rust |
81 | 78 | //! # use rand_core::OsRng;
|
82 | 79 | //! # use x25519_dalek::{EphemeralSecret, PublicKey};
|
83 | 80 | //! # let alice_secret = EphemeralSecret::new(OsRng);
|
|
89 | 86 | //!
|
90 | 87 | //! Similarly, Bob computes a shared secret by doing:
|
91 | 88 | //!
|
92 |
| -#![cfg_attr(feature = "docsrs", doc = "```")] |
93 |
| -#![cfg_attr(not(feature = "docsrs"), doc = "```ignore")] |
| 89 | +//! ```rust |
94 | 90 | //! # use rand_core::OsRng;
|
95 | 91 | //! # use x25519_dalek::{EphemeralSecret, PublicKey};
|
96 | 92 | //! # let alice_secret = EphemeralSecret::new(OsRng);
|
|
102 | 98 | //!
|
103 | 99 | //! These secrets are the same:
|
104 | 100 | //!
|
105 |
| -#![cfg_attr(feature = "docsrs", doc = "```")] |
106 |
| -#![cfg_attr(not(feature = "docsrs"), doc = "```ignore")] |
| 101 | +//! ```rust |
107 | 102 | //! # use rand_core::OsRng;
|
108 | 103 | //! # use x25519_dalek::{EphemeralSecret, PublicKey};
|
109 | 104 | //! # let alice_secret = EphemeralSecret::new(OsRng);
|
|
0 commit comments