tka, types/key: add NLPublic.KeyID

This allows direct use of NLPublic with tka.Authority.KeyTrusted() and
similar without using tricks like converting the return value of Verifier.

Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
This commit is contained in:
Adrian Dewhurst
2022-10-26 15:14:01 -04:00
committed by Adrian Dewhurst
parent 944f43f1c8
commit 8c09ae9032
2 changed files with 43 additions and 0 deletions

View File

@@ -125,3 +125,8 @@ func (k NLPublic) IsZero() bool {
func (k NLPublic) Equal(other NLPublic) bool {
return subtle.ConstantTimeCompare(k.k[:], other.k[:]) == 1
}
// KeyID returns a tkatype.KeyID that can be used with a tka.Authority.
func (k NLPublic) KeyID() tkatype.KeyID {
return k.k[:]
}