Blog1 min read

Introducing Duo: a folding iPhone you can build for

A web page that folds, an OS that runs twice, and a sandbox for strangers’ code. Drag every figure.

A folding phone lives between 0° and 180°. A mockup shows the two ends. So we built the phone.

Every angle, not two30°60°90°120°150°0° closed180° flat2angles drawna mockup0°
0°

Duo is an unofficial, experimental project by Doan Labs. It is not an Apple product and is not affiliated with Apple.

Two ways to draw a screen

DOM can take typing but can't bend. A texture can bend but can't take typing. Duo uses both and swaps between them:

Live DOM · 5 px/mm
180°
Surface
Live DOM
Typeable
Yes
Bends
No
Column
70 px

A fixed eye

The bent glass shows whatever the flat panel showed along a ray from one eye, fixed at 40 cm:

what the flat panel showedfixed halfthe eye, fixed at z = 40 cm
120°
Lead display
Inner
Mirror copy
Cover
Cover glass
100%
Inner surface
Projected

Run the OS twice

One OS per display. The cover is the inner grid's left four columns, and both copies are always running:

12 min
inner · os.mirror = false
12 min
cover · os.mirror = true
40° handover
180°
Lead display
Inner
Running copy
Inner
Mirror copy
Cover
Fetches from
Inner only

The real shell, not a recording:

Measured, not eyeballed

Every radius comes off Apple's mesh. Every swipe follows the finger through a paused animation:

Cover display, measured77.4 × 112.5 mmhinge
drag to open →
currentTime = 0 ms
Inner glass
R 10.7 mm
Cover free edge
R 11.4 mm
Cover hinge edge
R 1.3 mm
Bezel
1.2 mm

A sandbox for strangers' code

Duo, taken apart. Tap a layer:

Duo, layer by layerWindowShellOS × 2RuntimeAppSDK + kitAppsandboxediframeallow-scripts onlyorigin nullparent is opaqueOne documentall bytes inlineCSPfirst in <head>owner · one HTML file
Layer
App
Trust
Sandboxed
Runs as
an opaque iframe
Below the line
No

Below is a stranger's app, running for real in the same sandbox. Watch it try to get out:

A stranger's app, sandboxedthe release, first byteshashing…2020202020202020202020202020202020202020202020202020202020202020sandbox="allow-scripts"parent.documentthe shell's DOMlocalStoragethe shell's storagedocument.cookiecookiesindexedDBanother app's datafetch("/")the networkwindow.opena new windowa stranger's apporigin "null"one MessagePortRuntime · the host
Escapes blocked
0 / 6
Hash
Matches
Nonce
One use
View
…

Then the part developers touch:

TypeScript
1// The hinge, live: 0 is closed, 180 flat. At most one event a frame.
2os.onView((v) => {
3 lid.style.transform = `rotateX(${180 - v.angle}deg)`
4})