Skip to content

API reference

static newDeviceId(): string
static open<K>(opts: EngineOptions<K>): Promise<ArgalaEngine<K>>
// graphs
openGraph(graphId, o?: SubscriptionSpec & {create?: boolean}): Promise<GraphStatus>
subscribe(graphId, spec: SubscriptionSpec): void
graphs(): string[]
hasKey(graphId): boolean
// records
put(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>
// reactivity
watch<T>(graphId, query, onResult): () => void
on(event: EngineEventName | '*', fn): () => void
readonly status: EngineStatus
// sync
sync(): Promise<void>
syncGraph(graphId): Promise<void>
flush(): Promise<void>
poke(graphId): Promise<void>
startAutoSync(everyMs?): void
stopAutoSync(): void
close(): Promise<void>
// keys and devices
createGraphKey(graphId): Promise<GraphStatus>
grantPending(graphId): Promise<number>
rotate(graphId): Promise<number>
listDevices(): Promise<Array<{deviceId, pubJwk, sigJwk, selfSig, label, createdAt, revokedAt, current}>>
// approving a device before it is handed a key — see Part 14
pendingDevices(graphId?): Promise<PendingDevice[]>
myPairingCode(): Promise<string>
approveDevice(deviceId, fingerprint): Promise<void>
rejectDevice(deviceId): Promise<void>
forgetDevice(deviceId): Promise<void>
trustedDevices(): Array<{deviceId} & Pin>
revokeDevice(deviceId): Promise<{rotated: string[]; failed: string[]; owed: number}>
// invites and recovery
sealKeyringForInvite(graphId): Promise<{salt, sealedKeyring, keySecret} | null>
acceptInviteKeyring(graphId, {salt, sealedKeyring, keySecret}, spec?): Promise<boolean>
exportBundle(passphrase): Promise<string>
importBundle(blob, passphrase): Promise<void>
// blobs
uploadBlob(graphId, bytes, {policy?, ttlMs?}): Promise<string>
downloadBlob(graphId, blobId): Promise<Uint8Array>
ackBlob(graphId, blobId): Promise<void>
ArgalaEngine, HttpTransport, TransportError
MemoryGraphStore, IdbGraphStore, OpfsGraphStore, SqlGraphStore, bestStore, migrateStore
MemoryKeyStore, IdbKeyStore
defineKinds, validateRecord, recordBytes, RESERVED_PREFIX
requestPersistence, storageEstimate, pressure, PRESSURE_WARNING
formatPairingCode
// types
EngineOptions, EngineStatus, EngineEvent, EngineEventName, GraphStatus, GraphKeyState,
LogVerification, LogAlarmReason, StorageStatus, RetryPolicy, SubscriptionSpec, Transport,
HttpTransportOptions, PullFilter, GraphStore, KeyStore, KindRegistry, KindValidator,
KindData, ValidationFailure, GraphRecord, RosterDevice, Pin, PendingDevice

@argala/client/node: NodeSqliteGraphStore, FileKeyStore, SqlGraphStore. @argala/client/opfs-worker: the worker entry point for OpfsGraphStore.

registerRelay, sweepBlobs, DEFAULT_QUOTAS
openDb, migrate, transact, now, Statements, SCHEMA_VERSION
SqliteDirectory, SqliteBlobStore, FileBlobStore, ALL_CAPABILITIES
MemoryRateLimiter, SharedRateLimiter, MemoryCounterStore, NO_LIMIT
// types
RelayOptions, RelayQuotas, RelayRateLimits, RelayEvent, ArgalaIdentity, PokeEvent,
SweepOptions, Db, OpenDbOptions, Directory, Capability, BlobStore, RateLimiter,
BucketSpec, CounterStore
argalacrypto // the whole crypto boundary, namespaced
LIMITS, PBKDF2_ITERATIONS, CHECKPOINT_KIND, CHECKPOINT_STRIDE, clearKeyCache, sha256B64, parse
composeInvite, splitInvite, chainGenesis, chainAdvance
deviceFingerprint, pairingCode, formatPairingCode, selfAttestationBytes, PAIRING_CODE_CHARS
jwkThumbprint, crockford32, parseCrockford, stretchBytes
recordSigningBytes, recordAad, blobAad, storageKeyFor, isSafeId, splitFilter
// schemas and types
GraphId, GraphOpIn, GraphOpOut, GraphPush, GraphPushResp, GraphPullResp, PullQuery,
LogEntry, LogQuery, LogResp, Checkpoint,
GraphRecordShape, RecordEnvelope, GraphRecord, Keyring, KeyringShape, DeviceRegister,
RosterDevice, KeyGap, GraphKeysPut, GraphKeysResp, RecoveryBundle, RecoveryPayload,
Sealed, WrappedKey, DeviceKeyPair