Commit a384644 1 parent ab9f435 commit a384644 Copy full SHA for a384644
File tree 3 files changed +47
-4
lines changed
3 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,32 @@ func (a *UtilArgs) BuildCommands() []*ucli.Command {
47
47
},
48
48
},
49
49
},
50
+ {
51
+ Name : "read-private" ,
52
+ Usage : "loads a private key pem and prints the peer id" ,
53
+ Action : a .RunReadPrivatePeerId ,
54
+ Flags : []ucli.Flag {
55
+ & ucli.StringFlag {
56
+ Name : "file" ,
57
+ Aliases : []string {"f" },
58
+ Usage : "file to load pem formatted private key" ,
59
+ Destination : & a .FilePath ,
60
+ },
61
+ },
62
+ },
63
+ {
64
+ Name : "read-public" ,
65
+ Usage : "loads a public key pem and prints the peer id" ,
66
+ Action : a .RunReadPublicPeerId ,
67
+ Flags : []ucli.Flag {
68
+ & ucli.StringFlag {
69
+ Name : "file" ,
70
+ Aliases : []string {"f" },
71
+ Usage : "file to load pem formatted public key" ,
72
+ Destination : & a .FilePath ,
73
+ },
74
+ },
75
+ },
50
76
{
51
77
Name : "derive-public" ,
52
78
Usage : "loads a private key pem and writes a public key" ,
Original file line number Diff line number Diff line change @@ -59,6 +59,26 @@ func (a *UtilArgs) RunGeneratePrivate(_ *cli.Context) error {
59
59
return nil
60
60
}
61
61
62
+ // RunReadPublicPeerId loads a public key and prints the peer ID.
63
+ func (a * UtilArgs ) RunReadPublicPeerId (_ * cli.Context ) error {
64
+ rp , err := a .readInputFilePubKey ()
65
+ if err != nil {
66
+ return err
67
+ }
68
+ _ , err = os .Stdout .WriteString (rp .GetPeerID ().String () + "\n " )
69
+ return err
70
+ }
71
+
72
+ // RunReadPrivatePeerId loads a private key and prints the peer ID.
73
+ func (a * UtilArgs ) RunReadPrivatePeerId (_ * cli.Context ) error {
74
+ rp , err := a .readInputFilePrivKey ()
75
+ if err != nil {
76
+ return err
77
+ }
78
+ _ , err = os .Stdout .WriteString (rp .GetPeerID ().String () + "\n " )
79
+ return err
80
+ }
81
+
62
82
// RunDerivePublic derives the public key from a private pem.
63
83
func (a * UtilArgs ) RunDerivePublic (_ * cli.Context ) error {
64
84
rp , err := a .readInputFilePrivKey ()
@@ -76,6 +96,7 @@ func (a *UtilArgs) RunDerivePublic(_ *cli.Context) error {
76
96
return nil
77
97
}
78
98
99
+
79
100
// RunDerivePublic derives the ssh public key from a private or public pem.
80
101
func (a * UtilArgs ) RunDeriveSshPublic (_ * cli.Context ) error {
81
102
rp , err := a .readInputFilePubKey ()
Original file line number Diff line number Diff line change @@ -120,8 +120,6 @@ github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw
120
120
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 /go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4 =
121
121
github.com/pion/datachannel v1.5.9 h1:LpIWAOYPyDrXtU+BW7X0Yt/vGtYxtXQ8ql7dFfYUVZA =
122
122
github.com/pion/datachannel v1.5.9 /go.mod h1:kDUuk4CU4Uxp82NH4LQZbISULkX/HtzKa4P7ldf9izE =
123
- github.com/pion/dtls/v3 v3.0.3 h1:j5ajZbQwff7Z8k3pE3S+rQ4STvKvXUdKsi/07ka+OWM =
124
- github.com/pion/dtls/v3 v3.0.3 /go.mod h1:weOTUyIV4z0bQaVzKe8kpaP17+us3yAuiQsEAG1STMU =
125
123
github.com/pion/dtls/v3 v3.0.4 h1:44CZekewMzfrn9pmGrj5BNnTMDCFwr+6sLH+cCuLM7U =
126
124
github.com/pion/dtls/v3 v3.0.4 /go.mod h1:R373CsjxWqNPf6MEkfdy3aSe9niZvL/JaKlGeFphtMg =
127
125
github.com/pion/ice/v4 v4.0.2 h1:1JhBRX8iQLi0+TfcavTjPjI6GO41MFn4CeTBX+Y9h5s =
@@ -150,8 +148,6 @@ github.com/pion/transport/v3 v3.0.7 h1:iRbMH05BzSNwhILHoBoAPxoB9xQgOaJk+591KC9P1
150
148
github.com/pion/transport/v3 v3.0.7 /go.mod h1:YleKiTZ4vqNxVwh77Z0zytYi7rXHl7j6uPLGhhz9rwo =
151
149
github.com/pion/turn/v4 v4.0.0 h1:qxplo3Rxa9Yg1xXDxxH8xaqcyGUtbHYw4QSCvmFWvhM =
152
150
github.com/pion/turn/v4 v4.0.0 /go.mod h1:MuPDkm15nYSklKpN8vWJ9W2M0PlyQZqYt1McGuxG7mA =
153
- github.com/pion/webrtc/v4 v4.0.1 h1:6Unwc6JzoTsjxetcAIoWH81RUM4K5dBc1BbJGcF9WVE =
154
- github.com/pion/webrtc/v4 v4.0.1 /go.mod h1:SfNn8CcFxR6OUVjLXVslAQ3a3994JhyE3Hw1jAuqEto =
155
151
github.com/pion/webrtc/v4 v4.0.2 h1:fBwm5/hqSUybrCWl0DDBSTDrpbkcgkqpeLmXw9CsBQA =
156
152
github.com/pion/webrtc/v4 v4.0.2 /go.mod h1:moylBT2A4dNoEaYBCdV1nThM3TLwRHzWszIG+eSPaqQ =
157
153
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4 =
You can’t perform that action at this time.
0 commit comments