mirror of
https://github.com/kayleegeorge/zk-chat.git
synced 2026-01-09 14:18:03 -05:00
rollup
This commit is contained in:
991
bundle.js
Normal file
991
bundle.js
Normal file
@@ -0,0 +1,991 @@
|
||||
/**
|
||||
* @module zk-chat
|
||||
* @version 0.0.1
|
||||
* @file decentralized p2p chat library
|
||||
* @copyright Ethereum Foundation 2022
|
||||
* @license MIT
|
||||
* @see [Github]{@link https://github.com/kayleegeorge/zk-chat#readme}
|
||||
*/
|
||||
import { EncoderV0, DecoderV0 } from 'js-waku/lib/waku_message/version_0';
|
||||
import 'ethers';
|
||||
import { message, encodeMessage, decodeMessage } from 'protons-runtime';
|
||||
import { RLN as RLN$1, Registry, Cache, genExternalNullifier } from 'rlnjs';
|
||||
import { Protocols } from 'js-waku';
|
||||
import { createLightNode } from 'js-waku/lib/create_waku';
|
||||
import { waitForRemotePeer } from 'js-waku/lib/wait_for_remote_peer';
|
||||
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
var RoomType;
|
||||
(function (RoomType) {
|
||||
RoomType["PubGroup"] = "Public";
|
||||
RoomType["PrivGroup"] = "Private";
|
||||
/*
|
||||
* Future:
|
||||
* DM = 'DirectMessage',
|
||||
*SemaphoreGroup = 'Semaphore', // can join group if in a certain Semaphore group
|
||||
* GatekeepersGroup = 'Gatekeepers', // only appointed gatekeepers can add members
|
||||
*/
|
||||
})(RoomType || (RoomType = {}));
|
||||
|
||||
/*
|
||||
* Create a chat room
|
||||
*/
|
||||
var ChatRoom = /** @class */ (function () {
|
||||
function ChatRoom(chatRoomName, roomType, chatMembers, rlnInstance, connection, provider) {
|
||||
this.chatRoomName = chatRoomName;
|
||||
this.roomType = roomType;
|
||||
this.provider = provider;
|
||||
this.rlnInstance = rlnInstance;
|
||||
this.chatMembers = chatMembers;
|
||||
this.connection = connection;
|
||||
}
|
||||
/* retrieve Store Messages */
|
||||
ChatRoom.prototype.retrieveMessageStore = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
return [2 /*return*/, this.connection.retrieveMessageStore(this.chatRoomName)]; // content topic
|
||||
});
|
||||
});
|
||||
};
|
||||
/* send a message */
|
||||
ChatRoom.prototype.sendMessage = function (text, alias) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 2, , 3]);
|
||||
return [4 /*yield*/, this.connection.sendMessage(text, alias, this.chatRoomName)];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [3 /*break*/, 3];
|
||||
case 2:
|
||||
_a.sent();
|
||||
console.log('error sending message', text);
|
||||
return [3 /*break*/, 3];
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* add chat member */
|
||||
ChatRoom.prototype.addChatMember = function (member) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
if (this.roomType == RoomType.PrivGroup && this.chatMembers.length == 5) {
|
||||
console.error('Cannot add more than 5 members to a private group');
|
||||
}
|
||||
else {
|
||||
this.chatMembers.push(member);
|
||||
}
|
||||
return [2 /*return*/, member];
|
||||
});
|
||||
});
|
||||
};
|
||||
ChatRoom.prototype.getChatMembers = function () {
|
||||
return this.chatMembers;
|
||||
};
|
||||
return ChatRoom;
|
||||
}());
|
||||
|
||||
function dateToEpoch(timestamp) {
|
||||
var timeInMS = timestamp.getTime();
|
||||
return BigInt(Math.floor(timeInMS / 1000));
|
||||
}
|
||||
function strToArr(s) {
|
||||
return new TextEncoder().encode(s);
|
||||
}
|
||||
function arrToStr(b) {
|
||||
return new TextDecoder().decode(b);
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
var ChatMessage$1;
|
||||
(function (ChatMessage) {
|
||||
var _codec;
|
||||
ChatMessage.codec = function () {
|
||||
if (_codec == null) {
|
||||
_codec = message(function (obj, w, opts) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
if (opts.lengthDelimited !== false) {
|
||||
w.fork();
|
||||
}
|
||||
if ((obj.message != null && obj.message.byteLength > 0)) {
|
||||
w.uint32(10);
|
||||
w.bytes(obj.message);
|
||||
}
|
||||
if ((obj.epoch != null)) {
|
||||
w.uint32(16);
|
||||
w.uint64(obj.epoch);
|
||||
}
|
||||
if (obj.rlnProof != null) {
|
||||
w.uint32(26);
|
||||
w.bytes(obj.rlnProof);
|
||||
}
|
||||
if (obj.alias != null) {
|
||||
w.uint32(34);
|
||||
w.string(obj.alias);
|
||||
}
|
||||
if (opts.lengthDelimited !== false) {
|
||||
w.ldelim();
|
||||
}
|
||||
}, function (reader, length) {
|
||||
var obj = {
|
||||
message: new Uint8Array(0),
|
||||
epoch: 0,
|
||||
};
|
||||
var end = length == null ? reader.len : reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
obj.message = reader.bytes();
|
||||
break;
|
||||
case 2:
|
||||
obj.epoch = reader.uint64();
|
||||
break;
|
||||
case 3:
|
||||
obj.rlnProof = reader.bytes();
|
||||
break;
|
||||
case 4:
|
||||
obj.alias = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
});
|
||||
}
|
||||
return _codec;
|
||||
};
|
||||
ChatMessage.encode = function (obj) {
|
||||
return encodeMessage(obj, ChatMessage.codec());
|
||||
};
|
||||
ChatMessage.decode = function (buf) {
|
||||
return decodeMessage(buf, ChatMessage.codec());
|
||||
};
|
||||
})(ChatMessage$1 || (ChatMessage$1 = {}));
|
||||
|
||||
/* Wrapper for proto */
|
||||
var ChatMessage = /** @class */ (function () {
|
||||
function ChatMessage(proto) {
|
||||
this.proto = proto;
|
||||
}
|
||||
/* Create Chat Message with a utf-8 string as payload. */
|
||||
ChatMessage.fromUtf8String = function (text, epoch, rlnProof, alias) {
|
||||
var message = strToArr(text);
|
||||
return new ChatMessage({
|
||||
message: message,
|
||||
epoch: epoch,
|
||||
rlnProof: rlnProof,
|
||||
alias: alias,
|
||||
});
|
||||
};
|
||||
/* decodes received msg payload from waku */
|
||||
ChatMessage.decodeWakuMessage = function (wakuMsg) {
|
||||
if (wakuMsg.payload) {
|
||||
try {
|
||||
return ChatMessage.decode(wakuMsg.payload);
|
||||
}
|
||||
catch (e) {
|
||||
console.error('Failed to decode chat message', e);
|
||||
}
|
||||
}
|
||||
return;
|
||||
};
|
||||
/**
|
||||
* Decode a protobuf payload to a ChatMessage.
|
||||
* @param bytes The payload to decode.
|
||||
*/
|
||||
ChatMessage.decode = function (bytes) {
|
||||
var protoMsg = ChatMessage$1.decode(bytes);
|
||||
// might need to change this, reference zk chat app
|
||||
return new ChatMessage(protoMsg);
|
||||
};
|
||||
/**
|
||||
* Encode this ChatMessage to a byte array, to be used as a protobuf payload.
|
||||
* @returns The encoded payload.
|
||||
*/
|
||||
ChatMessage.prototype.encode = function () {
|
||||
return ChatMessage$1.encode(this.proto);
|
||||
};
|
||||
Object.defineProperty(ChatMessage.prototype, "epoch", {
|
||||
get: function () {
|
||||
return this.epoch;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ChatMessage.prototype, "message", {
|
||||
get: function () {
|
||||
return arrToStr(this.proto.message);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ChatMessage.prototype, "rlnProof", {
|
||||
get: function () {
|
||||
return this.proto.rlnProof;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(ChatMessage.prototype, "alias", {
|
||||
get: function () {
|
||||
var _a;
|
||||
return (_a = this.alias) !== null && _a !== void 0 ? _a : '';
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return ChatMessage;
|
||||
}());
|
||||
|
||||
var TimePeriod;
|
||||
(function (TimePeriod) {
|
||||
TimePeriod["Hour"] = "hour";
|
||||
TimePeriod["Day"] = "day";
|
||||
TimePeriod["Week"] = "week";
|
||||
TimePeriod["Month"] = "month";
|
||||
})(TimePeriod || (TimePeriod = {}));
|
||||
function getDates(timePeriod) {
|
||||
var startTime = new Date();
|
||||
switch (timePeriod) {
|
||||
case TimePeriod.Hour:
|
||||
startTime.setTime(Date.now() - 1000 * 60 * 60 * 1);
|
||||
break;
|
||||
case TimePeriod.Day:
|
||||
startTime.setTime(Date.now() - 1000 * 60 * 60 * 24 * 1);
|
||||
break;
|
||||
case TimePeriod.Week:
|
||||
startTime.setTime(Date.now() - 1000 * 60 * 60 * 24 * 7);
|
||||
break;
|
||||
case TimePeriod.Month:
|
||||
startTime.setTime(Date.now() - 1000 * 60 * 60 * 24 * 31);
|
||||
break;
|
||||
}
|
||||
var endTime = new Date();
|
||||
return { startTime: startTime, endTime: endTime };
|
||||
}
|
||||
|
||||
/* initializes waku instance */
|
||||
function createWakuNode() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var waku, e_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 4, , 5]);
|
||||
return [4 /*yield*/, createLightNode({ defaultBootstrap: true })];
|
||||
case 1:
|
||||
waku = _a.sent();
|
||||
return [4 /*yield*/, waku.start()];
|
||||
case 2:
|
||||
_a.sent();
|
||||
return [4 /*yield*/, waitForRemotePeer(waku, [Protocols.Store, Protocols.Filter, Protocols.LightPush])];
|
||||
case 3:
|
||||
_a.sent();
|
||||
console.log('success!');
|
||||
return [2 /*return*/, waku];
|
||||
case 4:
|
||||
e_1 = _a.sent();
|
||||
console.error('Issue creating waku', e_1);
|
||||
return [2 /*return*/];
|
||||
case 5: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//import { Decoder } from 'js-waku/lib/interfaces'
|
||||
// import { UnsubscribeFunction } from 'js-waku/lib/waku_filter/index'
|
||||
var ConnectionStatus;
|
||||
(function (ConnectionStatus) {
|
||||
ConnectionStatus["ready"] = "ready";
|
||||
ConnectionStatus["connecting"] = "connecting";
|
||||
ConnectionStatus["disconnected"] = "disconnected";
|
||||
})(ConnectionStatus || (ConnectionStatus = {}));
|
||||
/* Connecting with Waku as networking layer */
|
||||
var WakuConnection = /** @class */ (function () {
|
||||
// updateChatStore: (value: ChatMessage[]) => void
|
||||
function WakuConnection(rlnInstance) {
|
||||
this.rlnInstance = rlnInstance;
|
||||
this.contentTopicFunctions = new Map();
|
||||
}
|
||||
/* subscribe to a certain contentTopic and add content topic functions */
|
||||
WakuConnection.prototype.subscribe = function (contentTopic) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var decoder, unsubscribe, functions;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
decoder = new DecoderV0(contentTopic);
|
||||
return [4 /*yield*/, ((_a = this.waku) === null || _a === void 0 ? void 0 : _a.filter.subscribe([decoder], this.processIncomingMessage))];
|
||||
case 1:
|
||||
unsubscribe = _b.sent();
|
||||
functions = {
|
||||
encoder: new EncoderV0(contentTopic),
|
||||
decoder: decoder,
|
||||
unsubscribe: unsubscribe,
|
||||
};
|
||||
this.contentTopicFunctions.set(contentTopic, functions);
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* unsubscribe from a given room / content topic */
|
||||
WakuConnection.prototype.unsubscribe = function (contentTopic) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var unsub;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
unsub = (_a = this.contentTopicFunctions.get(contentTopic)) === null || _a === void 0 ? void 0 : _a.unsubscribe;
|
||||
if (!unsub) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, unsub()];
|
||||
case 1:
|
||||
_b.sent();
|
||||
_b.label = 2;
|
||||
case 2: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* connect to a waku node */
|
||||
WakuConnection.prototype.connect = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _a;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
_a = this;
|
||||
return [4 /*yield*/, createWakuNode()];
|
||||
case 1:
|
||||
_a.waku = _b.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* disconnect waku node */
|
||||
WakuConnection.prototype.disconnect = function () {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
_b.trys.push([0, 2, , 3]);
|
||||
return [4 /*yield*/, ((_a = this.waku) === null || _a === void 0 ? void 0 : _a.stop())];
|
||||
case 1:
|
||||
_b.sent();
|
||||
return [3 /*break*/, 3];
|
||||
case 2:
|
||||
_b.sent();
|
||||
console.log('failed to stop waku');
|
||||
return [3 /*break*/, 3];
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* send a message using Waku */
|
||||
WakuConnection.prototype.sendMessage = function (payload, contentTopic) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var encoder;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
encoder = (_a = this.contentTopicFunctions.get(contentTopic)) === null || _a === void 0 ? void 0 : _a.encoder;
|
||||
if (!this.waku || !encoder) {
|
||||
throw new Error('waku not connected');
|
||||
}
|
||||
return [4 /*yield*/, this.waku.lightPush.push(encoder, { payload: payload }).then(function (msg) {
|
||||
console.log("Sent Encoded Message: ".concat(msg));
|
||||
})];
|
||||
case 1:
|
||||
_b.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* process incoming received message and proof */
|
||||
WakuConnection.prototype.processIncomingMessage = function (msgBuf) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var chatMessage, message, epoch, rlnProof, alias, timestamp, proofResult, rlnFullProof;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!msgBuf.payload)
|
||||
return [2 /*return*/];
|
||||
chatMessage = ChatMessage.decodeWakuMessage(msgBuf);
|
||||
if (!chatMessage)
|
||||
return [2 /*return*/];
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 6, , 7]);
|
||||
message = chatMessage.message, epoch = chatMessage.epoch, rlnProof = chatMessage.rlnProof, alias = chatMessage.alias;
|
||||
timestamp = new Date().setTime(Number(epoch) * 1000);
|
||||
proofResult = void 0;
|
||||
if (!!rlnProof) return [3 /*break*/, 2];
|
||||
console.log('No Proof with Message');
|
||||
return [3 /*break*/, 5];
|
||||
case 2:
|
||||
console.log("Proof attached: ".concat(rlnProof));
|
||||
return [4 /*yield*/, RLN$1.fromJSRLNProof(rlnProof)];
|
||||
case 3:
|
||||
rlnFullProof = _a.sent();
|
||||
return [4 /*yield*/, this.rlnInstance.verifyProof(rlnFullProof)];
|
||||
case 4:
|
||||
proofResult = _a.sent();
|
||||
if (proofResult) {
|
||||
//this.updateChatStore([chatMessage])
|
||||
this.rlnInstance.addProofToCache(rlnFullProof); // add proof to RLN cache on success
|
||||
}
|
||||
_a.label = 5;
|
||||
case 5:
|
||||
console.log("Message Received from ".concat(alias, ": ").concat(message, ", sent at ").concat(timestamp));
|
||||
return [3 /*break*/, 7];
|
||||
case 6:
|
||||
_a.sent();
|
||||
console.log('Error receiving message');
|
||||
return [3 /*break*/, 7];
|
||||
case 7: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* get all previous messages */
|
||||
WakuConnection.prototype.retrieveMessageStore = function (contentTopic, timePeriod) {
|
||||
var _a, e_3, _b, _c;
|
||||
var _d;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var decoder, messages, _e, startTime, endTime, _f, _g, _h, msgPromises, wakuMessages, e_3_1, e_4;
|
||||
return __generator(this, function (_j) {
|
||||
switch (_j.label) {
|
||||
case 0:
|
||||
decoder = (_d = this.contentTopicFunctions.get(contentTopic)) === null || _d === void 0 ? void 0 : _d.decoder;
|
||||
messages = [];
|
||||
_e = getDates(timePeriod !== null && timePeriod !== void 0 ? timePeriod : TimePeriod.Week), startTime = _e.startTime, endTime = _e.endTime;
|
||||
if (!this.waku || !decoder)
|
||||
return [2 /*return*/];
|
||||
_j.label = 1;
|
||||
case 1:
|
||||
_j.trys.push([1, 17, , 18]);
|
||||
_j.label = 2;
|
||||
case 2:
|
||||
_j.trys.push([2, 10, 11, 16]);
|
||||
_f = true, _g = __asyncValues(this.waku.store.queryGenerator([decoder], { timeFilter: { startTime: startTime, endTime: endTime } }));
|
||||
_j.label = 3;
|
||||
case 3: return [4 /*yield*/, _g.next()];
|
||||
case 4:
|
||||
if (!(_h = _j.sent(), _a = _h.done, !_a)) return [3 /*break*/, 9];
|
||||
_c = _h.value;
|
||||
_f = false;
|
||||
_j.label = 5;
|
||||
case 5:
|
||||
_j.trys.push([5, , 7, 8]);
|
||||
msgPromises = _c;
|
||||
return [4 /*yield*/, Promise.all(msgPromises)];
|
||||
case 6:
|
||||
wakuMessages = _j.sent();
|
||||
wakuMessages.map(function (wakuMsg) {
|
||||
return wakuMsg ? ChatMessage.decodeWakuMessage(wakuMsg) : '';
|
||||
})
|
||||
.forEach(function (msg) { if (msg) {
|
||||
messages.push(msg);
|
||||
} });
|
||||
return [3 /*break*/, 8];
|
||||
case 7:
|
||||
_f = true;
|
||||
return [7 /*endfinally*/];
|
||||
case 8: return [3 /*break*/, 3];
|
||||
case 9: return [3 /*break*/, 16];
|
||||
case 10:
|
||||
e_3_1 = _j.sent();
|
||||
e_3 = { error: e_3_1 };
|
||||
return [3 /*break*/, 16];
|
||||
case 11:
|
||||
_j.trys.push([11, , 14, 15]);
|
||||
if (!(!_f && !_a && (_b = _g.return))) return [3 /*break*/, 13];
|
||||
return [4 /*yield*/, _b.call(_g)];
|
||||
case 12:
|
||||
_j.sent();
|
||||
_j.label = 13;
|
||||
case 13: return [3 /*break*/, 15];
|
||||
case 14:
|
||||
if (e_3) throw e_3.error;
|
||||
return [7 /*endfinally*/];
|
||||
case 15: return [7 /*endfinally*/];
|
||||
case 16: return [3 /*break*/, 18];
|
||||
case 17:
|
||||
e_4 = _j.sent();
|
||||
console.log('Failed to retrieve messages', e_4);
|
||||
return [3 /*break*/, 18];
|
||||
case 18: return [2 /*return*/, messages];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return WakuConnection;
|
||||
}());
|
||||
/* note: can use this class to add more connection types in the future */
|
||||
var Connection = /** @class */ (function () {
|
||||
function Connection(rlnInstance) {
|
||||
this.connectionStatus = ConnectionStatus.disconnected;
|
||||
this.rlnInstance = rlnInstance;
|
||||
this.connectionInstance = new WakuConnection(rlnInstance);
|
||||
}
|
||||
Connection.prototype.connect = function () {
|
||||
this.connectionInstance.connect();
|
||||
};
|
||||
Connection.prototype.disconnect = function () {
|
||||
this.connectionInstance.disconnect();
|
||||
};
|
||||
Connection.prototype.subscribeToRoom = function (contentTopic) {
|
||||
this.connectionInstance.subscribe(contentTopic);
|
||||
};
|
||||
Connection.prototype.unsubscribeFromRoom = function (contentTopic) {
|
||||
this.connectionInstance.unsubscribe(contentTopic);
|
||||
};
|
||||
/* send message by encoding to protobuf -> payload for waku message */
|
||||
Connection.prototype.sendMessage = function (text, alias, roomName) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var date, rawMessage, rlnProof, serializedRLNProof, protoMsg, payload;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
date = new Date();
|
||||
rawMessage = { message: text, epoch: dateToEpoch(date) };
|
||||
return [4 /*yield*/, this.rlnInstance.generateRLNProof(rawMessage.message, rawMessage.epoch)];
|
||||
case 1:
|
||||
rlnProof = _a.sent();
|
||||
return [4 /*yield*/, RLN$1.toJSRLNProof(rlnProof)];
|
||||
case 2:
|
||||
serializedRLNProof = _a.sent();
|
||||
protoMsg = new ChatMessage({
|
||||
message: strToArr(text),
|
||||
epoch: dateToEpoch(date),
|
||||
rlnProof: serializedRLNProof,
|
||||
alias: alias,
|
||||
});
|
||||
payload = protoMsg.encode() // encode to proto
|
||||
;
|
||||
this.connectionInstance.sendMessage(payload, roomName);
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
Connection.prototype.retrieveMessageStore = function (contentTopic) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
this.connectionInstance.retrieveMessageStore(contentTopic);
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
};
|
||||
return Connection;
|
||||
}());
|
||||
|
||||
function generateAppIdentifier (appName) {
|
||||
var result = '';
|
||||
for (var i = 0; i < appName.length; i++) {
|
||||
result += appName.charCodeAt(i).toString(16);
|
||||
}
|
||||
return BigInt(parseInt(result, 16));
|
||||
}
|
||||
|
||||
var GOERLI = 5;
|
||||
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// resolves . and .. elements in a path array with directory names there
|
||||
// must be no slashes, empty elements, or device names (c:\) in the array
|
||||
// (so also no leading and trailing slashes - it does not distinguish
|
||||
// relative and absolute paths)
|
||||
function normalizeArray(parts, allowAboveRoot) {
|
||||
// if the path tries to go above the root, `up` ends up > 0
|
||||
var up = 0;
|
||||
for (var i = parts.length - 1; i >= 0; i--) {
|
||||
var last = parts[i];
|
||||
if (last === '.') {
|
||||
parts.splice(i, 1);
|
||||
} else if (last === '..') {
|
||||
parts.splice(i, 1);
|
||||
up++;
|
||||
} else if (up) {
|
||||
parts.splice(i, 1);
|
||||
up--;
|
||||
}
|
||||
}
|
||||
|
||||
// if the path is allowed to go above the root, restore leading ..s
|
||||
if (allowAboveRoot) {
|
||||
for (; up--; up) {
|
||||
parts.unshift('..');
|
||||
}
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
// path.normalize(path)
|
||||
// posix version
|
||||
function normalize(path) {
|
||||
var isPathAbsolute = isAbsolute(path),
|
||||
trailingSlash = substr(path, -1) === '/';
|
||||
|
||||
// Normalize the path
|
||||
path = normalizeArray(filter(path.split('/'), function(p) {
|
||||
return !!p;
|
||||
}), !isPathAbsolute).join('/');
|
||||
|
||||
if (!path && !isPathAbsolute) {
|
||||
path = '.';
|
||||
}
|
||||
if (path && trailingSlash) {
|
||||
path += '/';
|
||||
}
|
||||
|
||||
return (isPathAbsolute ? '/' : '') + path;
|
||||
}
|
||||
// posix version
|
||||
function isAbsolute(path) {
|
||||
return path.charAt(0) === '/';
|
||||
}
|
||||
|
||||
// posix version
|
||||
function join() {
|
||||
var paths = Array.prototype.slice.call(arguments, 0);
|
||||
return normalize(filter(paths, function(p, index) {
|
||||
if (typeof p !== 'string') {
|
||||
throw new TypeError('Arguments to path.join must be strings');
|
||||
}
|
||||
return p;
|
||||
}).join('/'));
|
||||
}
|
||||
function filter (xs, f) {
|
||||
if (xs.filter) return xs.filter(f);
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
if (f(xs[i], i, xs)) res.push(xs[i]);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// String.prototype.substr - negative index don't work in IE8
|
||||
var substr = 'ab'.substr(-1) === 'b' ?
|
||||
function (str, start, len) { return str.substr(start, len) } :
|
||||
function (str, start, len) {
|
||||
if (start < 0) start = str.length + start;
|
||||
return str.substr(start, len);
|
||||
}
|
||||
;
|
||||
|
||||
// import * as fs from 'fs'
|
||||
/* needed file paths */
|
||||
var vkeyPath = join('src', 'zkeyFiles', 'verification_key.json');
|
||||
var vkey = JSON.parse(vkeyPath); // doesn't work
|
||||
var wasmFilePath = join('./zkeyFiles', 'rln', 'rln.wasm');
|
||||
var finalZkeyPath = join('./zkeyFiles', 'rln', 'rln_final.zkey');
|
||||
var RLN = /** @class */ (function () {
|
||||
// private memIndex: number
|
||||
function RLN(onChain, existingIdentity, rlnIdentifier) {
|
||||
// RLN
|
||||
this.registry = new Registry();
|
||||
this.contract = onChain;
|
||||
this.rlnjs = new RLN$1(wasmFilePath, finalZkeyPath, vkey, rlnIdentifier, existingIdentity);
|
||||
this.rlnIdentifier = this.rlnjs.rlnIdentifier;
|
||||
this.identityCommitments = [];
|
||||
this.cache = new Cache(this.rlnjs.rlnIdentifier);
|
||||
// RLN member
|
||||
this.identityCommitment = this.rlnjs.identity.getCommitment();
|
||||
this.registry.addMember(this.identityCommitment);
|
||||
}
|
||||
/* handle init on chain stuff */
|
||||
RLN.prototype.initOnChain = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!this.contract)
|
||||
return [2 /*return*/];
|
||||
return [4 /*yield*/, this.constructRLNMemberTree()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* generate RLN Proof */
|
||||
RLN.prototype.generateRLNProof = function (msg, epoch) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var epochNullifier, merkleProof, proof;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
epochNullifier = genExternalNullifier(epoch.toString());
|
||||
return [4 /*yield*/, this.registry.generateMerkleProof(this.identityCommitment)];
|
||||
case 1:
|
||||
merkleProof = _a.sent();
|
||||
proof = this.rlnjs.generateProof(msg, merkleProof, epochNullifier);
|
||||
return [2 /*return*/, proof];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* RLN proof verification */
|
||||
RLN.prototype.verifyProof = function (rlnProof) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
return [2 /*return*/, RLN$1.verifyProof(vkey, rlnProof)];
|
||||
});
|
||||
});
|
||||
};
|
||||
/* construct RLN member tree locally */
|
||||
RLN.prototype.constructRLNMemberTree = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var memRegEvent, registeredMembers;
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!this.contract)
|
||||
return [2 /*return*/];
|
||||
memRegEvent = this.contract.filters.MemberRegistered();
|
||||
return [4 /*yield*/, this.contract.queryFilter(memRegEvent)];
|
||||
case 1:
|
||||
registeredMembers = _a.sent();
|
||||
registeredMembers.forEach(function (event) {
|
||||
if (event.args)
|
||||
_this.registry.addMember(event.args.memkey);
|
||||
});
|
||||
// listen to new members added to rln contract
|
||||
this.contract.on(memRegEvent, function (event) {
|
||||
_this.registry.addMember(event.args.memkey);
|
||||
});
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* Allow new user registraction with rln contract for rln registry */
|
||||
RLN.prototype.registerUserOnRLNContract = function (provider) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var price, signer, rlnContractWithSigner, txResponse, txReceipt;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!this.contract)
|
||||
return [2 /*return*/];
|
||||
return [4 /*yield*/, this.contract.MEMBERSHIP_DEPOSIT()];
|
||||
case 1:
|
||||
price = _a.sent();
|
||||
signer = provider.getSigner();
|
||||
rlnContractWithSigner = this.contract.connect(signer);
|
||||
return [4 /*yield*/, rlnContractWithSigner.register(this.identityCommitment, { value: price })];
|
||||
case 2:
|
||||
txResponse = _a.sent();
|
||||
console.log('Transaction broadcasted: ', txResponse);
|
||||
return [4 /*yield*/, txResponse.wait()];
|
||||
case 3:
|
||||
txReceipt = _a.sent();
|
||||
console.log('Transaction receipt', txReceipt);
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* handle adding proof to cache */
|
||||
RLN.prototype.addProofToCache = function (proof) {
|
||||
var result = this.cache.addProof(proof);
|
||||
// if breached, slash the member id commitment
|
||||
if (result.secret) {
|
||||
this.registry.slashMember(BigInt(result.secret));
|
||||
console.log('member withdrawn: ', result.secret);
|
||||
// if on chain, slash
|
||||
if (this.contract) {
|
||||
var withdrawRes = this.contract.withdraw(result.secret); // might need to add payable receiver
|
||||
console.log('contract rest: ', withdrawRes);
|
||||
}
|
||||
}
|
||||
};
|
||||
/* returns rln member Identity */
|
||||
RLN.prototype.getIdentityAsString = function () {
|
||||
return this.rlnjs.identity.toString();
|
||||
};
|
||||
/* generate RLN credentials */
|
||||
RLN.prototype.generateRLNcredentials = function (appName) {
|
||||
return {
|
||||
'application': appName,
|
||||
'appIdentifier': this.rlnjs.rlnIdentifier,
|
||||
'credentials': [{
|
||||
'key': this.rlnjs.identity.getNullifier(),
|
||||
'commitment': this.identityCommitment,
|
||||
'membershipGroups': [{
|
||||
'chainId': GOERLI,
|
||||
'contract': this.contract,
|
||||
'treeIndex': this.registry.indexOf(this.identityCommitment),
|
||||
}],
|
||||
}],
|
||||
'version': 1, // change
|
||||
};
|
||||
};
|
||||
return RLN;
|
||||
}());
|
||||
|
||||
var ChatApp = /** @class */ (function () {
|
||||
function ChatApp(appName, onChain, provider, existingIdentity, rlnIdentifier) {
|
||||
this.appName = appName;
|
||||
this.onChain = onChain;
|
||||
this.provider = provider;
|
||||
rlnIdentifier = rlnIdentifier ? rlnIdentifier : generateAppIdentifier(appName);
|
||||
this.rln = new RLN(onChain, existingIdentity, rlnIdentifier); // might need to pass provider?
|
||||
this.connection = new Connection(this.rln);
|
||||
this.chatRoomStore = new Map();
|
||||
}
|
||||
/* app-level user registration: add user to chatApp and RLN registry */
|
||||
ChatApp.prototype.registerUserOnChain = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!this.provider) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, this.rln.registerUserOnRLNContract(this.provider)];
|
||||
case 1:
|
||||
_a.sent();
|
||||
_a.label = 2;
|
||||
case 2: return [2 /*return*/, this.rln.rlnjs.identity];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
/* create chat room */
|
||||
ChatApp.prototype.createChatRoom = function (name, roomType, chatMembers) {
|
||||
if (chatMembers === void 0) { chatMembers = []; }
|
||||
var chatRoomName = "/".concat(this.appName, "/").concat(roomType, "-").concat(name, "/");
|
||||
// no duplicate chat room names
|
||||
var i = 0;
|
||||
while (chatRoomName + i.toString() in this.chatRoomStore) {
|
||||
i += 1;
|
||||
}
|
||||
chatRoomName += i.toString();
|
||||
var chatroom = new ChatRoom(chatRoomName, roomType, chatMembers, this.rln, this.connection, this.provider);
|
||||
this.chatRoomStore.set(chatRoomName, chatroom);
|
||||
return chatroom;
|
||||
};
|
||||
/* fetch all chat room messages for a given chatroom */
|
||||
ChatApp.prototype.fetchChatRoomMsgs = function (contentTopic) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_b) {
|
||||
return [2 /*return*/, (_a = this.chatRoomStore.get(contentTopic)) === null || _a === void 0 ? void 0 : _a.retrieveMessageStore()];
|
||||
});
|
||||
});
|
||||
};
|
||||
/* get chat room names */
|
||||
ChatApp.prototype.fetchChatRoomsNames = function () {
|
||||
return Array.from(this.chatRoomStore.keys());
|
||||
};
|
||||
return ChatApp;
|
||||
}());
|
||||
|
||||
export { ChatApp, ChatRoom, RLN };
|
||||
244747
bundle/index.js
Normal file
244747
bundle/index.js
Normal file
File diff suppressed because one or more lines are too long
@@ -1,17 +1,41 @@
|
||||
import type { Config } from '@jest/types'
|
||||
// import type { Config } from '@jest/types'
|
||||
|
||||
// const config: Config.InitialOptions = {
|
||||
// preset: 'ts-jest',
|
||||
// testEnvironment: 'node',
|
||||
// 'transform': {
|
||||
// '^.+\\.jsx?$': 'babel-jest',
|
||||
// '^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
// },
|
||||
// 'silent': true,
|
||||
// 'detectOpenHandles': true,
|
||||
// 'testTimeout': 60000,
|
||||
// 'collectCoverage': true,
|
||||
// 'forceExit': true,
|
||||
// 'modulePaths': [
|
||||
// '<rootDir>',
|
||||
// ],
|
||||
// 'moduleDirectories': [
|
||||
// 'node_modules',
|
||||
// 'src',
|
||||
// ],
|
||||
// }
|
||||
// export default config
|
||||
|
||||
import type { Config } from '@jest/types';
|
||||
|
||||
const config: Config.InitialOptions = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
|
||||
'transform': {
|
||||
'^.+\\.jsx?$': 'babel-jest',
|
||||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
"transform": {
|
||||
"^.+\\..jsx?$": "babel-jest",
|
||||
"^.+\\.tsx?$": ["ts-jest", { tsconfig: "tsconfig.test.json" }]
|
||||
},
|
||||
'silent': true,
|
||||
'detectOpenHandles': true,
|
||||
'testTimeout': 60000,
|
||||
'collectCoverage': true,
|
||||
'forceExit': true,
|
||||
}
|
||||
export default config
|
||||
"silent": true,
|
||||
"detectOpenHandles": true,
|
||||
"testTimeout": 60000,
|
||||
"collectCoverage": true,
|
||||
"forceExit": true,
|
||||
};
|
||||
export default config;
|
||||
1679
package-lock.json
generated
1679
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@@ -21,27 +21,29 @@
|
||||
"homepage": "https://github.com/kayleegeorge/zk-chat#readme",
|
||||
"main": "./dist/index.node.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"module": "./dist/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.node.js"
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
"directories": {
|
||||
"dist": "./dist",
|
||||
"src": "./src",
|
||||
"test": "./tests"
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"src/",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"dependencies": {
|
||||
"16": "^0.0.2",
|
||||
"@ethersproject/providers": "^5.7.2",
|
||||
"@metamask/detect-provider": "^2.0.0",
|
||||
"@nodeutils/defaults-deep": "^1.1.0",
|
||||
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
|
||||
"@rollup/plugin-replace": "^5.0.2",
|
||||
"@semaphore-protocol/identity": "^2.6.1",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@waku/proto": "^0.0.1",
|
||||
@@ -51,7 +53,6 @@
|
||||
"crypto-js": "^4.1.1",
|
||||
"dotenv": "^16.0.3",
|
||||
"ethers": "^5.7.2",
|
||||
"js-waku": "^0.30.0",
|
||||
"protons-runtime": "^5.0.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
@@ -63,7 +64,10 @@
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@nomicfoundation/hardhat-toolbox": "^1.0.2",
|
||||
"@nomiclabs/hardhat-ethers": "^2.2.1",
|
||||
"@rollup/plugin-commonjs": "^24.0.1",
|
||||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"@rollup/plugin-wasm": "^6.1.2",
|
||||
"@types/chai": "^4.3.4",
|
||||
"@types/jest": "^29.2.3",
|
||||
"@types/node": "^18.11.19",
|
||||
@@ -71,6 +75,7 @@
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
||||
"@typescript-eslint/parser": "^5.51.0",
|
||||
"@web/rollup-plugin-import-meta-assets": "^1.0.7",
|
||||
"eslint": "^8.33.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
@@ -78,11 +83,14 @@
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"hardhat": "^2.12.4",
|
||||
"jest": "^29.3.1",
|
||||
"js-waku": "^0.30.0",
|
||||
"prettier": "^2.8.1",
|
||||
"protons": "^7.0.2",
|
||||
"rollup": "^3.15.0",
|
||||
"rollup-plugin-cleaner": "^1.0.0",
|
||||
"rollup-plugin-copy": "^3.4.0",
|
||||
"rollup-plugin-dts": "^5.2.0",
|
||||
"rollup-plugin-polyfill-node": "^0.12.0",
|
||||
"rollup-plugin-typescript2": "^0.34.1",
|
||||
"rollup-plugin-visualizer": "^5.9.0",
|
||||
"ts-jest": "^29.0.3",
|
||||
|
||||
@@ -1,11 +1,92 @@
|
||||
|
||||
// import typescript from 'rollup-plugin-typescript2'
|
||||
// import cleaner from 'rollup-plugin-cleaner'
|
||||
// import { visualizer } from 'rollup-plugin-visualizer'
|
||||
// import resolve from '@rollup/plugin-node-resolve'
|
||||
|
||||
// import * as fs from 'fs'
|
||||
|
||||
// const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
|
||||
// const banner = `/**
|
||||
// * @module ${pkg.name}
|
||||
// * @version ${pkg.version}
|
||||
// * @file ${pkg.description}
|
||||
// * @copyright Ethereum Foundation 2022
|
||||
// * @license ${pkg.license}
|
||||
// * @see [Github]{@link ${pkg.homepage}}
|
||||
// */`
|
||||
|
||||
|
||||
// export default {
|
||||
// input: 'src/index.ts',
|
||||
// output: [
|
||||
// { file: pkg.exports.require, format: 'cjs', banner, exports: 'auto' },
|
||||
// { file: pkg.exports.import, format: 'es', banner },
|
||||
// ],
|
||||
// // external: Object.keys(pkg.dependencies),
|
||||
// // external: [ 'fs', 'ethers', 'rlnjs', 'protons-runtime' ],
|
||||
// plugins: [
|
||||
// resolve( { jail: 'bn' } ),
|
||||
|
||||
// // dts({
|
||||
// // compilerOptions: {
|
||||
// // baseUrl: ['src', 'node_modules'],
|
||||
// // paths: ts.readConfigFile(tsConfigPath, p => readFileSync(p, 'utf8')).config.compilerOptions.paths,
|
||||
// // },
|
||||
// // }),
|
||||
// cleaner({
|
||||
// targets: [
|
||||
// './dist/',
|
||||
// ],
|
||||
// }),
|
||||
// typescript({
|
||||
// tsconfig: 'tsconfig.build.json',
|
||||
// // useTsconfigDeclarationDir: true,
|
||||
// // }),
|
||||
// // ],
|
||||
// // }
|
||||
|
||||
// import { nodeResolve } from '@rollup/plugin-node-resolve'
|
||||
// import commonjs from '@rollup/plugin-commonjs'
|
||||
// import json from '@rollup/plugin-json'
|
||||
// import { wasm } from '@rollup/plugin-wasm'
|
||||
// import copy from 'rollup-plugin-copy'
|
||||
// import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets'
|
||||
// export default {
|
||||
// input: {
|
||||
// index: 'dist/index.mjs',
|
||||
// },
|
||||
// output: {
|
||||
// dir: 'bundle',
|
||||
// format: 'esm',
|
||||
// },
|
||||
// plugins: [
|
||||
// commonjs(),
|
||||
// json(),
|
||||
// wasm({
|
||||
// maxFileSize: 0,
|
||||
// }),
|
||||
// nodeResolve({
|
||||
// browser: true,
|
||||
// preferBuiltins: false,
|
||||
// extensions: ['.js', '.ts', '.wasm'],
|
||||
// }),
|
||||
// importMetaAssets(),
|
||||
// ],
|
||||
// }
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import typescript from 'rollup-plugin-typescript2'
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import json from '@rollup/plugin-json'
|
||||
import nodePolyfills from 'rollup-plugin-polyfill-node'
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import cleaner from 'rollup-plugin-cleaner'
|
||||
import { visualizer } from 'rollup-plugin-visualizer'
|
||||
import resolve from '@rollup/plugin-node-resolve'
|
||||
|
||||
import * as fs from 'fs'
|
||||
|
||||
|
||||
const input = 'src/index.ts'
|
||||
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
|
||||
const banner = `/**
|
||||
* @module ${pkg.name}
|
||||
@@ -17,31 +98,64 @@ const banner = `/**
|
||||
*/`
|
||||
|
||||
|
||||
export default {
|
||||
input: 'src/index.ts',
|
||||
output: [
|
||||
{ file: pkg.exports.require, format: 'cjs', banner, exports: 'auto' },
|
||||
{ file: pkg.exports.import, format: 'es', banner },
|
||||
],
|
||||
// external: Object.keys(pkg.dependencies),
|
||||
// external: [ 'fs', 'ethers', 'rlnjs', 'protons-runtime' ],
|
||||
plugins: [
|
||||
resolve( { jail: 'bn' } ),
|
||||
const typescriptPlugin = typescript({
|
||||
tsconfig: 'tsconfig.build.json',
|
||||
useTsconfigDeclarationDir: true,
|
||||
})
|
||||
|
||||
// dts({
|
||||
// compilerOptions: {
|
||||
// baseUrl: ['src', 'node_modules'],
|
||||
// paths: ts.readConfigFile(tsConfigPath, p => readFileSync(p, 'utf8')).config.compilerOptions.paths,
|
||||
// },
|
||||
// }),
|
||||
cleaner({
|
||||
targets: [
|
||||
'./dist/',
|
||||
],
|
||||
}),
|
||||
typescript({
|
||||
tsconfig: 'tsconfig.build.json',
|
||||
useTsconfigDeclarationDir: true,
|
||||
}),
|
||||
],
|
||||
}
|
||||
const nodePlugins = [
|
||||
typescriptPlugin,
|
||||
// `browser: false` is required for `fs` and other Node.js core modules to be resolved correctly
|
||||
nodeResolve({ browser: false }),
|
||||
// To accept commonjs modules and convert them to ES module, since rollup only bundle ES modules by default
|
||||
commonjs(),
|
||||
// Parse JSON files and make them ES modules. Required when bundling circomlib
|
||||
json(),
|
||||
]
|
||||
|
||||
const browserPlugins = [
|
||||
typescriptPlugin,
|
||||
replace({
|
||||
// Replace `process.browser` with `true` to avoid `process is not defined` error
|
||||
// This is because ffjavascript and snarkjs use `process.browser` to check if it's running in the browser,
|
||||
// but process is undefined in the browser and referencing `process.browser` causes an error.
|
||||
// Ref: https://github.com/iden3/ffjavascript/blob/e670bfeb17e80b961eab77e15a6b9eca8e31a0be/src/threadman.js#L43
|
||||
'process.browser': JSON.stringify(true),
|
||||
// To avoid unexpected behavior that the warning suggests.
|
||||
'preventAssignment': true,
|
||||
}),
|
||||
// Resolve the import from node_modules.
|
||||
// `browser: true` is required for `window` not to be undefined
|
||||
// Ref: https://github.com/iden3/snarkjs/blob/782894ab72b09cfad4dd8b517599d5e7b2340468/src/taskmanager.js#L20-L24
|
||||
nodeResolve({ browser: true }),
|
||||
commonjs(),
|
||||
json(),
|
||||
// Replace node built-in modules with polyfills
|
||||
// nodePolyfills(),
|
||||
]
|
||||
|
||||
|
||||
export default [
|
||||
// Node.js build
|
||||
{
|
||||
input,
|
||||
output: { file: pkg.exports.require, format: 'cjs', banner },
|
||||
external: Object.keys(pkg.dependencies),
|
||||
plugins: [
|
||||
cleaner({
|
||||
targets: [
|
||||
'./dist/',
|
||||
],
|
||||
}),
|
||||
...nodePlugins,
|
||||
],
|
||||
},
|
||||
// Browser build
|
||||
{
|
||||
input,
|
||||
output: { file: pkg.exports.import, format: 'es', banner },
|
||||
plugins: [
|
||||
...browserPlugins,
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Web3Provider } from '@ethersproject/providers'
|
||||
import ChatRoom from './ChatRoom'
|
||||
import { RoomType } from './types/ChatRoomOptions'
|
||||
import RLN from './RLN'
|
||||
import { Connection } from './Connection'
|
||||
import generateAppIdentifier from './utils/generateAppId'
|
||||
import { Contract } from 'ethers'
|
||||
import User from './User'
|
||||
import RLN from './RLN'
|
||||
|
||||
export default class ChatApp {
|
||||
public appName: string
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { WakuLight } from 'js-waku/lib/interfaces'
|
||||
//import { Decoder } from 'js-waku/lib/interfaces'
|
||||
// import { UnsubscribeFunction } from 'js-waku/lib/waku_filter/index'
|
||||
import { DecoderV0, EncoderV0, MessageV0 } from 'js-waku/lib/waku_message/version_0'
|
||||
import RLN from './RLN'
|
||||
import { RLN as RLNjs } from 'rlnjs'
|
||||
import { ChatMessage } from './types/ChatMessage'
|
||||
import { dateToEpoch, strToArr } from './utils/formatting'
|
||||
import { DecoderV0, EncoderV0, MessageV0 } from 'js-waku/lib/waku_message/version_0'
|
||||
import { RLN as RLNjs } from 'rlnjs'
|
||||
import { getDates, TimePeriod } from './utils/getDates'
|
||||
import { createWakuNode } from './utils/createWakuNode'
|
||||
//import { Decoder } from 'js-waku/lib/interfaces'
|
||||
// import { UnsubscribeFunction } from 'js-waku/lib/waku_filter/index'
|
||||
|
||||
enum ConnectionStatus {
|
||||
ready = 'ready',
|
||||
|
||||
@@ -3,11 +3,11 @@ import { genExternalNullifier, Registry, RLN as RLNjs, RLNFullProof, Cache } fro
|
||||
import { Contract } from 'ethers'
|
||||
import { Web3Provider } from '@ethersproject/providers'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
// import * as fs from 'fs'
|
||||
|
||||
/* needed file paths */
|
||||
const vkeyPath = path.join('src', 'zkeyFiles', 'verification_key.json')
|
||||
const vkey = JSON.parse(fs.readFileSync(vkeyPath, 'utf-8'))
|
||||
const vkey = JSON.parse(vkeyPath) // doesn't work
|
||||
const wasmFilePath = path.join('./zkeyFiles', 'rln', 'rln.wasm')
|
||||
const finalZkeyPath = path.join('./zkeyFiles', 'rln', 'rln_final.zkey')
|
||||
|
||||
|
||||
6911
stats.html
Normal file
6911
stats.html
Normal file
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@ import { strToArr } from '../src/utils/formatting'
|
||||
import { ChatMessage } from '../src/types/ChatMessage'
|
||||
import { createWakuNode } from '../src/utils/createWakuNode'
|
||||
import { RLN_ABI, RLN_ADDRESS } from '../src/rln/contractInfo'
|
||||
import { Contract } from 'ethers'
|
||||
import User from '../src/User'
|
||||
import { Contract } from 'ethers'
|
||||
import generateAppIdentifier from '../src/utils/generateAppId'
|
||||
|
||||
describe('test chat message encode / decode', () => {
|
||||
|
||||
140
yarn.lock
140
yarn.lock
@@ -2758,6 +2758,34 @@
|
||||
"resolved" "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz"
|
||||
"version" "1.1.0"
|
||||
|
||||
"@rollup/plugin-commonjs@^24.0.1":
|
||||
"integrity" "sha512-15LsiWRZk4eOGqvrJyu3z3DaBu5BhXIMeWnijSRvd8irrrg9SHpQ1pH+BUK4H6Z9wL9yOxZJMTLU+Au86XHxow=="
|
||||
"resolved" "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.1.tgz"
|
||||
"version" "24.0.1"
|
||||
dependencies:
|
||||
"@rollup/pluginutils" "^5.0.1"
|
||||
"commondir" "^1.0.1"
|
||||
"estree-walker" "^2.0.2"
|
||||
"glob" "^8.0.3"
|
||||
"is-reference" "1.2.1"
|
||||
"magic-string" "^0.27.0"
|
||||
|
||||
"@rollup/plugin-inject@^5.0.1":
|
||||
"integrity" "sha512-411QlbL+z2yXpRWFXSmw/teQRMkXcAAC8aYTemc15gwJRpvEVDQwoe+N/HTFD8RFG8+88Bme9DK2V9CVm7hJdA=="
|
||||
"resolved" "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.0.3.tgz"
|
||||
"version" "5.0.3"
|
||||
dependencies:
|
||||
"@rollup/pluginutils" "^5.0.1"
|
||||
"estree-walker" "^2.0.2"
|
||||
"magic-string" "^0.27.0"
|
||||
|
||||
"@rollup/plugin-json@^6.0.0":
|
||||
"integrity" "sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w=="
|
||||
"resolved" "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.0.0.tgz"
|
||||
"version" "6.0.0"
|
||||
dependencies:
|
||||
"@rollup/pluginutils" "^5.0.1"
|
||||
|
||||
"@rollup/plugin-node-resolve@^15.0.1":
|
||||
"integrity" "sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg=="
|
||||
"resolved" "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz"
|
||||
@@ -2770,7 +2798,20 @@
|
||||
"is-module" "^1.0.0"
|
||||
"resolve" "^1.22.1"
|
||||
|
||||
"@rollup/pluginutils@^4.1.2":
|
||||
"@rollup/plugin-replace@^5.0.2":
|
||||
"integrity" "sha512-M9YXNekv/C/iHHK+cvORzfRYfPbq0RDD8r0G+bMiTXjNGKulPnCT9O3Ss46WfhI6ZOCgApOP7xAdmCQJ+U2LAA=="
|
||||
"resolved" "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-5.0.2.tgz"
|
||||
"version" "5.0.2"
|
||||
dependencies:
|
||||
"@rollup/pluginutils" "^5.0.1"
|
||||
"magic-string" "^0.27.0"
|
||||
|
||||
"@rollup/plugin-wasm@^6.1.2":
|
||||
"integrity" "sha512-YdrQ7zfnZ54Y+6raCev3tR1PrhQGxYKSTajGylhyP0oBacouuNo6KcNCk+pYKw9M98jxRWLFFca/udi76IDXzg=="
|
||||
"resolved" "https://registry.npmjs.org/@rollup/plugin-wasm/-/plugin-wasm-6.1.2.tgz"
|
||||
"version" "6.1.2"
|
||||
|
||||
"@rollup/pluginutils@^4.1.0", "@rollup/pluginutils@^4.1.2":
|
||||
"integrity" "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ=="
|
||||
"resolved" "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz"
|
||||
"version" "4.2.1"
|
||||
@@ -3253,6 +3294,13 @@
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/fs-extra@^8.0.1":
|
||||
"integrity" "sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg=="
|
||||
"resolved" "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.2.tgz"
|
||||
"version" "8.1.2"
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/glob@^7.1.1":
|
||||
"integrity" "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA=="
|
||||
"resolved" "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz"
|
||||
@@ -3601,6 +3649,15 @@
|
||||
"resolved" "https://registry.npmjs.org/@waku/zerokit-rln-wasm/-/zerokit-rln-wasm-0.0.4.tgz"
|
||||
"version" "0.0.4"
|
||||
|
||||
"@web/rollup-plugin-import-meta-assets@^1.0.7":
|
||||
"integrity" "sha512-ft44CqITUkNd8stwNb4ZOvrZ8DlPifM821jplksmxRGetg5Lx684oFrpfQJ7mfkU/Sa7B3dI1mHTX0DE52eBwg=="
|
||||
"resolved" "https://registry.npmjs.org/@web/rollup-plugin-import-meta-assets/-/rollup-plugin-import-meta-assets-1.0.7.tgz"
|
||||
"version" "1.0.7"
|
||||
dependencies:
|
||||
"@rollup/pluginutils" "^4.1.0"
|
||||
"estree-walker" "^2.0.2"
|
||||
"magic-string" "^0.25.7"
|
||||
|
||||
"@webassemblyjs/ast@1.11.1":
|
||||
"integrity" "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw=="
|
||||
"resolved" "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz"
|
||||
@@ -5052,6 +5109,11 @@
|
||||
"resolved" "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz"
|
||||
"version" "1.1.3"
|
||||
|
||||
"colorette@^1.1.0":
|
||||
"integrity" "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g=="
|
||||
"resolved" "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz"
|
||||
"version" "1.4.0"
|
||||
|
||||
"colors@^1.1.2", "colors@1.4.0":
|
||||
"integrity" "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
|
||||
"resolved" "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz"
|
||||
@@ -7001,6 +7063,17 @@
|
||||
"minimatch" "^5.0.1"
|
||||
"once" "^1.3.0"
|
||||
|
||||
"glob@^8.0.3":
|
||||
"integrity" "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="
|
||||
"resolved" "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz"
|
||||
"version" "8.1.0"
|
||||
dependencies:
|
||||
"fs.realpath" "^1.0.0"
|
||||
"inflight" "^1.0.4"
|
||||
"inherits" "2"
|
||||
"minimatch" "^5.0.1"
|
||||
"once" "^1.3.0"
|
||||
|
||||
"glob@7.1.3":
|
||||
"integrity" "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ=="
|
||||
"resolved" "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz"
|
||||
@@ -7110,6 +7183,20 @@
|
||||
"merge2" "^1.4.1"
|
||||
"slash" "^4.0.0"
|
||||
|
||||
"globby@10.0.1":
|
||||
"integrity" "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A=="
|
||||
"resolved" "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz"
|
||||
"version" "10.0.1"
|
||||
dependencies:
|
||||
"@types/glob" "^7.1.1"
|
||||
"array-union" "^2.1.0"
|
||||
"dir-glob" "^3.0.1"
|
||||
"fast-glob" "^3.0.3"
|
||||
"glob" "^7.1.3"
|
||||
"ignore" "^5.1.1"
|
||||
"merge2" "^1.2.3"
|
||||
"slash" "^3.0.0"
|
||||
|
||||
"globrex@^0.1.2":
|
||||
"integrity" "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="
|
||||
"resolved" "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz"
|
||||
@@ -7827,11 +7914,23 @@
|
||||
"resolved" "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz"
|
||||
"version" "2.1.0"
|
||||
|
||||
"is-plain-object@^3.0.0":
|
||||
"integrity" "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g=="
|
||||
"resolved" "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz"
|
||||
"version" "3.0.1"
|
||||
|
||||
"is-potential-custom-element-name@^1.0.1":
|
||||
"integrity" "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ=="
|
||||
"resolved" "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz"
|
||||
"version" "1.0.1"
|
||||
|
||||
"is-reference@1.2.1":
|
||||
"integrity" "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ=="
|
||||
"resolved" "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz"
|
||||
"version" "1.2.1"
|
||||
dependencies:
|
||||
"@types/estree" "*"
|
||||
|
||||
"is-regex@^1.1.4":
|
||||
"integrity" "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg=="
|
||||
"resolved" "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz"
|
||||
@@ -9524,6 +9623,20 @@
|
||||
"resolved" "https://registry.npmjs.org/lru-cache/-/lru-cache-7.16.0.tgz"
|
||||
"version" "7.16.0"
|
||||
|
||||
"magic-string@^0.25.7":
|
||||
"integrity" "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ=="
|
||||
"resolved" "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz"
|
||||
"version" "0.25.9"
|
||||
dependencies:
|
||||
"sourcemap-codec" "^1.4.8"
|
||||
|
||||
"magic-string@^0.27.0":
|
||||
"integrity" "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA=="
|
||||
"resolved" "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz"
|
||||
"version" "0.27.0"
|
||||
dependencies:
|
||||
"@jridgewell/sourcemap-codec" "^1.4.13"
|
||||
|
||||
"magic-string@^0.29.0":
|
||||
"integrity" "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q=="
|
||||
"resolved" "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz"
|
||||
@@ -11339,6 +11452,17 @@
|
||||
dependencies:
|
||||
"rimraf" "^2.6.3"
|
||||
|
||||
"rollup-plugin-copy@^3.4.0":
|
||||
"integrity" "sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ=="
|
||||
"resolved" "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz"
|
||||
"version" "3.4.0"
|
||||
dependencies:
|
||||
"@types/fs-extra" "^8.0.1"
|
||||
"colorette" "^1.1.0"
|
||||
"fs-extra" "^8.1.0"
|
||||
"globby" "10.0.1"
|
||||
"is-plain-object" "^3.0.0"
|
||||
|
||||
"rollup-plugin-dts@^5.2.0":
|
||||
"integrity" "sha512-B68T/haEu2MKcz4kNUhXB8/h5sq4gpplHAJIYNHbh8cp4ZkvzDvNca/11KQdFrB9ZeKucegQIotzo5T0JUtM8w=="
|
||||
"resolved" "https://registry.npmjs.org/rollup-plugin-dts/-/rollup-plugin-dts-5.2.0.tgz"
|
||||
@@ -11348,6 +11472,13 @@
|
||||
optionalDependencies:
|
||||
"@babel/code-frame" "^7.18.6"
|
||||
|
||||
"rollup-plugin-polyfill-node@^0.12.0":
|
||||
"integrity" "sha512-PWEVfDxLEKt8JX1nZ0NkUAgXpkZMTb85rO/Ru9AQ69wYW8VUCfDgP4CGRXXWYni5wDF0vIeR1UoF3Jmw/Lt3Ug=="
|
||||
"resolved" "https://registry.npmjs.org/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.12.0.tgz"
|
||||
"version" "0.12.0"
|
||||
dependencies:
|
||||
"@rollup/plugin-inject" "^5.0.1"
|
||||
|
||||
"rollup-plugin-typescript2@^0.34.1":
|
||||
"integrity" "sha512-P4cHLtGikESmqi1CA+tdMDUv8WbQV48mzPYt77TSTOPJpERyZ9TXdDgjSDix8Fkqce6soYz3+fa4lrC93IEkcw=="
|
||||
"resolved" "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.34.1.tgz"
|
||||
@@ -11369,7 +11500,7 @@
|
||||
"source-map" "^0.7.4"
|
||||
"yargs" "^17.5.1"
|
||||
|
||||
"rollup@^1.20.0||^2.0.0||^3.0.0", "rollup@^2.78.0||^3.0.0", "rollup@^3.0.0", "rollup@^3.15.0", "rollup@> 1.0", "rollup@>=1.26.3", "rollup@2.x || 3.x":
|
||||
"rollup@^1.20.0 || ^2.0.0 || ^3.0.0", "rollup@^1.20.0||^2.0.0||^3.0.0", "rollup@^2.68.0||^3.0.0", "rollup@^2.78.0||^3.0.0", "rollup@^3.0.0", "rollup@^3.15.0", "rollup@> 1.0", "rollup@>=1.26.3", "rollup@2.x || 3.x":
|
||||
"integrity" "sha512-9wE1H5N1SJqnROpQanBGJ7lrIitwlUYGj4Va4eyf3+vNhoIHLPLag2/CUGIiq3V9lHOBJB6zTsGsPvc50oeihg=="
|
||||
"resolved" "https://registry.npmjs.org/rollup/-/rollup-3.16.0.tgz"
|
||||
"version" "3.16.0"
|
||||
@@ -11804,6 +11935,11 @@
|
||||
dependencies:
|
||||
"amdefine" ">=0.0.4"
|
||||
|
||||
"sourcemap-codec@^1.4.8":
|
||||
"integrity" "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="
|
||||
"resolved" "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz"
|
||||
"version" "1.4.8"
|
||||
|
||||
"spdx-correct@^3.0.0":
|
||||
"integrity" "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w=="
|
||||
"resolved" "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz"
|
||||
|
||||
Reference in New Issue
Block a user