Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@myetherwallet/mewconnect-web-client
Advanced tools
<!--##### Note This Repository Nees Some Cleaning-->
The example requires both MEWconnect-web-client (this repo) and MEWconnect-Signal-Server (MEWconnect-hanshake-server)
git clone https://github.com/MyEtherWallet/MEWconnect-web-client.git
Install the dependencies:
npm install
Start the server serving the example initiator and receiver:
npm start
Clone the repo:
git clone https://github.com/MyEtherWallet/MEWconnect-hanshake-server.git
Install the dependencies:
npm install
Start the signaling server:
npm start
Two Peers are needed with one designated as the Initiator and the other as the Receiver.
Require the MEWconnect client
let mewConnect = require('@myetherwallet/mewconnect-web-client').Client;
Initiate the client
let mewConnectClient = mewConnect.init();
MEWconnect Client functions as an event emitter. The connection details are passed along with the 'codeDisplay' event
mewConnectClient.on('codeDisplay', code => {
// do something with the code.
// to work with the MEWconnect Mobile applications display it as a qrcode
}
Now call the initiatorStart method to create the connection details:
mewConnectClient.initiatorStart('https://signal-server-url')
Once a p2p connection is established the client will emit a 'rtcConnected' event
mewConnectClient.on('rtcConnected', () =>{
alert('congrats you are connected to mew connect!')
})
Once a connection is extablished call the 'sendRtcMessage' method to interact with the app
mewConnectClient.sendRtcMessage('address', {})
The 'sendRtcMessage' method takes two parameters (message type, message data)
To get the response listen for an event matching the sent message type
mewConnectClient.on('address', address => {
alert('got address: ' + address)
})
Currently the app supports two other message types: 'signMessage', and 'signTx'
exists you can get the address or send a transaction or message to the mobile app for signing.
The data portion of those two message types are:
signMessage
{
hash: 'hash of the message to be signed',
text: 'text of the message to be signed'
}
signTx
{
nonce:"0x00",
gasPrice:"0x098bca5a00",
gas:"0x5208",
to:"0xc3982F1DbAB6DA9d95F579B9A5f9c5CAb13F8cfC",
value:"0xb1a2bc2ec50000",
data:"",
chainId:3
}
If the p2p connection fails to be established the client can attempt to use an intermediate TURN server to facilitate the connection. To signal a failed p2p attempt the client can call the 'useFallback' method on the client
mewConnectClient.useFallback()
Additional events are emitted at various points to signal various stages of the connection
SocketConnectedEvent
RtcInitiatedEvent
UsingFallback
RtcConnectedEvent
RtcClosedEvent
RtcDisconnectEvent
RtcErrorEvent
mew-connect-client can be included for use in the browser via webpack or browerfy
FAQs
[MEWconnect Demo](https://myetherwallet.github.io/MEWconnect-web-client/#/home)
The npm package @myetherwallet/mewconnect-web-client receives a total of 40 weekly downloads. As such, @myetherwallet/mewconnect-web-client popularity was classified as not popular.
We found that @myetherwallet/mewconnect-web-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.