Quickstart
In five minutes you'll enrol two devices into a ScaiClip personal channel, publish an encrypted clip from one, and see it arrive on the other. Everything ciphered client-side; the grid holds only opaque bytes.
You need:
- A ScaiGrid endpoint (managed or self-hosted) with the ScaiClip module enabled.
- A user sgk_ key with scopes
scaiclip:readandscaiclip:write, or a user JWT. - Python 3.10+ with
pip install cbor2 pynacl httpx websockets.
1 2 | |
1. Register two devices#
Each client generates its own X25519 KEM keypair and Ed25519 signing keypair. Private keys never leave the device.
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 | |
2. Connect both devices to the personal channel#
Each device opens its own WebSocket on /v1/modules/scaiclip/ws. The personal channel is auto-created on first connect.
1 2 3 4 5 6 7 8 9 | |
Every client-originated frame carries a 16-byte header (ver | type | flags | request_id | body_length | reserved) followed by a canonical-CBOR body. See the SCWP reference for the wire format.
3. Publish a clip from the phone#
The phone encrypts a UTF-8 text clip with a fresh XChaCha20-Poly1305 content key, wraps that key for every enrolled device via HPKE, signs the envelope, and sends clip.publish.
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 | |
Some helpers (uuid7_bytes, sign, personal_channel_id resolution via channel.list) are omitted for brevity — see the two-device tutorial for the complete runnable script.
4. Receive on the laptop#
The laptop's socket sees clip.new (0x90) with the same envelope. It verifies the signature against the phone's sig_pub (fetched via channel.devices), unwraps its own copy of the content key with its KEM private key, decrypts, hits the OS clipboard.
Total round-trip: under 250 ms warm.
What just happened#
- The grid never saw plaintext. Ciphertext + wraps only.
- The phone signed the envelope. The laptop verified before decrypting — spoofed envelopes are rejected.
- Both wraps were pre-installed at enrolment. New devices trigger the onboarding flow with
wraps.readypush events.
What's next#
- Core concepts — the mental model.
- Encryption & consent — the crypto in detail.
- Two-device round trip tutorial — the runnable script this quickstart summarised.
- SCWP reference — every verb.