Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document using multiple codecs in the readme #67

Closed
tflyons opened this issue Sep 27, 2019 · 1 comment · Fixed by #69
Closed

Document using multiple codecs in the readme #67

tflyons opened this issue Sep 27, 2019 · 1 comment · Fixed by #69

Comments

@tflyons
Copy link
Contributor

tflyons commented Sep 27, 2019

Is your feature request related to a problem? Please describe.

I'd like the ability to more easily rotate keys by being able to add a list of valid decryption keys.

Describe the solution you'd like

Change
New(hashKey, blockKey []byte) to
New(hashKey, blockKey []byte, decodeKeys ...[]byte) and add a check that if a cookie cannot be decoded with the hashKey to try with the decode keys until one matches or all fail. This would allow users to have some logic like
New(todaysKey(), nil, tomorrowsKey(), yesterdaysKey()) and rotate keys automatically even in a distributed environment. It would also preserve backwards compatibility with New(hashKey, nil).

Describe alternatives you've considered

There's the obvious, just don't rotate the keys. Or coordinate a failover mechanism by chaining decodes using multiple secure cookies. This seems like a more straightforward approach however.

@tflyons
Copy link
Contributor Author

tflyons commented Sep 27, 2019

Alternative solution: adding methods such as RotateHashIn(hashKey []byte)/RotateHashOut(hashKey []byte)/RotateBlockIn(blockKey []byte)/RotateBlockOut(blockKey []byte)
'In' methods to move a new key into the hashKey/blockKey variable and move the old key into a hash/block slice for decoding. 'Out' methods to remove a key from the slice.

@tflyons tflyons changed the title Add an option to decode against multiple keys [feature] Document using multiple codecs in the readme Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant