diff --git a/.github/workflows/prep-crypto-nodejs-release.yml b/.github/workflows/prep-crypto-nodejs-release.yml
index d1865fdf6..2edf2cdfc 100644
--- a/.github/workflows/prep-crypto-nodejs-release.yml
+++ b/.github/workflows/prep-crypto-nodejs-release.yml
@@ -36,10 +36,13 @@ env:
jobs:
prepare-release:
- name: "Package nodejs package"
+ name: "Preparing crypto-nodejs release tag"
runs-on: ubuntu-latest
+ outputs:
+ tag: "${{ env.TAG_PREFIX }}${{ inputs.version }}"
steps:
- uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
# Generate changelog since last tag, if given
- name: Generate a changelog for upload
@@ -65,16 +68,15 @@ jobs:
- name: Set version
id: package_version
- uses: KageKirin/set-node-package-version@v0
- with:
- version: ${{ inputs.version }}
+ working-directory: ${{ env.PKG_PATH }}
+ run: npm version ${{ inputs.version }}
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Tagging Crypto-Node.js for release"
tag: "${{env.TAG_PREFIX}}${{ inputs.version }}"
- new_banch: "gh-action/release-${{ env.TAG_PREFIX }}${{ inputs.version }}"
+ new_branch: "gh-action/release-${{ env.TAG_PREFIX }}${{ inputs.version }}"
push: true
add: |
${{ env.PKG_PATH }}/package.json
@@ -91,18 +93,25 @@ jobs:
# no changes, use the default changelog for the body
- name: Update Github Release notes
- if: !inputs.previous_version
+ if: ${{!inputs.previous_version}}
uses: softprops/action-gh-release@v1
with:
draft: true
tag_name: ${{ env.TAG_PREFIX }}${{ inputs.version }}
body_path: "${{ env.PKG_PATH }}/CHANGELOG.md"
- # finally, let's create a PR for all this, too
+ # let's create a PR for all this, too
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
- branch: "gh-action/release-${{ env.TAG_PREFIX }}${{ inputs.version }}"
title: "Preparing Release ${{ env.TAG_PREFIX }}${{ inputs.version }}"
body: |
- Automatic Pull-Request to merge release ${{ env.TAG_PREFIX }}${{ inputs.version }} back into main
+ Automatic Pull-Request to merge release ${{ env.TAG_PREFIX }}${{ inputs.version }}
+
+ trigger-release:
+ # and trigger the tagging release workflow
+ uses: matrix-org/matrix-rust-sdk/.github/workflows/release-crypto-nodejs.yml@main
+ needs: ['prepare-release']
+ name: "Trigger release Workflow"
+ with:
+ tag: ${{needs.prepare-release.outputs.tag}}
diff --git a/.github/workflows/release-crypto-nodejs.yml b/.github/workflows/release-crypto-nodejs.yml
index 6a65dbaf1..19e6fcd73 100644
--- a/.github/workflows/release-crypto-nodejs.yml
+++ b/.github/workflows/release-crypto-nodejs.yml
@@ -21,7 +21,12 @@ on:
push:
tags:
- matrix-sdk-crypto-nodejs-v[0-9]+.*
-
+ workflow_call:
+ inputs:
+ tag:
+ description: "The tag to build with"
+ required: true
+ type: string
jobs:
upload-assets:
name: "Upload prebuilt libraries"
@@ -57,7 +62,15 @@ jobs:
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
+ # use the given tag
- uses: actions/checkout@v3
+ name: "Checking out ${{ inputs.tag }}"
+ if: "${{ inputs.tag }}"
+ with:
+ ref: ${{ inputs.tag }}
+ # use the default
+ - uses: actions/checkout@v3
+ if: "${{ !inputs.tag }}"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
@@ -90,7 +103,15 @@ jobs:
needs:
- upload-assets
steps:
+ # use the given tag
- uses: actions/checkout@v3
+ name: "Checking out ${{ inputs.tag }}"
+ if: "${{ inputs.tag }}"
+ with:
+ ref: ${{ inputs.tag }}
+ # use the default
+ - uses: actions/checkout@v3
+ if: "${{ !inputs.tag }}"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
@@ -113,4 +134,6 @@ jobs:
- name: Publish to npmjs.com
uses: JS-DevTools/npm-publish@v1
with:
+ package: ${{env.PKG_PATH}}/package.json
+ access: public
token: ${{ secrets.NPM_TOKEN }}
diff --git a/CONVENTIONAL_COMMITS.md b/CONVENTIONAL_COMMITS.md
new file mode 100644
index 000000000..c6a83fb1c
--- /dev/null
+++ b/CONVENTIONAL_COMMITS.md
@@ -0,0 +1,120 @@
+# Conventional Commits
+
+This project uses [Conventional
+Commits](https://www.conventionalcommits.org/). Read the
+[Summary](https://www.conventionalcommits.org/en/v1.0.0/#summary) or
+the [Full
+Specification](https://www.conventionalcommits.org/en/v1.0.0/#specification)
+to learn more.
+
+## Types
+
+Conventional Commits defines _type_ (as in `type(scope):
+message`). This section aims at listing the types used inside this
+project:
+
+| Type | Definition |
+|-|-|
+| `feat` | About a new feature. |
+| `fix` | About a bug fix. |
+| `test` | About a test (suite, case, runner…). |
+| `doc` | About a documentation modification. |
+| `refactor` | About a refactoring. |
+| `ci` | About a Continuous Integration modification. |
+| `chore` | About some cleanup, or regular tasks. |
+
+## Scopes
+
+Conventional Commits defines _scope_ (as in `type(scope): message`). This
+section aims at listing all the scopes used inside this project:
+
+
+
+
+ | Group |
+ Scope |
+ Definition |
+
+
+
+
+ | Crates |
+ sdk |
+ About the matrix-sdk crate. |
+
+
+ appservice |
+ About the matrix-sdk-appservice crate. |
+
+
+ base |
+ About the matrix-sdk-base crate. |
+
+
+ common |
+ About the matrix-sdk-common crate. |
+
+
+ crypto |
+ About the matrix-sdk-crypto crate. |
+
+
+ indexeddb |
+ About the matrix-sdk-indexeddb crate. |
+
+
+ qrcode |
+ About the matrix-sdk-qrcode crate. |
+
+
+ sled |
+ About the matrix-sdk-sled crate. |
+
+
+ store-encryption |
+ About the matrix-sdk-store-encryption crate. |
+
+
+ test |
+ About the matrix-sdk-test and matrix-sdk-test-macros crate. |
+
+
+ | Bindings |
+ apple |
+ About the matrix-rust-components-swift binding. |
+
+
+ crypto-nodejs |
+ About the matrix-sdk-crypto-nodejs binding. |
+
+
+ crypto-js |
+ About the matrix-sdk-crypto-js binding. |
+
+
+ crypto-ffi |
+ About the matrix-sdk-crypto-ffi binding. |
+
+
+ | Labs |
+ sled-state-inspector |
+ About the sled-state-inspector project. |
+
+
+ | Continuous Integration |
+ xtask |
+ About the xtask project. |
+
+
+
+
+## Generating `CHANGELOG.md`
+
+The [`git-cliff`](https://github.com/orhun/git-cliff) project is used
+to generate `CHANGELOG.md` automatically. Hence the various
+`cliff.toml` files that are present in this project, or the
+`package.metadata.git-cliff` sections in various `Cargo.toml` files.
+
+Its companion,
+[`git-cliff-action`](https://github.com/orhun/git-cliff-action)
+project, is used inside Github Action workflows.
diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml
index 8c9c7bcb0..9cd8c9fa1 100644
--- a/benchmarks/Cargo.toml
+++ b/benchmarks/Cargo.toml
@@ -12,7 +12,7 @@ criterion = { version = "0.3.5", features = ["async", "async_tokio", "html_repor
matrix-sdk-crypto = { path = "../crates/matrix-sdk-crypto", version = "0.5.0" }
matrix-sdk-sled = { path = "../crates/matrix-sdk-sled", version = "0.1.0", default-features = false, features = ["crypto-store"] }
matrix-sdk-test = { path = "../testing/matrix-sdk-test", version = "0.5.0" }
-ruma = { git = "https://github.com/ruma/ruma", rev = "7ec599e83d8ba6b2ace9e4fe184fc7560b0ff6ae" }
+ruma = { git = "https://github.com/ruma/ruma", rev = "ca8c66c885241a7ba3805399604eda4a38979f6b" }
serde_json = "1.0.79"
tempfile = "3.3.0"
tokio = { version = "1.17.0", default-features = false, features = ["rt-multi-thread"] }
diff --git a/bindings/apple/debug_build_xcframework.sh b/bindings/apple/debug_build_xcframework.sh
index 60625dd03..ace17ec24 100755
--- a/bindings/apple/debug_build_xcframework.sh
+++ b/bindings/apple/debug_build_xcframework.sh
@@ -34,7 +34,7 @@ REL_TYPE_DIR="debug"
# iOS Simulator arm64
if [ "$ACTIVE_ARCH" = "arm64" ]; then
- cargo +nightly build -p matrix-sdk-ffi ${REL_FLAG} --target "aarch64-apple-ios-sim"
+ cargo build -p matrix-sdk-ffi ${REL_FLAG} --target "aarch64-apple-ios-sim"
lipo -create \
"${TARGET_DIR}/aarch64-apple-ios-sim/${REL_TYPE_DIR}/libmatrix_sdk_ffi.a" \
@@ -42,7 +42,7 @@ if [ "$ACTIVE_ARCH" = "arm64" ]; then
# iOS Simulator intel
else
- cargo +nightly build -p matrix-sdk-ffi ${REL_FLAG} --target "x86_64-apple-ios"
+ cargo build -p matrix-sdk-ffi ${REL_FLAG} --target "x86_64-apple-ios"
lipo -create \
"${TARGET_DIR}/x86_64-apple-ios/${REL_TYPE_DIR}/libmatrix_sdk_ffi.a" \
@@ -84,8 +84,6 @@ if [ "$IS_CI" = false ] ; then
echo "Preparing matrix-rust-components-swift"
# Debug -> Copy generated files over to ../../../matrix-rust-components-swift
- echo "$(printf "import MatrixSDKFFIWrapper\n\n"; cat "${SWIFT_DIR}/sdk.swift")" > "${SWIFT_DIR}/sdk.swift"
-
rsync -a --delete "${GENERATED_DIR}/MatrixSDKFFI.xcframework" "${SRC_ROOT}/../matrix-rust-components-swift/"
rsync -a --delete "${GENERATED_DIR}/swift/" "${SRC_ROOT}/../matrix-rust-components-swift/Sources/MatrixRustSDK"
fi
diff --git a/bindings/matrix-sdk-crypto-ffi/Cargo.toml b/bindings/matrix-sdk-crypto-ffi/Cargo.toml
index 445fcbbc5..3b200e82a 100644
--- a/bindings/matrix-sdk-crypto-ffi/Cargo.toml
+++ b/bindings/matrix-sdk-crypto-ffi/Cargo.toml
@@ -20,7 +20,7 @@ hmac = "0.12.1"
http = "0.2.6"
pbkdf2 = "0.11.0"
rand = "0.8.5"
-ruma = { git = "https://github.com/ruma/ruma", rev = "7ec599e83d8ba6b2ace9e4fe184fc7560b0ff6ae", features = ["client-api-c"] }
+ruma = { git = "https://github.com/ruma/ruma", rev = "ca8c66c885241a7ba3805399604eda4a38979f6b", features = ["client-api-c"] }
serde = "1.0.136"
serde_json = "1.0.79"
sha2 = "0.10.2"
diff --git a/bindings/matrix-sdk-crypto-js/Cargo.toml b/bindings/matrix-sdk-crypto-js/Cargo.toml
index 253619705..2b91685a9 100644
--- a/bindings/matrix-sdk-crypto-js/Cargo.toml
+++ b/bindings/matrix-sdk-crypto-js/Cargo.toml
@@ -30,7 +30,7 @@ tracing = []
[dependencies]
matrix-sdk-common = { version = "0.5.0", path = "../../crates/matrix-sdk-common" }
matrix-sdk-crypto = { version = "0.5.0", path = "../../crates/matrix-sdk-crypto" }
-ruma = { git = "https://github.com/ruma/ruma", rev = "7ec599e83d8ba6b2ace9e4fe184fc7560b0ff6ae", features = ["client-api-c", "js", "rand", "unstable-msc2676", "unstable-msc2677"] }
+ruma = { git = "https://github.com/ruma/ruma", rev = "ca8c66c885241a7ba3805399604eda4a38979f6b", features = ["client-api-c", "js", "rand", "unstable-msc2676", "unstable-msc2677"] }
vodozemac = { git = "https://github.com/matrix-org/vodozemac/", rev = "2404f83f7d3a3779c1f518e4d949f7da9677c3dd", features = ["js"] }
wasm-bindgen = "0.2.80"
wasm-bindgen-futures = "0.4.30"
diff --git a/bindings/matrix-sdk-crypto-nodejs/CHANGELOG.md b/bindings/matrix-sdk-crypto-nodejs/CHANGELOG.md
index fa95abc2a..2d83a8260 100644
--- a/bindings/matrix-sdk-crypto-nodejs/CHANGELOG.md
+++ b/bindings/matrix-sdk-crypto-nodejs/CHANGELOG.md
@@ -1,3 +1,32 @@
-# Matrix-Rust-SDK NodeJS Bindings
+# Matrix-Rust-SDK Node.js Bindings
--- Changelog Test --
\ No newline at end of file
+## 0.1.0-beta.1 - 2022-07-14
+
+- Fixing broken download link, [#842](https://github.com/matrix-org/matrix-rust-sdk/issues/842)
+
+## 0.1.0-beta.0 - 2022-07-12
+
+Welcome to the first release of `matrix-sdk-crypto-nodejs`. This is a
+Node.js binding for the Rust `matrix-sdk-crypto` library. This is a
+no-network-IO implementation of a state machine, named `OlmMachine`,
+that handles E2EE (End-to-End Encryption) for Matrix clients.
+
+The goal of this binding is _not_ to cover the entirety of the
+`matrix-sdk-crypto` API, but only what's required to build Matrix bots
+or Matrix bridges (i.e. to connect different networks together via the
+Matrix protocol).
+
+This project replaces and deprecates a previous project, with the same
+name and same goals, inside [the `matrix-rust-sdk-bindings`
+repository](https://github.com/matrix-org/matrix-rust-sdk-bindings),
+with the NPM package name `@turt2live/matrix-sdk-crypto-nodejs`. The
+The new official package name is
+`@matrix-org/matrix-sdk-crypto-nodejs`.
+
+Note: All bindings are now part of [the `matrix-rust-sdk`
+repository](https://github.com/matrix-org/matrix-rust-sdk) (see the
+`bindings/` root directory).
+
+[A documentation is available inside the new
+`matrix-sdk-crypto-nodejs`
+project](https://github.com/matrix-org/matrix-rust-sdk/tree/0bde5ccf38f8cda3865297a2d12ddcdaf4b80ca7/bindings/matrix-sdk-crypto-nodejs).
diff --git a/bindings/matrix-sdk-crypto-nodejs/Cargo.toml b/bindings/matrix-sdk-crypto-nodejs/Cargo.toml
index 3814efa31..82a51626a 100644
--- a/bindings/matrix-sdk-crypto-nodejs/Cargo.toml
+++ b/bindings/matrix-sdk-crypto-nodejs/Cargo.toml
@@ -28,7 +28,7 @@ tracing = ["dep:tracing-subscriber"]
matrix-sdk-crypto = { version = "0.5.0", path = "../../crates/matrix-sdk-crypto" }
matrix-sdk-common = { version = "0.5.0", path = "../../crates/matrix-sdk-common" }
matrix-sdk-sled = { version = "0.1.0", path = "../../crates/matrix-sdk-sled", default-features = false, features = ["crypto-store"] }
-ruma = { git = "https://github.com/ruma/ruma", rev = "7ec599e83d8ba6b2ace9e4fe184fc7560b0ff6ae", features = ["client-api-c", "rand", "unstable-msc2676", "unstable-msc2677"] }
+ruma = { git = "https://github.com/ruma/ruma", rev = "ca8c66c885241a7ba3805399604eda4a38979f6b", features = ["client-api-c", "rand", "unstable-msc2676", "unstable-msc2677"] }
vodozemac = { git = "https://github.com/matrix-org/vodozemac/", rev = "2404f83f7d3a3779c1f518e4d949f7da9677c3dd" }
napi = { git = "https://github.com/Hywan/napi-rs", branch = "fix-napi-strict-on-t-and-ref-t", default-features = false, features = ["napi6", "tokio_rt"] }
napi-derive = { git = "https://github.com/Hywan/napi-rs", branch = "fix-napi-strict-on-t-and-ref-t" }
diff --git a/bindings/matrix-sdk-crypto-nodejs/package.json b/bindings/matrix-sdk-crypto-nodejs/package.json
index 3f8e56c4d..9699a89c7 100644
--- a/bindings/matrix-sdk-crypto-nodejs/package.json
+++ b/bindings/matrix-sdk-crypto-nodejs/package.json
@@ -1,6 +1,6 @@
{
"name": "@matrix-org/matrix-sdk-crypto-nodejs",
- "version": "0.1.0",
+ "version": "0.1.0-beta.1",
"main": "index.js",
"types": "index.d.ts",
"napi": {
diff --git a/bindings/matrix-sdk-ffi/Cargo.toml b/bindings/matrix-sdk-ffi/Cargo.toml
index bc2f81bb1..a686272a9 100644
--- a/bindings/matrix-sdk-ffi/Cargo.toml
+++ b/bindings/matrix-sdk-ffi/Cargo.toml
@@ -31,6 +31,7 @@ thiserror = "1.0.30"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
tokio-stream = "0.1.8"
tracing = "0.1.32"
+tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# keep in sync with uniffi dependency in matrix-sdk-crypto-ffi, and uniffi_bindgen in ffi CI job
uniffi = "0.18.0"
uniffi_macros = "0.18.0"
diff --git a/bindings/matrix-sdk-ffi/src/api.udl b/bindings/matrix-sdk-ffi/src/api.udl
index 80a24aa20..76d2ada9f 100644
--- a/bindings/matrix-sdk-ffi/src/api.udl
+++ b/bindings/matrix-sdk-ffi/src/api.udl
@@ -1,4 +1,6 @@
namespace sdk {
+ void setup_tracing(string configuration);
+
MediaSource media_source_from_url(string url);
MessageEventContent message_event_content_from_markdown(string md);
string gen_transaction_id();
@@ -156,24 +158,23 @@ interface MediaSource {
[Error]
enum AuthenticationError {
- "ClientMissing",
- "Generic",
+ "ClientMissing",
+ "Generic",
+};
+
+interface HomeserverLoginDetails {
+ string url();
+ string? authentication_issuer();
+ boolean supports_password_login();
};
interface AuthenticationService {
constructor(string base_path);
- [Throws=AuthenticationError]
- string homeserver();
+ HomeserverLoginDetails? homeserver_details();
[Throws=AuthenticationError]
- string? authentication_issuer();
-
- [Throws=AuthenticationError]
- boolean supports_password_login();
-
- [Throws=AuthenticationError]
- void use_server(string server_name);
+ void configure_homeserver(string server_name);
[Throws=AuthenticationError]
Client login(string username, string password);
diff --git a/bindings/matrix-sdk-ffi/src/authentication_service.rs b/bindings/matrix-sdk-ffi/src/authentication_service.rs
index 7ed148d82..0c3df8f12 100644
--- a/bindings/matrix-sdk-ffi/src/authentication_service.rs
+++ b/bindings/matrix-sdk-ffi/src/authentication_service.rs
@@ -1,12 +1,14 @@
use std::sync::Arc;
+use futures_util::future::join3;
use parking_lot::RwLock;
-use super::{client::Client, client_builder::ClientBuilder};
+use super::{client::Client, client_builder::ClientBuilder, RUNTIME};
pub struct AuthenticationService {
base_path: String,
client: RwLock