File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ pub struct Ed25519Sha256 {
36
36
pub signature : Option < [ u8 ; 64 ] > ,
37
37
}
38
38
39
+ impl Default for Ed25519Sha256 {
40
+ fn default ( ) -> Self {
41
+ Self :: new ( )
42
+ }
43
+ }
44
+
39
45
impl Ed25519Sha256 {
40
46
pub fn new ( ) -> Self {
41
47
Self {
@@ -49,7 +55,7 @@ impl Ed25519Sha256 {
49
55
}
50
56
51
57
pub fn sign ( & mut self , message : & [ u8 ] , private_key : & [ u8 ; 32 ] ) {
52
- let signing_key = SigningKey :: from_bytes ( & private_key) ;
58
+ let signing_key = SigningKey :: from_bytes ( private_key) ;
53
59
let verifying_key = signing_key. verifying_key ( ) ;
54
60
self . public_key = Some ( verifying_key. 0 ) ;
55
61
@@ -77,8 +83,8 @@ impl Fulfillment for Ed25519Sha256 {
77
83
78
84
// TODO: handle unwrap()
79
85
fn serialize_binary ( & self ) -> Vec < u8 > {
80
- let public_key: & [ u8 ] = & self . public_key . as_ref ( ) . unwrap ( ) . as_slice ( ) ;
81
- let signature: & [ u8 ] = & self . signature . as_ref ( ) . unwrap ( ) . as_slice ( ) ;
86
+ let public_key: & [ u8 ] = self . public_key . as_ref ( ) . unwrap ( ) . as_slice ( ) ;
87
+ let signature: & [ u8 ] = self . signature . as_ref ( ) . unwrap ( ) . as_slice ( ) ;
82
88
let fulfillment = Ed25519Sha256Fulfillment {
83
89
public_key : Some ( public_key) ,
84
90
signature : Some ( signature) ,
Original file line number Diff line number Diff line change @@ -4,9 +4,7 @@ pub struct Base64Url;
4
4
5
5
impl Base64Url {
6
6
pub fn decode ( url : & str ) -> Vec < u8 > {
7
- let buffer = base64_url:: decode ( url) . unwrap ( ) ;
8
-
9
- buffer
7
+ base64_url:: decode ( url) . unwrap ( )
10
8
}
11
9
12
10
pub fn encode ( buffer : & [ u8 ] ) -> String {
You can’t perform that action at this time.
0 commit comments