Skip to the question box
CodeAsk

Example answer, generated 2 Nov 2026 with qwen3.8-27b on commit 672971d. Claims and citations checked by the author; the answer may leave things out.

How does it support rotating to a new secret key while old keys still work?

The library supports key rotation by accepting an iterable of secret keys and storing them as a list ordered from oldest to newest.

  1. Key Storage: Both Signer and Serializer accept secret_key as a string, bytes, or an iterable. The helper function _make_keys_list converts this into a list[bytes] stored in self.secret_keys . The documentation explicitly states this list is ordered "from oldest to newest" .

  2. Signing: When signing data, the system uses the newest key. The secret_key property returns the last item in the list (self.secret_keys[-1]), which is used by default in derive_key .

  3. Verification: When verifying a signature, the system iterates through the keys in reverse order (newest to oldest). The verify_signature method loops through reversed(self.secret_keys), deriving a key for each and checking if the signature matches. It returns True as soon as a valid key is found . This allows old signatures to remain valid as long as their corresponding key is still in the list.

  4. Serializer Support: The Serializer class implements the same logic, storing secret_keys via _make_keys_list and providing a secret_key property that returns the newest key .

Tap a citation to see the code.

Suggested questions

0 / 400

Answers cite the lines they use. Voyage may keep and train on questions. Please don’t enter personal information. Privacy (opens in a new tab)