Use inspectorKey

This commit is contained in:
Tobias Baunbaek
2024-01-30 10:20:07 +01:00
parent 6e1a7ef117
commit f6988154c2
2 changed files with 8 additions and 7 deletions

View File

@@ -62,8 +62,8 @@ customElements.define('devtools-inspector', class extends HTMLElement {
import inspector from 'inspector'
import { Inspector } from 'pear-inspect'
const pearInspector = await new Inspector({ inspector }).enable()
const { publicKey } = await pearInspector.enable()
console.log('Pear Inspector key:', publicKey.toString('hex'))
const { inspectorKey } = await pearInspector.enable()
console.log('Pear Inspector key:', inspectorKey.toString('hex'))
</div>
</li>
<li>Running your program and the Pear Inspector key will be logged</li>
@@ -97,16 +97,16 @@ customElements.define('devtools-inspector', class extends HTMLElement {
this.addKeyFormElem.addEventListener('submit', e => {
e.preventDefault()
const publicKey = this.addKeyInputElem.value
if (publicKey.length !== 64) {
const inspectorKey = this.addKeyInputElem.value
if (inspectorKey.length !== 64) {
this.addKeyErrorElem.textContent = 'Key needs to be 64 characters long'
return
}
const sessionId = generateUuid()
const inspectorSession = new Session({ publicKey: b4a.from(publicKey, 'hex') })
const inspectorSession = new Session({ inspectorKey: b4a.from(inspectorKey, 'hex') })
const app = {
publicKey,
inspectorKey,
title: '',
url: '',
inspectorSession

View File

@@ -10,7 +10,8 @@
}
},
"dependencies": {
"@holepunchto/pear-inspect": "^2.0.0",
"@holepunchto/pear-inspect": "^3.0.0",
"b4a": "^1.6.4",
"bare-path": "^2.1.0",
"redhat-overpass-font": "^1.0.0",
"ws": "^8.16.0"