Skip to content

Conversation

@cmenginnz
Copy link
Contributor

No description provided.

@cmenginnz cmenginnz mentioned this pull request Aug 16, 2023
}

func IsChiselKey(chiselKey []byte) bool {
return string(chiselKey[:len(ChiselKeyPrefix)]) == ChiselKeyPrefix
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be strings.HasPrefix

also, are key lengths static? Can we also check total length here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the length is static or not.

Below is the code that calculates the length. Hard to say it will be constant forever.
encodedPrivateKey := make([]byte, base64.RawStdEncoding.EncodedLen(len(b)))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, the length of encodedPrivateKey is 162, but you mentioned it's 163.

@jpillora
Copy link
Owner

jpillora commented Aug 16, 2023 via email

@jpillora jpillora merged commit 346065a into jpillora:go121 Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants