ID returns the KeyID of the key.
()
| 83 | |
| 84 | // ID returns the KeyID of the key. |
| 85 | func (k Key) ID() (tkatype.KeyID, error) { |
| 86 | switch k.Kind { |
| 87 | // Because 25519 public keys are so short, we just use the 32-byte |
| 88 | // public as their 'key ID'. |
| 89 | case Key25519: |
| 90 | return tkatype.KeyID(k.Public), nil |
| 91 | default: |
| 92 | return nil, fmt.Errorf("unknown key kind: %v", k.Kind) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // Ed25519 returns the ed25519 public key encoded by Key. An error is |
| 97 | // returned for keys which do not represent ed25519 public keys. |