From 9bd3b5b89c60534a9066902ae54b52f5797365bd Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 19 Jul 2022 14:39:55 -0700 Subject: [PATCH] types/key: add ControlPrivate.Shared wrapper too Follow-up to cfdb8626738da. Change-Id: Iab610d761f1e6d88e8bcb584d9c02cafe48fc377 Signed-off-by: Brad Fitzpatrick --- types/key/control.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/key/control.go b/types/key/control.go index cdd18eb4a..3784c6e1c 100644 --- a/types/key/control.go +++ b/types/key/control.go @@ -56,6 +56,11 @@ func (k ControlPrivate) SealTo(p MachinePublic, cleartext []byte) (ciphertext [] return k.mkey.SealTo(p, cleartext) } +// SharedKey returns the precomputed Nacl box shared key between k and p. +func (k ControlPrivate) SharedKey(p MachinePublic) MachinePrecomputedSharedKey { + return k.mkey.SharedKey(p) +} + // OpenFrom opens the NaCl box ciphertext, which must be a value // created by SealTo, and returns the inner cleartext if ciphertext is // a valid box from p to k.