Two-device round trip
The quickstart summary showed the shape; this tutorial is the runnable version. Copy, adapt endpoint + key, run.
Prerequisites#
bash
1 2 3 4 | |
Grab a key with scaiclip:read + scaiclip:write. Any tenant admin can mint one from the admin UI.
1. Device enrolment#
Two devices, each with its own X25519 KEM + Ed25519 signing keypair.
python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
2. Connect both devices#
Each opens its own WebSocket at /v1/modules/scaiclip/ws. The personal channel is auto-created on first channel.list.
python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
3. Discover the personal channel#
Both devices call channel.list. The response's first (and only) entry is the personal channel — its channel_id is 16 raw bytes.
python
1 2 3 4 5 6 7 | |
4. Publish an encrypted clip#
The phone encrypts, wraps the content key for both devices, signs, sends.
python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
5. Full script#
python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Expected output:
text
1 2 3 4 5 | |
Warm round-trip should complete in under 250 ms.
What to try next#
- Add a
SENSITIVEclip. Setenv[10] = 0x01. The grid clamps TTL to 90 s. - Send an image via
ref_scratch. Upload to Garage first viascratch.reserve/.commit, then publish an envelope with aMediaRefin key 20 pointing at the object. - Try a one-shot secret. Set
env[10] = 0x02and include one-shot wraps inclip.publishbody key 3. Firstclip.claimwins; second getsE_ALREADY_CLAIMED.