UNPKG

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

41 lines 1.86 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Permissions, Field, SmartContract, State, state, method } from 'o1js'; /** * A simple contract that stores a single field - the root of a Merkle tree. * Anyone can read the root, but only the owner of the contract private key can change it. */ export class TreeRootStorageContract extends SmartContract { constructor() { super(...arguments); this.treeRoot = State(); } /** o1js assumes that at least one method must be present */ foo() { } deploy(args) { super.deploy(args); this.account.permissions.set({ ...Permissions.allImpossible(), editState: Permissions.signature(), access: Permissions.signature() }); } } __decorate([ state(Field), __metadata("design:type", Object) ], TreeRootStorageContract.prototype, "treeRoot", void 0); __decorate([ method, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], TreeRootStorageContract.prototype, "foo", null); //# sourceMappingURL=treerootstoragecontract.js.map