mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Trim whitespace from privateKey before parsing
This commit is contained in:
parent
4d60aeae18
commit
f59071ff1c
1 changed files with 2 additions and 1 deletions
3
app.go
3
app.go
|
@ -724,7 +724,8 @@ func readOrCreatePrivateKey(path string) (*key.MachinePrivate, error) {
|
||||||
return nil, fmt.Errorf("failed to read private key file: %w", err)
|
return nil, fmt.Errorf("failed to read private key file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
privateKeyEnsurePrefix := PrivateKeyEnsurePrefix(string(privateKey))
|
trimmedPrivateKey := strings.TrimSpace(string(privateKey))
|
||||||
|
privateKeyEnsurePrefix := PrivateKeyEnsurePrefix(trimmedPrivateKey)
|
||||||
|
|
||||||
var machineKey key.MachinePrivate
|
var machineKey key.MachinePrivate
|
||||||
if err = machineKey.UnmarshalText([]byte(privateKeyEnsurePrefix)); err != nil {
|
if err = machineKey.UnmarshalText([]byte(privateKeyEnsurePrefix)); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue