Skip to content

Commit

Permalink
Bump UniFFI to pre 0.29.1 (#291)
Browse files Browse the repository at this point in the history
Bump UniFFI to 0.28.3 (pre 0.29.X)
  • Loading branch information
CyonAlexRDX authored Dec 5, 2024
1 parent 55e0def commit 8d10a02
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 150 deletions.
135 changes: 68 additions & 67 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ extension SargonError: SargonModel {}
// MARK: - SargonError + CustomDebugStringConvertible
extension SargonError: CustomDebugStringConvertible {
public var debugDescription: String {
"\(errorCode): \(errorMessage)"
errorDescription()
}
}

// MARK: - SargonError + CustomStringConvertible
extension SargonError: CustomStringConvertible {
public var description: String {
errorMessage
errorDescription()
}
}

// MARK: - SargonError + LocalizedError
extension SargonError: LocalizedError {
public var errorDescription: String? {
extension SargonError {
public func errorDescription() -> String {
let errorCodeFormatted = "Error code: \(errorCode)"

var errorMessageFormatted: String?
Expand Down
4 changes: 2 additions & 2 deletions apple/Tests/TestCases/Prelude/SargonErrorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ final class SargonErrorTests: Test<SargonError> {

func test_description() {
let sut = SUT.UnknownNetworkForId(badValue: 99)
XCTAssertEqual(sut.description, sut.errorMessage)
XCTAssertEqual(sut.description, "Error code: 10049\nError message: No network found with id: '99'")
}

func test_debug_description() {
let sut = SUT.UnknownNetworkForId(badValue: 99)
XCTAssertEqual(sut.debugDescription, "10049: No network found with id: '99'")
XCTAssertEqual(sut.debugDescription, "Error code: 10049\nError message: No network found with id: '99'")
}

func test_localized_description_for_sensitive_error() {
Expand Down
14 changes: 7 additions & 7 deletions crates/sargon-uniffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sargon-uniffi"
# Don't forget to update version in crates/sargon/Cargo.toml
version = "1.1.72"
version = "1.1.73"
edition = "2021"
build = "build.rs"

Expand Down Expand Up @@ -80,8 +80,8 @@ itertools = { git = "https://github.com/rust-itertools/itertools/", rev = "98eca
# enum-as-inner = "0.6.0"
enum-as-inner = { git = "https://github.com/bluejekyll/enum-as-inner/", rev = "c15f6e5c4f98ec865e181ae1fff9fc13a1a2e4e2" }

# uniffi = "0.27.1"
uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "6f33088e8100a2ea9586c8c3ecf98ab51d5aba62", features = [
# uniffi = "0.28.3" + unreleased changes
uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "2c003b16d1e70e1914b5d8ceb517eef3676cd187", features = [
"cli",
] }

Expand Down Expand Up @@ -124,17 +124,17 @@ security-framework-sys = "=2.10.0"


[dev-dependencies]
# uniffi = "0.27.1"
uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "6f33088e8100a2ea9586c8c3ecf98ab51d5aba62", features = [
# uniffi = "0.28.3" + unreleased changes
uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "2c003b16d1e70e1914b5d8ceb517eef3676cd187", features = [
"bindgen-tests",
] }

# actix-rt = "3.3.0"
actix-rt = { git = "https://github.com/actix/actix-net", rev = "57fd6ea8098d1f2d281c305fc331216c4fe1992e" }

[build-dependencies]
# uniffi = "0.27.1"
uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "6f33088e8100a2ea9586c8c3ecf98ab51d5aba62", features = [
# uniffi = "0.28.3" + unreleased changes
uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "2c003b16d1e70e1914b5d8ceb517eef3676cd187", features = [
"build",
] }

Expand Down
17 changes: 4 additions & 13 deletions crates/sargon-uniffi/src/core/types/bag_of_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,10 @@ impl BagOfBytes {
}
}

impl crate::UniffiCustomTypeConverter for BagOfBytes {
type Builtin = Vec<i8>;

#[cfg(not(tarpaulin_include))] // false negative, tested in bindgen tests
fn into_custom(val: Self::Builtin) -> uniffi::Result<Self> {
Ok(BagOfBytes { bytes: val })
}

#[cfg(not(tarpaulin_include))] // false negative, tested in bindgen tests
fn from_custom(obj: Self) -> Self::Builtin {
obj.bytes
}
}
uniffi::custom_type!(BagOfBytes, Vec<i8>, {
try_lift: |val| Ok(BagOfBytes { bytes: val }),
lower: |obj| obj.bytes,
});

impl From<InternalBagOfBytes> for BagOfBytes {
fn from(value: InternalBagOfBytes) -> Self {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{prelude::*, UniffiCustomTypeConverter};
use crate::prelude::*;
use sargon::BagOfBytes as InternalBagOfBytes;
use sargon::Secp256k1PublicKey as InternalSecp256k1PublicKey;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{decl_secret_bytes, prelude::*, UniffiCustomTypeConverter};
use crate::{decl_secret_bytes, prelude::*};

macro_rules! entropy_with_byte_counts {
(
Expand Down
Loading

0 comments on commit 8d10a02

Please sign in to comment.