johnandersen777.bsky.social/atlibs-fedproxy
fedproxy and ingress modules for atlibs: SSH public keys on your PDS, did:key ingress; pages and web tiles
0
0
import './ssh-public-key-form.js'
import './ssh-public-keys-list.js'
// A tile has no network and no session. The host sends page state down over tp-data
// (https://dasl.ing/tp-data.html) and gets { createKey } back up. Same components and
// render(state, previous) as examples/web/fedproxy-ssh-public-keys.
const status = document.querySelector('.status')
try {
const { addDataHandler, listen, sendData } = await import('/.well-known/web-tiles/data.js')
const views = [document.querySelector('ssh-public-key-form'), document.querySelector('ssh-public-keys-list')]
let previous
addDataHandler((state) => {
status.textContent = state.session === 'signed-in' ? '' : 'Log in on the host page to manage your keys.'
for (const view of views) view.render(state, previous)
previous = state
})
document.addEventListener('create-key', (e) => sendData({ createKey: e.detail }))
listen() // last: data.js drops anything sent before a handler is added
} catch (error) {
status.textContent = `This tile needs a host that speaks tp-data (/.well-known/web-tiles/data.js): ${error.message}`
}