Gleam SDK for Pocketenv
1
fork

Configure Feed

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

Fix BLAKE2b-24 nonce derivation using Blake2.hash2b

Bump package to 1.1.2 and add blake2 dependency and manifest entry
Update CHANGELOG.md accordingly

+12 -2
+7
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.2] - 2026-04-02 9 + 10 + ### Fixed 11 + 12 + - Replace `crypto:hash({blake2b, 24}, ...)` with `Blake2.hash2b/2` for BLAKE2b-24 nonce derivation — the Erlang built-in produced output incompatible with libsodium, causing decryption failures in Node.js `libsodium-wrappers` 13 + - Add `blake2` as an explicit dependency 14 + 8 15 ## [1.1.1] - 2026-04-02 9 16 10 17 ### Changed
+2 -1
gleam.toml
··· 1 1 name = "pocketenv" 2 - version = "1.1.1" 2 + version = "1.1.2" 3 3 4 4 description = "Gleam SDK for Pocketenv" 5 5 licences = ["MIT"] ··· 23 23 gleam_httpc = ">= 5.0.0 and < 6.0.0" 24 24 gleam_json = ">= 3.0.0 and < 4.0.0" 25 25 kcl = ">= 0.1.0 and < 1.0.0" 26 + blake2 = ">= 1.0.0 and < 2.0.0" 26 27 27 28 [dev-dependencies] 28 29 gleeunit = ">= 1.0.0 and < 2.0.0"
+2
manifest.toml
··· 2 2 # You typically do not need to edit this file 3 3 4 4 packages = [ 5 + { name = "blake2", version = "1.0.4", build_tools = ["mix"], requirements = [], otp_app = "blake2", source = "hex", outer_checksum = "E9F4120D163BA14D86304195E50745FA18483E6AD2BE94C864AE449BBDD6A189" }, 5 6 { name = "chacha20", version = "0.3.6", build_tools = ["mix"], requirements = [], otp_app = "chacha20", source = "hex", outer_checksum = "40BC6B1F4816661C07A3244D46D74640F108F69EB61F96D2DD22DCBA0E7FCA38" }, 6 7 { name = "curve25519", version = "0.1.4", build_tools = ["mix"], requirements = [], otp_app = "curve25519", source = "hex", outer_checksum = "3460590592DA61D5D0C309E2EC469290963129BFB6EE6E5F692AE8E0334161B3" }, 7 8 { name = "ed25519", version = "0.2.5", build_tools = ["mix"], requirements = [], otp_app = "ed25519", source = "hex", outer_checksum = "87233BFC85D0BE366EDDF870B6C021396FA34BDC48472AA8582B7333D1459147" }, ··· 18 19 ] 19 20 20 21 [requirements] 22 + blake2 = { version = ">= 1.0.0 and < 2.0.0" } 21 23 gleam_http = { version = ">= 4.0.0 and < 5.0.0" } 22 24 gleam_httpc = { version = ">= 5.0.0 and < 6.0.0" } 23 25 gleam_json = { version = ">= 3.0.0 and < 4.0.0" }
+1 -1
src/pocketenv_crypto_ffi.erl
··· 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 - Nonce = crypto:hash({blake2b, 24}, <<EphPK/binary, RecipientPK/binary>>), 12 + Nonce = 'Elixir.Blake2':hash2b(<<EphPK/binary, RecipientPK/binary>>, 24), 13 13 {Ciphertext, _State} = 'Elixir.Kcl':box(Message, Nonce, EphSK, RecipientPK), 14 14 <<EphPK/binary, Ciphertext/binary>>.