API reference
SkmEngine
Section titled “SkmEngine”static newDeviceId(): stringstatic open<K>(opts: EngineOptions<K>): Promise<SkmEngine<K>>
// graphsopenGraph(graphId, o?: SubscriptionSpec & {create?: boolean}): Promise<GraphStatus>subscribe(graphId, spec: SubscriptionSpec): voidgraphs(): string[]hasKey(graphId): boolean
// recordsput(graphId, {id?, kind, data, deleted?, by?}): Promise<GraphRecord>putMany(graphId, partials[]): Promise<GraphRecord[]>remove(graphId, id): Promise<void>removeMany(graphId, ids[]): Promise<void>get(graphId, id): Promise<GraphRecord | null>list(graphId): Promise<GraphRecord[]>listKind(graphId, kind, limit?): Promise<GraphRecord[]>search(graphId, query, limit?): Promise<GraphRecord[]>searchAll(query, limit?): Promise<Array<{graphId, record}>>personalId(kind, target): Promise<string>
// reactivitywatch<T>(graphId, query, onResult): () => voidon(event: EngineEventName | '*', fn): () => voidreadonly status: EngineStatus
// syncsync(): Promise<void>syncGraph(graphId): Promise<void>flush(): Promise<void>poke(graphId): Promise<void>startAutoSync(everyMs?): voidstopAutoSync(): voidclose(): Promise<void>
// keys and devicescreateGraphKey(graphId): Promise<GraphStatus>grantPending(graphId): Promise<number>rotate(graphId): Promise<number>listDevices(): Promise<Array<{deviceId, label, createdAt, revokedAt}>>revokeDevice(deviceId): Promise<{rotated: string[]; failed: string[]; owed: number}>
// invites and recoverysealKeyringForInvite(graphId): Promise<{salt, sealedKeyring, keySecret} | null>acceptInviteKeyring(graphId, {salt, sealedKeyring, keySecret}): Promise<boolean>exportBundle(passphrase): Promise<string>importBundle(blob, passphrase): Promise<void>
// blobsuploadBlob(graphId, bytes, {policy?, ttlMs?}): Promise<string>downloadBlob(graphId, blobId): Promise<Uint8Array>ackBlob(graphId, blobId): Promise<void>@skm/client exports
Section titled “@skm/client exports”(SkmEngine, HttpTransport, TransportError);(MemoryGraphStore, IdbGraphStore, OpfsGraphStore, SqlGraphStore, bestStore, migrateStore);(MemoryKeyStore, IdbKeyStore);(defineKinds, validateRecord, recordBytes);// types(EngineOptions, EngineStatus, EngineEvent, EngineEventName, GraphStatus, GraphKeyState, RetryPolicy, SubscriptionSpec, Transport, HttpTransportOptions, PullFilter, GraphStore, KeyStore, KindRegistry, KindValidator, KindData, ValidationFailure, GraphRecord, RosterDevice);@skm/client/node: NodeSqliteGraphStore, FileKeyStore, SqlGraphStore.
@skm/client/opfs-worker: the worker entry point for OpfsGraphStore.
@skm/relay exports
Section titled “@skm/relay exports”(registerRelay, sweepBlobs, DEFAULT_QUOTAS);(openDb, migrate, transact, now, Statements, SCHEMA_VERSION);(SqliteDirectory, SqliteBlobStore, FileBlobStore, MemoryRateLimiter, NO_LIMIT);// types(RelayOptions, RelayQuotas, RelayRateLimits, RelayEvent, SkmIdentity, PokeEvent, SweepOptions, Db, OpenDbOptions, Directory, BlobStore, RateLimiter, BucketSpec);@skm/core exports
Section titled “@skm/core exports”skmcrypto; // the whole crypto boundary, namespaced(LIMITS, PBKDF2_ITERATIONS, clearKeyCache, parse);(composeInvite, splitInvite);(recordSigningBytes, recordAad, blobAad, storageKeyFor, isSafeId, splitFilter);// schemas and types(GraphId, GraphOpIn, GraphOpOut, GraphPush, GraphPushResp, GraphPullResp, PullQuery, GraphRecordShape, RecordEnvelope, GraphRecord, Keyring, KeyringShape, DeviceRegister, RosterDevice, KeyGap, GraphKeysPut, GraphKeysResp, RecoveryBundle, RecoveryPayload, Sealed, WrappedKey, DeviceKeyPair);