Migrate from legacy `Crittora` to `CrittoraClient`
Applies to: @crittora/sdk-js legacy users
Migration target: CrittoraClient
Last updated: March 8, 2026
New integrations should use CrittoraClient. The legacy Crittora class remains useful for compatibility, but it should not be the default for new development.
Why migrate
- CrittoraClient makes auth, credentials, timeout, and retry behavior explicit.
- The newer client aligns better with multi-environment and production service patterns.
- Typed request and response objects reduce ambiguity in application code.
Before
import { Crittora } from "@crittora/sdk-js";
const sdk = new Crittora();
const { IdToken } = await sdk.authenticate(username, password);
const encrypted = await sdk.encrypt(IdToken, "hello");After
import { CrittoraClient } from "@crittora/sdk-js";
const client = new CrittoraClient({
credentials: {
apiKey: process.env.CRITTORA_API_KEY!,
},
auth: {
type: "bearer",
token: process.env.CRITTORA_ID_TOKEN!,
},
});
const encrypted = await client.encrypt({
data: "hello",
});Migration checklist
- Replace implicit legacy auth flow with explicit auth configuration.
- Move from positional method arguments to typed request objects.
- Set base URL, timeout, and retry behavior intentionally.
