@spawnco/server
Version:
Server SDK
32 lines (28 loc) • 899 B
TypeScript
import { SpawnServerSDK__V0, TokenPayload } from '@spawnco/sdk-types';
export * from '@spawnco/sdk-types';
interface Env {
SPAWN_VARIANT_ID?: string;
SPAWN_CONFIG_VERSION?: string;
SPAWN_API_URL?: string;
SPAWN_SDK_API_KEY?: string;
SPAWN_ROOM_ID?: string;
}
interface IStorage {
get<T>(key: string): Promise<T | null>;
set<T>(key: string, value: T): Promise<void>;
delete(key: string): Promise<void>;
}
interface CreateSDKOptions {
storage: IStorage;
}
declare function createSDK<TConfig = any>(env: Env, options?: CreateSDKOptions): SpawnServerSDK__V0<TConfig>;
declare class TokenVerifier {
private jwksUrl;
private cache;
private readonly CACHE_DURATION;
constructor(jwksUrl?: string);
verify(token: string): Promise<TokenPayload>;
private getPublicKey;
clearCache(): void;
}
export { type IStorage, TokenVerifier, createSDK };