From 91cf2dcc55e4b7ecd69817d1e390ae6e96e46a88 Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Wed, 11 Mar 2026 11:21:06 +0100 Subject: Add Key method to CipherState for key retrieval --- cipher.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cipher.go b/cipher.go index 057cf97..6b0266e 100644 --- a/cipher.go +++ b/cipher.go @@ -121,3 +121,13 @@ func (cs *CipherState) Clear() { cs.aead = nil cs.nonce = 0 } + +// Key returns a copy of the cipher key. +func (cs *CipherState) Key() []byte { + if cs.key == nil { + return nil + } + key := make([]byte, len(cs.key)) + copy(key, cs.key) + return key +} -- cgit v1.3.1