Gleam SDK for Pocketenv
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Switch crypto to kcl and use BLAKE2b-24 nonce

Compute nonce with crypto:hash({blake2b, 24}, ...) to match libsodium
Update CHANGELOG for 1.1.1 and uncomment Elixir version in CI

+12 -3
+10
CHANGELOG.md
··· 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 7 8 + ## [1.1.1] - 2026-04-02 9 + 10 + ### Changed 11 + 12 + - Switch crypto dependency from `enacl` to `kcl` (pure-Gleam, no native deps) 13 + 14 + ### Fixed 15 + 16 + - Uncomment Elixir version in test workflow CI configuration 17 + 8 18 ## [1.1.0] - 2026-04-02 9 19 10 20 ### Added
+2 -3
src/pocketenv_crypto_ffi.erl
··· 4 4 %% Implements libsodium crypto_box_seal (anonymous sealed box) without libsodium: 5 5 %% 6 6 %% 1. Generate ephemeral X25519 keypair via :crypto 7 - %% 2. Derive nonce = first 24 bytes of BLAKE2b(eph_pk || recipient_pk) 7 + %% 2. Derive nonce = BLAKE2b-24(eph_pk || recipient_pk) — matches libsodium exactly 8 8 %% 3. Encrypt with NaCl crypto_box via Kcl 9 9 %% 4. Output = eph_pk (32 bytes) || ciphertext 10 10 box_seal(Message, RecipientPK) -> 11 11 {EphPK, EphSK} = crypto:generate_key(ecdh, x25519), 12 - FullHash = crypto:hash(blake2b, <<EphPK/binary, RecipientPK/binary>>), 13 - <<Nonce:24/binary, _/binary>> = FullHash, 12 + Nonce = crypto:hash({blake2b, 24}, <<EphPK/binary, RecipientPK/binary>>), 14 13 {Ciphertext, _State} = 'Elixir.Kcl':box(Message, Nonce, EphSK, RecipientPK), 15 14 <<EphPK/binary, Ciphertext/binary>>.