Skip to content

Commit b98a832

Browse files
authored
feat(ffi): Add QrCodeData::to_bytes() to allow generation of a QR code (#5939)
Signed-off-by: Hugh Nimmo-Smith <hughns@element.io>
1 parent acf3a7a commit b98a832

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

bindings/matrix-sdk-ffi/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ All notable changes to this project will be documented in this file.
88

99
### Features
1010

11+
- Add `QrCodeData::to_bytes()` to allow generation of a QR code.
12+
([#5939](https://github.com/matrix-org/matrix-rust-sdk/pull/5939))
1113
- [**breaking**]: The new Latest Event API replaces the old API.
1214
`Room::new_latest_event` overwrites the `Room::latest_event` method. See the
1315
documentation of `matrix_sdk::latest_event` to learn about the new API.

bindings/matrix-sdk-ffi/src/qr_code.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ impl QrCodeData {
236236
Ok(Self { inner: qrcode::QrCodeData::from_bytes(&bytes)? }.into())
237237
}
238238

239+
/// Serialize the [`QrCodeData`] into a byte vector for encoding as a QR
240+
/// code.
241+
pub fn to_bytes(&self) -> Vec<u8> {
242+
self.inner.to_bytes()
243+
}
244+
239245
/// The server name contained within the scanned QR code data.
240246
///
241247
/// Note: This value is only present when scanning a QR code the belongs to

0 commit comments

Comments
 (0)