1 import IdGenerator from '@/utils/IdGenerator'
2 import { EncryptedStream } from 'extension-streams'
3 // import * as PairingTags from './messages/PairingTags'
4 // import * as NetworkMessageTypes from './messages/NetworkMessageTypes'
7 * This is the javascript which gets injected into
8 * the application and facilitates communication between
9 * bytom chrome extension and the web application.
13 // Injecting an encrypted stream into the web application.
14 const stream = new EncryptedStream('inject', IdGenerator.text(64))
16 // Waiting for bytomExtension to push itself onto the application
17 stream.listenWith(msg => {
18 console.log(1111, msg)
19 if (msg && msg.hasOwnProperty('type') && msg.type === 'scatter') {
21 // window.scatter = new Scatterdapp(stream, msg.payload)
24 // Syncing the streams between the extension and the web application
25 stream.sync('bytom', stream.key)
29 const inject = new Inject()