io:guest

The io:guest attribute lets anyone open the source of a deployment that has an edge worker. Without it, an edge worker makes the source private to the owner and the editors, plus any io:user permits.

Syntax

html
<script type=worker edge io:guest>
  export default { fetch: r => new Response(r.url) }
</script>
<meta io:user=example.com io:guest>

The attribute can go on any element. It matters most on <script type=worker edge>.

Value

io:guest is a Boolean attribute. Write it without a value.

Description

A deployment that has an edge worker keeps its source private by default: only the owner, the editors and io:user permits can open it with ?. io:guest lifts that. On a worker script, it says that this worker does not need a private source. On an element that also carries io:user, it cancels that element's list.

io:guest makes the source public only when it removes the last protection. Every edge worker must carry it, and the deployment must have no edge:user and no other io:user on an element without io:guest. The attribute is read when you deploy. It does not change who may view the deployment.

PlaygroundRTEdge.net
EffectNone. The playground does not enforce access attributes.Decides whether the source opened with ? is public or private.
The attribute in the deployed pageIt stays in your source.It is removed from the served HTML, and kept in the authored source that ? opens.

Usage notes

An edge worker makes the source private

Deploying any edge worker without io:guest makes your source private to the owner and the editors, plus any io:user permits. Add io:guest when the source should stay open, for example for a demo or an example you want people to read.

Put it on every edge worker

The attribute is read from every edge worker script of the deployment. The source stays public only if every one of them carries io:guest.

What keeps the source private

A separate <meta io:user> on an element without io:guest, or any edge:user, keeps the source private even when every edge worker carries io:guest. io:guest cancels only the io:user on its own element.

A public source is public code

Anyone can read the full authored source, including the edge worker, by appending ?. Do not keep secrets in a deployment whose source is public. See Keeping secrets out of deployments.

At deploy time

The attribute is read when you deploy and is removed from the served HTML. It stays in the authored source. To change the source access, edit the attributes and deploy again.

Examples

Share a worker demo

html
<iframe src=:></iframe>
<script type=worker edge io:guest>
  export default { fetch: r => new Response(r.url) }
</script>

With io:guest on the only edge worker, and no edge:user or io:user, anyone can open the deployed source with ?. Without it, the source is private.

A separate io:user keeps it private

html
<meta io:user=example.com>
<script type=worker edge io:guest>
  export default { fetch: () => new Response('ok') }
</script>

The <meta io:user> has no io:guest on its own element, so the source stays private to the owner, the editors and @example.com accounts, although the worker carries io:guest.

Cancel an io:user on the same element

html
<meta io:user=example.com io:guest>
<h1>Open source</h1>

io:guest cancels the io:user on its own element. If nothing else protects the source, anyone can open it.

Specifications

Not part of any specification. io:guest is an RTCode.io and RTEdge.net attribute.

Availability

FeaturePlaygroundRTEdge.netNotes
io:guestNoYesRead when you deploy. The playground does not enforce it.
io:guest on an edge worker scriptNoYesKeeps the source of a worker deployment public.

See also