SDK reference
Server SDK reference
Exports of @lynkoria/server 0.1.0, generated from its type declarations.
Package @lynkoria/server, version 0.1.0. Node.js 22.12+ (engines). Server-side only: it holds the service key.
Generated from the package's bundled type declarations; every signature below is what your editor sees. For how to use it, read the guide.
Functions
createLynkoriaServer
function createLynkoriaServer(opts: LynkoriaServerOptions): LynkoriaServer;verifyWebhook
Standalone verifier: t=<unix>,v1=<hex HMAC-SHA256(secret, "<t>.<rawBody>")>; rejects stale timestamps.
function verifyWebhook<T = Record<string, unknown>>(rawBody: string, header: string | null | undefined, secrets: string[], nowSeconds?: number): WebhookEvent<T>;Types
LynkoriaServer
type LynkoriaServer = {
calls: {
create(input: CreateCallRequest): Promise<Call>;
get(callId: string): Promise<Call>;
joinToken(input: JoinTokenRequest & {
callId: string;
}): Promise<JoinTokenResponse>;
end(callId: string): Promise<Call>;
removeParticipant(callId: string, identity: string): Promise<void>;
setRole(callId: string, identity: string, role: ParticipantRole): Promise<void>;
signal(callId: string, input: CallSignalRequest): Promise<void>;
};
sessions: {
messagingToken(input: MessagingTokenRequest): Promise<MessagingTokenResponse>;
};
users: {
suspend(userId: string): Promise<void>;
unsuspend(userId: string): Promise<void>;
};
conversations: {
create(input: CreateConversationRequest): Promise<Conversation>;
addMembers(conversationId: string, userIds: string[]): Promise<void>;
removeMember(conversationId: string, userId: string): Promise<void>;
};
notifications: {
/** Queues push notifications to users' registered devices; resolves with the queued count. */
send(input: SendNotificationRequest): Promise<SendNotificationResponse>;
};
recordings: {
start(callId: string, input: StartRecordingRequest): Promise<Recording>;
list(callId: string): Promise<Recording[]>;
get(recordingId: string): Promise<Recording>;
stop(recordingId: string): Promise<Recording>;
/** Short-lived signed URL for one output file of a finished recording. */
download(recordingId: string, file: string): Promise<RecordingDownload>;
delete(recordingId: string): Promise<void>;
};
webhooks: {
/** Verifies `Lynkoria-Signature` over the raw (unparsed) body and returns the event. Throws on failure. */
verify<T = Record<string, unknown>>(rawBody: string, signatureHeader: string | null | undefined, nowSeconds?: number): WebhookEvent<T>;
};
};LynkoriaServerOptions
type LynkoriaServerOptions = {
/** e.g. https://api.lynkoria.com */
baseUrl: string;
/** `lynk_live_…` / `lynk_test_…` from your secret manager. Never ship it to a client. */
serviceKey: string;
/** Signing secret for verifying Lynkoria webhooks (`whsec_…`). Pass several during rotation. */
webhookSecret?: string | string[];
fetch?: typeof fetch;
/** Per attempt. Default 10 s. */
timeoutMs?: number;
/**
* Retries for idempotent operations after a network error, timeout, 429, 502, 503 or 504, with
* exponential backoff and jitter (honoring `Retry-After`). Default 2; 0 disables.
*/
maxRetries?: number;
};Re-exported
Also exported from this package: ErrorCode (from @lynkoria/contracts), LynkoriaError (from @lynkoria/contracts), WEBHOOK_SIGNATURE_HEADER (from @lynkoria/contracts).
export type * from "@lynkoria/contracts"