import { log } from '../main.js'; export class DkaAttestConfirm extends HTMLElement { static get observedAttributes() { return ['did-key', 'already-associated', 'requester-did', 'bidder-did']; } connectedCallback() { log('debug', 'attest', 'connected'); this.render(); } set didKey(value) { this.setAttribute('did-key', value); } get didKey() { return this.getAttribute('did-key') || ''; } attributeChangedCallback(name, oldVal, newVal) { if (oldVal !== newVal && this.isConnected) { log('debug', 'attest', 'attrChanged', { name, newVal }); this.render(); } } render() { const did = this.getAttribute('did-key') || ''; const requesterDid = this.getAttribute('requester-did') || ''; const bidderDid = this.getAttribute('bidder-did') || ''; const already = this.getAttribute('already-associated') === 'true'; const isRequester = !!requesterDid; const isBidder = !!bidderDid; const displayDid = isRequester ? requesterDid : isBidder ? bidderDid : did; log('info', 'attest', 'render', { did: displayDid || null, already, isRequester, isBidder, willRender: !!displayDid }); if (!displayDid) { this.innerHTML = ''; return; } if (already) { this.innerHTML = `
This key is already associated with your account.
Confirm you want to associate with this bidder. This tells the network you trust this compute provider.
Confirm you want to associate with this requester. This will notify the requester to proceed with your compute contract.
Publicly attesting this did:key belongs to your account.
This doesn't grant it access to anything — it just tells the network you operate it.