Skip to content

Document using multiple codecs in the readme #67

@tflyons

Description

@tflyons

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions