Files
Shade/packages/shade-sdk/src/create-shade.ts

24 lines
602 B
TypeScript
Raw Normal View History

import { resolveConfig, type ShadeConfig } from './config.js';
import { Shade } from './shade.js';
/**
* Create and initialize a Shade instance in one call.
*
* ```ts
* const shade = await createShade({
* prekeyServer: 'https://shade.example.com',
* storage: 'sqlite:/data/shade.db',
* });
*
* await shade.send('bob@example.com', 'hello');
* ```
*
* See ShadeConfig for all options.
*/
export async function createShade(config: ShadeConfig): Promise<Shade> {
const resolved = resolveConfig(config);
const shade = new Shade(resolved);
await shade.initialize();
return shade;
}