minauth-simple-preimage-plugin
Version:
A very simple Minauth plugin that allows users to authenticate by providing a preimage to a given hash.
15 lines • 816 B
JavaScript
import * as E from 'fp-ts/lib/Either.js';
import { pipe } from 'fp-ts/lib/function.js';
import { wrapZodDec } from 'minauth/dist/plugin/encodedecoder.js';
import { fpInterfaceTag } from 'minauth/dist/plugin/interfacekind.js';
import { rawConfSchema } from './proofgenerator.js';
// FIXME: Copy-paste from src/plugins/merkleMemberships/server/index.ts, should move to utils.
// TODO move to minauth-mina-utils (which is not yet created)
const confDec = {
__interface_tag: fpInterfaceTag,
decode: (inp) => pipe(E.Do, E.bind('rawSchema', () => wrapZodDec('fp', rawConfSchema).decode(inp)), E.bind('password', ({ rawSchema }) => fieldEncDec.decode(rawSchema.password)), E.map(({ password, rawSchema }) => ({
password,
serverUrl: rawSchema.serverUrl
})))
};
//# sourceMappingURL=confDec.js.map