API - createProtectedSource
Create a source that is safe to publish over the network. The resulting object conforms to the Protected Source API. This source provides:
authentication - identity verification and sessions
permissions - intercepts disallowed actions on docs, according to a configuration
A protected source can be created as follows. For authentication, you must provide at least one auth provider, which is used to identify the user.
const rootPasswordHash = await hashSecureString(password);
const rootProvider = RootAuthProvider({
rootPasswordHash,
});
const protectedSource = createProtectedSource({
source,
providers: [rootProvider],
});