OverviewFilesCommitsIssuesDocsReleasesPeers

keet-cli / deobfuscated / api / v2 / index.js

242 lines · javascript ref:
const _0x27fc16=(function(){let _0x52ff31=!![];return function(_0x51561a,_0x4109fe){const _0x170861=_0x52ff31?function(){if(_0x4109fe){const _0x4584d0=_0x4109fe.apply(_0x51561a,arguments);return _0x4109fe=null,_0x4584d0;}}:function(){};return _0x52ff31=![],_0x170861;};}()),_0x4ef1d7=_0x27fc16(this,function(){_0x37f544={_0x29cc01:0x69};return _0x4ef1d7.toString().search("(((.+)+)+)+$").toString().constructor(_0x4ef1d7).search("(((.+)+)+)+$");});
_0x4ef1d7();
const ReadyResource=require('ready-resource'),safetyCatch=require('safety-catch'),KeetClient=require('../../packages/client/index.js'),{
  api:{
    hrpc:RPC}
}
=require('../../spec'),{
  KeetMethod}
=require('./base'),V2KeetCoreAPI=require('./core'),V2KeetCallAPI=require('./call'),V2KeetDebugAPI=require('./debug'),V2KeetErrorAPI=require('./error'),V2KeetNetworkAPI=require('./network');
class BootMethod extends KeetMethod{
  ._run(){
    _0x31980={
      _0x1256b2:0x491,_0x423d82:0x13d},_0x27100e={
      _0x3ffe2f:0x18f,_0x315cef:0xe7}
    ;
    return this.backend.coreAPI.boot();
  }
}
class SelfDestructMethod extends KeetMethod{
  async._run(){
  }
}
module.exports=class V2KeetBackend extends ReadyResource{
  constructor(_0x2c3433,_0x4cbc30,_0x5c6990={}){
    _0x58b96a={
      _0x588e43:0xe5,_0x5496c2:0xc9},_0x21e37e={
      _0x2fb277:0x10,_0x5b70df:0x15f,_0x1fb4ed:0x184}
    ;
    super(),this.keet=_0x2c3433,this.stream=_0x4cbc30;
    this.opts=_0x5c6990,this.view=new KeetClient[("View")]();
    this.rpc=new RPC(_0x4cbc30),this._apis=null,this.rpc.onBoot(this.onBoot.bind(this)),this.rpc.onSelfDestruct(this.onSelfDestruct.bind(this)),this.stream.on('close',this.close.bind(this));
    if(!this.keet.opened)throw new Error("Keet must be opened before\x20starting\x20RPC");
    this.ready().catch(_0x5c6990.onerror||safetyCatch);
  }
async._open(){
  _0x26fe39={
    _0x3d2898:0x12a,_0x4de70:0xd3},_0x199b61={
    _0x1d3383:0x33,_0x5793fb:0x1f6}
  ;
  this.coreAPI=new V2KeetCoreAPI(this),this.callAPI=new V2KeetCallAPI(this),this.debugAPI=new V2KeetDebugAPI(this),this.errorAPI=new V2KeetErrorAPI(this),this.networkAPI=new V2KeetNetworkAPI(this),this.apis=[this.coreAPI,this.callAPI,this.debugAPI,this.errorAPI,this.networkAPI],this.keet.on("v2:room-changed",this._onRoomChanged.bind(this)),this.keet.on("v2:room-chat-changed",this._onRoomChatChanged.bind(this)),this.keet.on("v2:room-stats-changed",this._onRoomStatsChanged.bind(this)),this.keet.on("v2:room-digest-changed",this._onRoomDigestChanged.bind(this)),this.keet.on("v2:room-member-changed",this._onRoomMemberChanged.bind(this)),this.keet.on("v2:room-device-changed",this._onRoomDeviceChanged.bind(this)),this.keet.on("v2:room-config-changed",this._onRoomConfigChanged.bind(this)),this.keet.on("v2:room-reactions-changed",this._onRoomReactionsChanged.bind(this)),this.keet.on("v2:room-join-requests-changed",this._onRoomJoinRequestsChanged.bind(this));
  this.view.members.on("update",this._pushMember.bind(this)),this.view.devices.on("update",this._pushDevice.bind(this)),this.view.lobby.on('reset',this._pushLobby.bind(this)),this.view.identity.on("reset",this._pushIdentity.bind(this)),this.view.roomInfo.on("update:reset",this._pushRoomInfo.bind(this));
  this.view.roomInfo.on("update:role",this._pushRoomInfoRole.bind(this)),this.view.roomInfo.on("update:digest",this._pushRoomInfoDigest.bind(this)),this.view.roomInfo.on("update:config",this._pushRoomInfoConfig.bind(this)),this.view.roomInfo.on("update:message",this._pushRoomInfoMessage.bind(this)),this.view.chat.on("reset",this._pushChat.bind(this)),this.view.messageInfo.on("update:reset",this._pushMessageInfo.bind(this)),this.view.messageInfo.on("update:role",this._pushMessageInfoRole.bind(this)),this.view.messageInfo.on("update:member",this._pushMessageInfoMember.bind(this)),this.view.messageInfo.on("update:chat",this._pushMessageInfoChat.bind(this)),this.view.messageInfo.on("update:reactions",this._pushMessageInfoReactions.bind(this)),await Promise.all(this.apis.map(_0x3ea072=>_0x3ea072.ready()));
}
async._close(){
  _0x130351={
    _0x263c75:0xb2,_0x36c1ce:0x66},_0x2a983c={
    _0x4f1a95:0x151,_0xe0f0d4:0x96}
  ;
  if(this.apis)await Promise.all(this.apis.map(_0x242693=>_0x242693.close()));
}
._onPairingChanged(_0xca6778){
  _0x274252={
    _0x1d3f9b:0x84,_0x2061b4:0x192,_0x58ccf8:0xec},_0x3ce324={
    _0x20cb8c:0x1f0}
  ;
  this.coreAPI.onPairingChanged(_0xca6778);
}
._onRoomChanged(_0x1226f5){
  _0x4fe2c8={
    _0x17d0d7:0x16f,_0x49ca90:0x55,_0x7d5ced:0x3b1},_0x254fc2={
    _0x15ac1d:0x17}
  ;
  this.coreAPI.onRoomChanged(_0x1226f5);
}
._onRoomStatsChanged(_0x46a475){
  _0x1a6c99={
    _0x55ae8a:0x128,_0x57cf02:0x1ee,_0x1096c7:0x1af}
  ;
  this.coreAPI.onRoomStatsChanged(_0x46a475);
}
._onRoomChatChanged(_0xa28a1d){
  _0x55bdac={
    _0x120d27:0xf1,_0x3e43c6:0x23c},_0x4c6b20={
    _0x2c064c:0x2d2}
  ;
  this.coreAPI.onRoomChatChanged(_0xa28a1d);
}
._onRoomDigestChanged(_0x17b629){
  _0x58a109={
    _0x13ab63:0x7d,_0x199b01:0xc0,_0x205514:0x3e},_0xc0848f={
    _0x3b51f8:0x100,_0x50e590:0x96}
  ;
  this.coreAPI.onRoomDigestChanged(_0x17b629);
}
._onRoomMemberChanged(_0x540dab){
  _0x45b657={
    _0x3639e6:0x215,_0x1d73a0:0x12,_0x128296:0xfe},_0x30fa17={
    _0x40aeea:0xb4}
  ;
  this.coreAPI.onRoomMemberChanged(_0x540dab);
}
._onRoomDeviceChanged(_0x1484d0){
  _0xba6472={
    _0x5b0999:0x3b,_0x114c22:0x1d9},_0x4e1ffd={
    _0x11b5b4:0x19f,_0x46fd2b:0x1aa,_0x19f598:0x44}
  ;
  this.coreAPI.onRoomDeviceChanged(_0x1484d0);
}
._onRoomConfigChanged(_0x435fa2){
  _0x4c46f6={
    _0x39af68:0xc0,_0x5579f8:0x2fe},_0x5a3a5d={
    _0x98f26e:0x2ff,_0x256ce1:0x1c8,_0x590ba7:0x5e}
  ;
  this.coreAPI.onRoomConfigChanged(_0x435fa2);
}
._onRoomReactionsChanged(_0x28d79a){
  _0x4f8584={
    _0x2753b2:0x5e,_0x31fd69:0x1d9}
  ;
  this.coreAPI.onRoomReactionsChanged(_0x28d79a);
}
._onRoomJoinRequestsChanged(_0x5db536){
  _0xde8dfb={
    _0x367160:0xd3,_0x39b48d:0x4e,_0x253682:0x23b},_0x4ff80f={
    _0x58b535:0x3ca,_0x5e6c6a:0x73}
  ;
  this.coreAPI.onRoomJoinRequestsChanged(_0x5db536);
}
._pushMember(_0x496b4c,_0x2a37a0){
  _0x580185={
    _0x275782:0x1b9,_0x277892:0xa0,_0x55cf3a:0x25a}
  ;
  return this.rpc.coreMember(_0x2a37a0);
}
._pushDevice(_0xa9e987,_0x415fdc){
  _0x136e9a={
    _0xc518ac:0x3d,_0x28330b:0x182,_0x766c59:0x97},_0xc28672={
    _0x2f3ad0:0x9e,_0x2762f0:0x1ce,_0x3578f0:0xd}
  ;
  return this.rpc.coreDevice(_0x415fdc);
}
._pushMessage(_0x4c6066,_0x27220e){
  _0x564201={
    _0x1de2f8:0x19f,_0x44344d:0x9c},_0x580221={
    _0x38386d:0x17c,_0xfec680:0x33d}
  ;
  return this.rpc.coreMessage(_0x27220e);
}
._pushIdentity(){
  _0x4136b1={
    _0x4745c7:0x1d7,_0x55578f:0x2e5},_0x3b2b7b={
    _0x476a15:0x439,_0x256838:0x182,_0x50a419:0x171}
  ;
  return this.rpc.coreIdentityReset(this.view.identity);
}
._pushLobby(){
  _0x4ea40e={
    _0x32e9ab:0x2ef,_0x597420:0x38},_0x3a31e5={
    _0x3ddc5d:0x3c8,_0xe25600:0xbf,_0x51f194:0x35}
  ;
  return this.rpc.coreLobbyReset(this.view.lobby);
}
._pushRoomInfoMessage(_0x4e7823){
  _0x15fb26={
    _0x317778:0x260,_0x43ab63:0x19},_0xe18eb7={
    _0x24799e:0x64,_0x2f4f94:0x1e8}
  ;
  return this.rpc.coreRoomInfoLastMessage({'id':_0x4e7823.id,'lastMessage':_0x4e7823.messageId});
}
._pushRoomInfoDigest(_0x4c1814){
  _0x40b779={
    _0x16e200:0x164},_0x594026={
    _0x575793:0x155,_0x2427d1:0xa0}
  ;
  return this.rpc.coreRoomInfoDigest(_0x4c1814);
}
._pushRoomInfoConfig(_0x587dc4){
  _0x4d4918={
    _0x2ea407:0x3ce,_0x2fa579:0x1e7,_0x48a16b:0x1d1},_0x1545f3={
    _0x3dccda:0xb9,_0xda8db9:0x23c}
  ;
  return this.rpc.coreRoomInfoConfig(_0x587dc4);
}
._pushRoomInfoRole(_0x3679a3){
  _0x339273={
    _0x20c082:0x2c6,_0x20848a:0xdc,_0x1aabcf:0xe0}
  ;
  return this.rpc.coreRoomInfoRole(_0x3679a3);
}
._pushRoomInfo(_0x13f3b4){
  _0x29585b={
    _0x6bd806:0x11f,_0x471ea1:0x21b},_0x3f0570={
    _0xaad496:0x19d,_0x197fe6:0x1f0,_0x59e932:0x150}
  ;
  return this.rpc.coreRoomInfo(_0x13f3b4);
}
._pushChat(){
  _0x999402={
    _0x336e8d:0x204,_0x48f7d9:0x7},_0x5317ce={
    _0x23206c:0xff,_0x45d454:0x17d,_0x3bdfc1:0xc9}
  ;
  return this.rpc.coreChatReset(this.view.chat);
}
._pushMessageInfo(_0x33c9be){
  _0x4baa6e={
    _0x371e3c:0x4e0,_0x49bdfa:0x1c7,_0x859f76:0xb6},_0x357fdc={
    _0x45147b:0x1ca,_0x2ff655:0x244}
  ;
  return this.rpc.coreMessageInfo(_0x33c9be);
}
._pushMessageInfoChat(_0x324520){
  _0x3f72c3={
    _0x56d9c4:0x3bc,_0xa5c39e:0x58},_0x505294={
    _0x571900:0x1aa,_0x469310:0x161,_0x49a2f8:0x20b}
  ;
  return this.rpc.coreMessageInfoChat(_0x324520);
}
._pushMessageInfoMember(_0x5f2863){
  _0x26e455={
    _0xedc391:0xe1,_0x263dbb:0xb8}
  ;
  return this.rpc.coreMessageInfoMember(_0x5f2863);
}
._pushMessageInfoRole(_0x4fd051){
  _0x51dc79={
    _0x404c3d:0x1b0,_0x3d631a:0x58,_0x65b26a:0x4},_0x5a9f95={
    _0x44a48e:0x3c,_0x15ff29:0x3}
  ;
  return this.rpc.coreMessageInfoRole(_0x4fd051);
}
._pushMessageInfoReactions(_0x151335){
  _0x428930={
    _0x4e3c85:0x72,_0x1e4595:0x19,_0x18b6ff:0xfa},_0x5dc0b5={
    _0x1d6bce:0x170,_0x5edc9a:0x57,_0x2f0ef5:0x6e}
  ;
  return this.rpc.coreMessageInfoReactions(_0x151335);
}
.onBoot(){
  _0x394dbf={
    _0x524196:0x3d8,_0x2b47fb:0x1e}
  ;
  return BootMethod.run(this);
}
.onSelfDestruct(){
  _0x417d33={
    _0x2b10ba:0x136,_0x18fa59:0x245}
  ;
  return SelfDestructMethod.run(this);
}
}
;