Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
py 39 lines 1.37 KB
Raw
1 """
2 Keyring module for the Composio SDK.
3
4 Exposes ``composio.keyring`` for the organization's customer-managed keyring.
5 """
6
7 from __future__ import annotations
8
9 from composio.client.types import keyring_list_transfer_keys_response
10 from composio.core.models.base import Resource
11
12
13 class Keyring(Resource):
14 """The organization's customer-managed keyring."""
15
16 def list_transfer_keys(
17 self,
18 ) -> keyring_list_transfer_keys_response.KeyringListTransferKeysResponse:
19 """
20 List the public transfer keys of the organization's active customer
21 keyring, the keys a secret is sealed to before it is sent to Composio.
22
23 Seal new secrets to the key whose ``kid`` is ``active_kid``: a JWE
24 with ``RSA-OAEP-256`` key management, ``A256GCM`` content
25 encryption, and the ``kid`` in the protected header. Older keys stay
26 listed so values sealed to them remain openable. The API answers 404
27 when the organization has no ACTIVE keyring instance.
28
29 :return: ``active_kid`` and every accepted public JWK under ``keys``,
30 newest first.
31
32 Example:
33 transfer_keys = composio.keyring.list_transfer_keys()
34 jwk = next(
35 key for key in transfer_keys.keys
36 if key.kid == transfer_keys.active_kid
37 )
38 """
39 return self._client.keyring.list_transfer_keys()