UNPKG

minauth

Version:

A TypeScript library for building authentication systems on top of the Mina blockchain and other zero-knowledge proofs solutions.

39 lines 1.91 kB
import * as fpPlugin from './plugin-fp-api.js'; import { launchTE } from '../utils/fp/taskeither.js'; export * from '../plugin/plugintype.js'; export { configurationSchema } from './plugin-fp-api.js'; export * from '../plugin/interfacekind.js'; import * as log from 'tslog'; import { launchPluginRuntime } from './pluginruntime.js'; const defaultRootLoggerConfiguration = { name: 'minauth-plugin-system', type: 'pretty', minLevel: 2 // debug }; const defaultRootLogger = new log.Logger(defaultRootLoggerConfiguration); /** Read the configuration from a file * The file path can be passed from $MINAUTH_CONFIG env var and * defaults to `config.yaml` in the current working directory */ export const readConfiguration = (cfgPath, logger = defaultRootLogger) => launchTE(fpPlugin.readConfiguration(logger)(cfgPath)); /** * Given a logger and plugin configuration, initialize the plugins. * Provided plugins will be transformed to the functional style interface, * to used as such by the library. */ export const initializePlugins = (cfg, logger = defaultRootLogger) => launchTE(fpPlugin.initializePlugins(logger)(cfg)); /** * Install custom routes for all the active plugins. * The routes are installed under `/plugins/${pluginName}`. * and come from `pluginInstance.customRoutes`. * The routes are meant for plugin / prover communication. */ export const installCustomRoutes = (env, app) => launchPluginRuntime(env)(fpPlugin.installCustomRoutes(app)); /** * Verify proof with given plugin and return its output. */ export const verifyProof = (env, input, pluginName) => launchPluginRuntime(env)(fpPlugin.verifyProof(input, pluginName)); /** Validate the output of a plugin within the active plugin runtime. */ export const validateOutput = (env, output, pluginName) => launchPluginRuntime(env)(fpPlugin.validateOutput(pluginName, output)); //# sourceMappingURL=plugin-promise-api.js.map