minauth-merkle-membership-plugin
Version:
This package contains an implementation of a simple MinAuth plugin that extends the concept of password authentication into authenticating within sets that provide a level of anonymity. The proofs are built and verified with MINA's `o1js` library & proof
14 lines • 970 B
JavaScript
import { pipe } from 'fp-ts/lib/function.js';
import * as A from 'fp-ts/lib/Array.js';
import * as E from 'fp-ts/lib/Either.js';
import { wrapZodDec } from 'minauth/dist/plugin/encodedecoder.js';
import { fpInterfaceTag } from 'minauth/dist/plugin/interfacekind.js';
import { rawConfSchema, bigintEncDec } from './proofgenerator.js';
const confDec = {
__interface_tag: fpInterfaceTag,
decode: (inp) => pipe(E.Do, E.bind('confRaw', () => wrapZodDec(fpInterfaceTag, rawConfSchema).decode(inp)), E.bind('typedAllInputs', ({ confRaw: { allInputs } }) => A.traverse(E.Applicative)(({ treeRoot, leafIndex, secret }) => pipe(E.Do, E.bind('treeRoot', () => fieldEncDec.decode(treeRoot)), E.bind('leafIndex', () => bigintEncDec.decode(leafIndex)), E.bind('secret', () => fieldEncDec.decode(secret))))(allInputs)), E.map(({ confRaw: { pluginUrl }, typedAllInputs }) => ({
pluginUrl,
allInputs: typedAllInputs
})))
};
//# sourceMappingURL=confDec.js.map