-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat: libsignal wasm #2067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jlucaso1
wants to merge
75
commits into
develop
Choose a base branch
from
feat-libsignal-wasm
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,903
−3,505
Open
feat: libsignal wasm #2067
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
986a737
feat: extend signalStorage type to include loadSignedPreKey method
jlucaso1 5a719a2
feat: group support
jlucaso1 b879c3a
refactor: replace libsignal dependency with whatsapp-rust-bridge func…
jlucaso1 1f2128f
fix: import Long type for improved type handling
jlucaso1 2c774f5
chore: update whatsapp-rust-bridge to version 0.4.0-alpha.2
jlucaso1 224b2a8
fix: update whatsapp-rust-bridge to version 0.4.0-alpha.3 (migration …
jlucaso1 65725a6
fix: update whatsapp-rust-bridge to version 0.4.0-alpha.4
jlucaso1 a0cb521
chore: bump whatsapp-rust-bridge
jlucaso1 7005256
fix: simplify address creation in group message handling
jlucaso1 6d51078
chore: update whatsapp-rust-bridge to version 0.4.1
jlucaso1 b66cd67
fix: improve error handling in message decryption
jlucaso1 1124e4c
chore: update whatsapp-rust-bridge to version 0.4.4
jlucaso1 4d3a0d6
chore: update whatsapp-rust-bridge to version 0.4.5
jlucaso1 03a67e5
chore: update whatsapp-rust-bridge to version 0.4.6 and set logger in…
jlucaso1 8e7e202
chore: update whatsapp-rust-bridge to version 0.4.7
jlucaso1 113a85b
chore: update whatsapp-rust-bridge to version 0.4.8
jlucaso1 0f964dd
fix: force 99 deviceId to be hosted device
jlucaso1 89e3f75
fix: update whatsapp-rust-bridge to version 0.5.0-alpha.1
jlucaso1 bbdeaa6
perf: binary serialization works better with lru-cache
jlucaso1 3a2b93c
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 8614d17
Merge branch 'master' into feat-libsignal-wasm
jlucaso1 ed0802c
chore: merge develop into feat-libsignal-wasm
jlucaso1 6f1e6c7
fix: scope device domainType per device, guard SKDM input
jlucaso1 3c89612
fix(signal): honor signature results and keep pre-WASM sessions readable
jlucaso1 1f34024
fix(signal): never revive a closed legacy session, keep live LID sess…
jlucaso1 a28a7db
feat(signal): convert pre-WASM sessions through the core's typed model
jlucaso1 45922f6
fix(bridge): key identity records by the full address
jlucaso1 cb420b9
fix(bridge): delete the pre-key a prekey message consumed
jlucaso1 728f8b9
feat(bridge): run signal operations over a snapshot
jlucaso1 bdcb9e7
feat(signal): move the session path onto the snapshot API
jlucaso1 a7e26ab
fix(signal): address device 99 and live LID sessions during migration
jlucaso1 1a68dec
fix(bridge): review fixes for the snapshot path
jlucaso1 7a1274e
ci: build the bridge from source when a change touches it
jlucaso1 af7ccd9
style(bridge): drop redundant to_string in format args
jlucaso1 1a8a4e7
fix(signal): lock the identity row with the session, and pick one dev…
jlucaso1 3189994
ci: force the bridge build in the job that exists to compile it
jlucaso1 28fe323
fix(signal): prefer the open row when a device has two address shapes
jlucaso1 f5a807b
perf(bridge): report the peer identity only when it changes
jlucaso1 251fceb
test(signal): generate the one-time pre-keys the fixtures use
jlucaso1 fa510ed
fix(bridge): treat an absent JS property as absent
jlucaso1 89dff66
ci: read the changed files without a pipe
jlucaso1 d82873f
test(bridge): unit-test the Rust side
jlucaso1 632367a
test(bridge): skip the Rust tests when wasm-pack is absent
jlucaso1 bfb489e
test(bridge): detect wasm-pack from Node instead of the shell
jlucaso1 4a087cf
Merge branch 'develop' into feat-libsignal-wasm
jlucaso1 20e69e8
fix: review follow-ups after the develop merge
jlucaso1 bd9e2c5
fix(signal): build a sender key without seeding an empty record
jlucaso1 7c268da
chore(bridge): pin the core that persists skipped-key seeds
jlucaso1 e673f3a
feat(signal): store sessions in the shape a pre-WASM release reads
jlucaso1 3aaa17f
test(signal): say what the assertions actually check
jlucaso1 ffb0802
fix(signal): rebuild a session the bridge cannot read
jlucaso1 d5faeb3
test(signal): prove the rebuilt session is persisted
jlucaso1 3606e32
feat(bridge): project a sender-key record into the v1 shape
jlucaso1 f5031d7
feat(signal): store group sender keys in the pre-WASM shape
jlucaso1 1e8a8f2
fix(bridge): keep the empty private signing key in the projected record
jlucaso1 1797917
build(bridge): add a profiling build that keeps symbols
jlucaso1 3d9eca8
build(bridge): fail the profiling build with an actionable message
jlucaso1 233d021
fix(bridge): read legacy sender keys whose buffers are base64 text
jlucaso1 d35efeb
fix(bridge): write legacy sender-key states oldest first
jlucaso1 fdeb5c3
fix(bridge): resolve wasm-bindgen from PATH in profiling builds
jlucaso1 734c0f6
test(bridge): stop forcing a GC between benchmark iterations
jlucaso1 a1deea8
fix(bridge): waive the core's counter lease
jlucaso1 c06ab3f
fix(bridge): waive the counter lease on the store paths too
jlucaso1 e8bd646
perf(bridge): keep the sender-key derivation the record cannot keep
jlucaso1 1d9eb8c
refactor(bridge): drop the legacy session JSON fallback
jlucaso1 ddb7f26
refactor(bridge): drop the callback-based session API
jlucaso1 4abc400
test: shrink the legacy fixture and record the wire parity vectors
jlucaso1 ecbdaf8
fix(bridge): make the recorded wire vectors typecheck and round-trip
jlucaso1 01c56a0
test(bridge): reject a malformed Buffer in a recorded vector
jlucaso1 be2f94e
chore(bridge): drop five unused dependencies
jlucaso1 2a904a2
fix(signal): read a pre-v1 legacy session record
jlucaso1 182ce3a
fix(signal): satisfy prettier, and drop the libsignal-node mention
jlucaso1 01a8f56
test(bridge): handle the Result from add_sender_key_state
jlucaso1 b302631
test(bridge): port the signal bench to the snapshot calls
jlucaso1 a6a0ca7
fix(bridge): clear the bench session when the peer's identity is repl…
jlucaso1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| name: Setup workspace | ||
| description: >- | ||
| Installs workspace dependencies, building whatsapp-rust-bridge from source | ||
| when the change touches it. | ||
|
|
||
| # `pnpm install` runs a postinstall hook that copies the last PUBLISHED bridge | ||
| # tarball into the workspace, so a change to the Rust crate or its TS wrapper is | ||
| # invisible to every other package until it is released. A PR that adds an | ||
| # export therefore fails here with "does not provide an export named ...", | ||
| # which says nothing about the code under review. | ||
| # | ||
| # When the change touches the bridge, skip that download and compile the crate | ||
| # instead, so the suite runs against the source in the PR. Otherwise keep the | ||
| # prebuilt: it is the same artifact consumers get, and it costs seconds. | ||
|
|
||
| inputs: | ||
| force-bridge-build: | ||
| description: >- | ||
| Compile the bridge regardless of what the change touches. Set by jobs that | ||
| cannot run without it, such as the bridge's own build. | ||
| required: false | ||
| default: 'false' | ||
| node-version: | ||
| description: Node version to install | ||
| required: false | ||
| default: 20.x | ||
| pnpm-version: | ||
| description: pnpm version to install | ||
| required: false | ||
| default: 10.28.2 | ||
|
|
||
| outputs: | ||
| bridge-built: | ||
| description: Whether the bridge was compiled from source | ||
| value: ${{ steps.detect.outputs.changed }} | ||
|
|
||
| runs: | ||
| using: composite | ||
|
|
||
| steps: | ||
| - name: Detect bridge changes | ||
| id: detect | ||
| shell: bash | ||
| env: | ||
| FORCE_BUILD: ${{ inputs.force-bridge-build }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| # Some jobs cannot run against a prebuilt at all. | ||
| if [ "$FORCE_BUILD" = "true" ]; then | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| echo "Bridge build forced by the caller." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # On a push to a protected branch there is no diff to consult and the | ||
| # published bridge may already be behind, so always build. | ||
| if [ "$EVENT_NAME" != "pull_request" ] && [ "$EVENT_NAME" != "pull_request_target" ]; then | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| echo "Not a pull request; building the bridge from source." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Ask the API rather than diffing, which would need the full history. | ||
| if ! files="$(gh api --paginate \ | ||
| "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files" \ | ||
| --jq '.[].filename')"; then | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| echo "::warning::Could not read the changed files; building the bridge from source." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # A here-string, not a pipe: grep -q exits at the first match, and a | ||
| # writer still filling the pipe would take SIGPIPE, which under pipefail | ||
| # fails the condition and quietly selects the prebuilt on exactly the | ||
| # large pull requests that most need the source build. | ||
| if grep -qE '^packages/whatsapp-rust-bridge/' <<< "$files"; then | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| echo "Bridge touched; building it from source." | ||
| else | ||
| echo "changed=false" >> "$GITHUB_OUTPUT" | ||
| echo "Bridge untouched; using the published prebuilt." | ||
| fi | ||
|
|
||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: ${{ inputs.pnpm-version }} | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| cache: 'pnpm' | ||
|
|
||
| - name: Install Rust toolchain (pinned via rust-toolchain.toml) | ||
| if: steps.detect.outputs.changed == 'true' | ||
| shell: bash | ||
| working-directory: packages/whatsapp-rust-bridge | ||
| run: rustup show | ||
|
|
||
| - name: Install wasm-pack | ||
| if: steps.detect.outputs.changed == 'true' | ||
| uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: wasm-pack | ||
|
|
||
| # Ubuntu's Binaryen is too old for the wasm-opt flags scripts/build-wasm.mjs | ||
| # passes. Keep this pinned pair in step with .github/workflows/bridge-build.yml. | ||
| - name: Cache Binaryen | ||
| if: steps.detect.outputs.changed == 'true' | ||
| id: cache-binaryen | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/binaryen-version_129 | ||
| key: binaryen-129-x86_64-linux | ||
|
|
||
| - name: Download & verify Binaryen (wasm-opt) | ||
| if: steps.detect.outputs.changed == 'true' && steps.cache-binaryen.outputs.cache-hit != 'true' | ||
| shell: bash | ||
| env: | ||
| BINARYEN_VERSION: '129' | ||
| BINARYEN_SHA256: 50b9fa62b9abea752da92ec57e0c555fee578760cd237c40107957715d2976ba | ||
| run: | | ||
| set -euo pipefail | ||
| tarball="binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz" | ||
| curl -fsSL "https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/${tarball}" -o "${tarball}" | ||
| echo "${BINARYEN_SHA256} ${tarball}" | sha256sum -c - | ||
| tar -xzf "${tarball}" -C /tmp | ||
| rm -f "${tarball}" | ||
|
|
||
| - name: Add Binaryen to PATH | ||
| if: steps.detect.outputs.changed == 'true' | ||
| shell: bash | ||
| run: echo "/tmp/binaryen-version_129/bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Cache cargo registry + target | ||
| if: steps.detect.outputs.changed == 'true' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| packages/whatsapp-rust-bridge/target | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('packages/whatsapp-rust-bridge/Cargo.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-cargo- | ||
|
|
||
| - name: Skip the prebuilt download | ||
| if: steps.detect.outputs.changed == 'true' | ||
| shell: bash | ||
| run: echo "WHATSAPP_RUST_BRIDGE_SKIP_PREBUILT=1" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Install dependencies | ||
| shell: bash | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Build the bridge from source | ||
| if: steps.detect.outputs.changed == 'true' | ||
| shell: bash | ||
| run: pnpm --filter whatsapp-rust-bridge build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.