A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/library/lib/setup-untrusted-connection.js

27 lines
859 B

/*
IFRAME
var pageStream = new LocalMessageDuplexStream({
name: 'contentscript',
target: 'inpage',
})
SERVICEWORKER
pageStream.on('error', console.error)
var pluginPort = extension.runtime.connect({name: 'contentscript'})
var pluginStream = new PortStream(pluginPort)
pluginStream.on('error', console.error)
IFRAME --> SW
// forward communication plugin->inpage
pageStream.pipe(pluginStream).pipe(pageStream)
*/
module.exports = SetupUntrustedComunicationWithSW
function SetupUntrustedComunicationWithSW (connectionStream, readySwStream) {
pageStream.on('error', console.error)
var pluginPort = extension.runtime.connect({name: 'contentscript'})
var pluginStream = new PortStream(pluginPort)
pluginStream.on('error', console.error)
// forward communication plugin->inpage
pageStream.pipe(pluginStream).pipe(pageStream)
}