SDK ReferenceTypeScript SDK

Keyring

Usage

Access this class through the composio.keyring property:

const composio = new Composio({ apiKey: 'your-api-key' });
const result = await composio.keyring.list();

Methods

listTransferKeys()

Lists the public transfer keys of the organization's active customer keyring, the keys a secret is sealed to before it is sent to Composio.

Always seal new secrets to the key whose kid is activeKid: a JWE with RSA-OAEP-256 key management, A256GCM content encryption, and the kid in the protected header. Older keys stay listed so values sealed to them remain openable.

The organization behind the API key must have an ACTIVE customer keyring instance; otherwise the API answers 404.

async listTransferKeys(requestOptions?: ComposioRequestOptions): Promise<{ activeKid: string; keys: { alg: string; e: string; kid: string; kty: string; n: string; use: string }[] }>

Parameters

NameType
requestOptions?ComposioRequestOptions

Returns

Promise<\{ activeKid: string; keys: \{ alg: string; e: string; kid: string; kty: string; n: string; use: string \}[] \}> — The active key ID and every accepted public JWK, newest first

Example

import { CompactEncrypt, importJWK } from 'jose';

const { activeKid, keys } = await composio.keyring.listTransferKeys();
const jwk = keys.find(key => key.kid === activeKid)!;
const sealed = await new CompactEncrypt(new TextEncoder().encode(secret))
  .setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM', kid: activeKid })
  .encrypt(await importJWK(jwk, 'RSA-OAEP-256'));