File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " secrets"
3
- version = " 0.0 .0"
3
+ version = " 0.10 .0"
4
4
license = " MIT"
5
5
6
6
authors = [" Stephen Touset <stephen@touset.org>" ]
7
7
description = " Protected-access memory for cryptographic secrets"
8
8
9
9
homepage = " https://github.com/stouset/secrets"
10
+ repository = " https://github.com/stouset/secrets"
10
11
documentation = " https://stouset.github.io/secrets"
11
- repository = " git@github.com:stouset/secrets"
12
12
readme = " README.md"
13
13
14
14
keywords = [ " crypto" , " cryptography" , " allocator" ]
Original file line number Diff line number Diff line change @@ -21,7 +21,29 @@ Buffers allocated through this library:
21
21
Example
22
22
-------
23
23
24
- Coming soon. Library very much in flux.
24
+ Generating a random secret:
25
+
26
+ ``` rust
27
+ use secrets :: Secret ;
28
+
29
+ let secret = Secret :: random (32 );
30
+ let secret_r = secret . borrow ();
31
+
32
+ println! (" {:?}" , secret_r . as_slice ());
33
+ ```
34
+
35
+ Creating a secret from existing data:
36
+
37
+ ``` rust
38
+ use secrets :: Secret ;
39
+
40
+ let mut string = " password" . to_string ();
41
+ let secret = Secret :: from (unsafe { string . as_mut_vec () });
42
+ let secret_r = secret . borrow ();
43
+
44
+ println! (" {}" , string ); // NUL bytes
45
+ println! (" {:?}" , secret_r . as_slice ()); // b"string"
46
+ ```
25
47
26
48
Documentation
27
49
-------------
You can’t perform that action at this time.
0 commit comments