Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions android/clear-signing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,10 @@ afterEvaluate {
from components.release
groupId = 'com.github.llbartekll'
artifactId = 'clear-signing'
version = project.findProperty('version') ?: '0.0.0'

pom.withXml {
def deps = asNode().appendNode('dependencies')
def jna = deps.appendNode('dependency')
jna.appendNode('groupId', 'net.java.dev.jna')
jna.appendNode('artifactId', 'jna')
jna.appendNode('version', '5.17.0')
jna.appendNode('classifier', 'android')
jna.appendNode('type', 'aar')
}
// Match the consumer-side property name. `findProperty('version')`
// returns Gradle's default project version ("unspecified"), not
// null, so the previous `?:` fallback never triggered.
version = project.findProperty('clearSigningVersion') ?: '0.0.0'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ val DescriptorResolutionOutcome.descriptors: List<String>
DescriptorResolutionOutcome.NotFound -> emptyList()
}

// `detail` is the wire-level field on each variant; `message` is the
// formatted `Throwable.message` string set by UniFFI. We expose `detail`
// so callers get the original error text without the variant prefix.
val FormatFailure.failureMessage: String
get() = when (this) {
is FormatFailure.InvalidInput -> message
is FormatFailure.InvalidDescriptor -> message
is FormatFailure.ResolutionFailed -> message
is FormatFailure.Internal -> message
is FormatFailure.InvalidInput -> detail
is FormatFailure.InvalidDescriptor -> detail
is FormatFailure.ResolutionFailed -> detail
is FormatFailure.Internal -> detail
}

val FormatFailure.retryable: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function DebugScreen() {
} catch (e: any) {
if (cancelled) return;
const inner = e?.inner;
const message = inner?.message ?? e?.message ?? String(e);
const message = inner?.detail ?? e?.message ?? String(e);
setResult({kind: 'error', message, retryable: inner?.retryable});
}
})();
Expand Down
84 changes: 47 additions & 37 deletions bindings/react-native/src/generated/clear_signing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ export const DisplayEntry = (() => {

type Nested__interface = {
tag: DisplayEntry_Tags.Nested;
inner: Readonly<{label: string; intent: string; owner?: string; entries: Array<DisplayEntry>}>
inner: Readonly<{label: string; intent: string; owner: string | undefined; entries: Array<DisplayEntry>}>
};


Expand All @@ -811,13 +811,23 @@ export const DisplayEntry = (() => {
*/
readonly [uniffiTypeNameSymbol] = "DisplayEntry";
readonly tag = DisplayEntry_Tags.Nested;
readonly inner: Readonly<{label: string; intent: string; owner?: string; entries: Array<DisplayEntry>}>;
constructor(inner: { label: string, intent: string, owner?: string, entries: Array<DisplayEntry> }) {
readonly inner: Readonly<{label: string; intent: string; owner: string | undefined; entries: Array<DisplayEntry>}>;
constructor(inner: { label: string, intent: string,
/**
* Owner string for the inner call (the inner descriptor's `metadata.owner`),
* when a matching descriptor was found. `None` for raw/fallback frames where
* no inner descriptor matched.
*/owner: string | undefined, entries: Array<DisplayEntry> }) {
super("DisplayEntry", "Nested");
this.inner = Object.freeze(inner);
}

static new(inner: { label: string, intent: string, owner?: string, entries: Array<DisplayEntry> }): Nested_ {
static new(inner: { label: string, intent: string,
/**
* Owner string for the inner call (the inner descriptor's `metadata.owner`),
* when a matching descriptor was found. `None` for raw/fallback frames where
* no inner descriptor matched.
*/owner: string | undefined, entries: Array<DisplayEntry> }): Nested_ {
return new Nested_(inner);
}

Expand Down Expand Up @@ -982,7 +992,7 @@ export const FormatFailure = (() => {

type InvalidInput__interface = {
tag: FormatFailure_Tags.InvalidInput;
inner: Readonly<{message: string; retryable: boolean}>
inner: Readonly<{detail: string; retryable: boolean}>
};


Expand All @@ -993,13 +1003,13 @@ export const FormatFailure = (() => {
*/
readonly [uniffiTypeNameSymbol] = "FormatFailure";
readonly tag = FormatFailure_Tags.InvalidInput;
readonly inner: Readonly<{message: string; retryable: boolean}>;
constructor(inner: { message: string, retryable: boolean }) {
readonly inner: Readonly<{detail: string; retryable: boolean}>;
constructor(inner: { detail: string, retryable: boolean }) {
super("FormatFailure", "InvalidInput");
this.inner = Object.freeze(inner);
}

static new(inner: { message: string, retryable: boolean }): InvalidInput_ {
static new(inner: { detail: string, retryable: boolean }): InvalidInput_ {
return new InvalidInput_(inner);
}

Expand All @@ -1013,7 +1023,7 @@ export const FormatFailure = (() => {
return InvalidInput_.instanceOf(obj);
}

static getInner(obj: InvalidInput_): Readonly<{message: string; retryable: boolean}> {
static getInner(obj: InvalidInput_): Readonly<{detail: string; retryable: boolean}> {
return obj.inner;
}

Expand All @@ -1022,7 +1032,7 @@ export const FormatFailure = (() => {

type InvalidDescriptor__interface = {
tag: FormatFailure_Tags.InvalidDescriptor;
inner: Readonly<{message: string; retryable: boolean}>
inner: Readonly<{detail: string; retryable: boolean}>
};


Expand All @@ -1033,13 +1043,13 @@ export const FormatFailure = (() => {
*/
readonly [uniffiTypeNameSymbol] = "FormatFailure";
readonly tag = FormatFailure_Tags.InvalidDescriptor;
readonly inner: Readonly<{message: string; retryable: boolean}>;
constructor(inner: { message: string, retryable: boolean }) {
readonly inner: Readonly<{detail: string; retryable: boolean}>;
constructor(inner: { detail: string, retryable: boolean }) {
super("FormatFailure", "InvalidDescriptor");
this.inner = Object.freeze(inner);
}

static new(inner: { message: string, retryable: boolean }): InvalidDescriptor_ {
static new(inner: { detail: string, retryable: boolean }): InvalidDescriptor_ {
return new InvalidDescriptor_(inner);
}

Expand All @@ -1053,7 +1063,7 @@ export const FormatFailure = (() => {
return InvalidDescriptor_.instanceOf(obj);
}

static getInner(obj: InvalidDescriptor_): Readonly<{message: string; retryable: boolean}> {
static getInner(obj: InvalidDescriptor_): Readonly<{detail: string; retryable: boolean}> {
return obj.inner;
}

Expand All @@ -1062,7 +1072,7 @@ export const FormatFailure = (() => {

type ResolutionFailed__interface = {
tag: FormatFailure_Tags.ResolutionFailed;
inner: Readonly<{message: string; retryable: boolean}>
inner: Readonly<{detail: string; retryable: boolean}>
};


Expand All @@ -1073,13 +1083,13 @@ export const FormatFailure = (() => {
*/
readonly [uniffiTypeNameSymbol] = "FormatFailure";
readonly tag = FormatFailure_Tags.ResolutionFailed;
readonly inner: Readonly<{message: string; retryable: boolean}>;
constructor(inner: { message: string, retryable: boolean }) {
readonly inner: Readonly<{detail: string; retryable: boolean}>;
constructor(inner: { detail: string, retryable: boolean }) {
super("FormatFailure", "ResolutionFailed");
this.inner = Object.freeze(inner);
}

static new(inner: { message: string, retryable: boolean }): ResolutionFailed_ {
static new(inner: { detail: string, retryable: boolean }): ResolutionFailed_ {
return new ResolutionFailed_(inner);
}

Expand All @@ -1093,7 +1103,7 @@ export const FormatFailure = (() => {
return ResolutionFailed_.instanceOf(obj);
}

static getInner(obj: ResolutionFailed_): Readonly<{message: string; retryable: boolean}> {
static getInner(obj: ResolutionFailed_): Readonly<{detail: string; retryable: boolean}> {
return obj.inner;
}

Expand All @@ -1102,7 +1112,7 @@ export const FormatFailure = (() => {

type Internal__interface = {
tag: FormatFailure_Tags.Internal;
inner: Readonly<{message: string; retryable: boolean}>
inner: Readonly<{detail: string; retryable: boolean}>
};


Expand All @@ -1113,13 +1123,13 @@ export const FormatFailure = (() => {
*/
readonly [uniffiTypeNameSymbol] = "FormatFailure";
readonly tag = FormatFailure_Tags.Internal;
readonly inner: Readonly<{message: string; retryable: boolean}>;
constructor(inner: { message: string, retryable: boolean }) {
readonly inner: Readonly<{detail: string; retryable: boolean}>;
constructor(inner: { detail: string, retryable: boolean }) {
super("FormatFailure", "Internal");
this.inner = Object.freeze(inner);
}

static new(inner: { message: string, retryable: boolean }): Internal_ {
static new(inner: { detail: string, retryable: boolean }): Internal_ {
return new Internal_(inner);
}

Expand All @@ -1133,7 +1143,7 @@ export const FormatFailure = (() => {
return Internal_.instanceOf(obj);
}

static getInner(obj: Internal_): Readonly<{message: string; retryable: boolean}> {
static getInner(obj: Internal_): Readonly<{detail: string; retryable: boolean}> {
return obj.inner;
}

Expand Down Expand Up @@ -1166,10 +1176,10 @@ const FfiConverterTypeFormatFailure = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
switch (ordinalConverter.read(from)) {
case 1: return new FormatFailure.InvalidInput({message: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
case 2: return new FormatFailure.InvalidDescriptor({message: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
case 3: return new FormatFailure.ResolutionFailed({message: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
case 4: return new FormatFailure.Internal({message: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
case 1: return new FormatFailure.InvalidInput({detail: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
case 2: return new FormatFailure.InvalidDescriptor({detail: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
case 3: return new FormatFailure.ResolutionFailed({detail: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
case 4: return new FormatFailure.Internal({detail: FfiConverterString.read(from), retryable: FfiConverterBool.read(from) });
default: throw new UniffiInternalError.UnexpectedEnumCase();
}
}
Expand All @@ -1178,28 +1188,28 @@ const FfiConverterTypeFormatFailure = (() => {
case FormatFailure_Tags.InvalidInput: {
ordinalConverter.write(1, into);
const inner = value.inner;
FfiConverterString.write(inner.message, into);
FfiConverterString.write(inner.detail, into);
FfiConverterBool.write(inner.retryable, into);
return;
}
case FormatFailure_Tags.InvalidDescriptor: {
ordinalConverter.write(2, into);
const inner = value.inner;
FfiConverterString.write(inner.message, into);
FfiConverterString.write(inner.detail, into);
FfiConverterBool.write(inner.retryable, into);
return;
}
case FormatFailure_Tags.ResolutionFailed: {
ordinalConverter.write(3, into);
const inner = value.inner;
FfiConverterString.write(inner.message, into);
FfiConverterString.write(inner.detail, into);
FfiConverterBool.write(inner.retryable, into);
return;
}
case FormatFailure_Tags.Internal: {
ordinalConverter.write(4, into);
const inner = value.inner;
FfiConverterString.write(inner.message, into);
FfiConverterString.write(inner.detail, into);
FfiConverterBool.write(inner.retryable, into);
return;
}
Expand All @@ -1213,28 +1223,28 @@ const FfiConverterTypeFormatFailure = (() => {
case FormatFailure_Tags.InvalidInput: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(1);
size += FfiConverterString.allocationSize(inner.message);
size += FfiConverterString.allocationSize(inner.detail);
size += FfiConverterBool.allocationSize(inner.retryable);
return size;
}
case FormatFailure_Tags.InvalidDescriptor: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(2);
size += FfiConverterString.allocationSize(inner.message);
size += FfiConverterString.allocationSize(inner.detail);
size += FfiConverterBool.allocationSize(inner.retryable);
return size;
}
case FormatFailure_Tags.ResolutionFailed: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(3);
size += FfiConverterString.allocationSize(inner.message);
size += FfiConverterString.allocationSize(inner.detail);
size += FfiConverterBool.allocationSize(inner.retryable);
return size;
}
case FormatFailure_Tags.Internal: {
const inner = value.inner;
let size = ordinalConverter.allocationSize(4);
size += FfiConverterString.allocationSize(inner.message);
size += FfiConverterString.allocationSize(inner.detail);
size += FfiConverterBool.allocationSize(inner.retryable);
return size;
}
Expand Down Expand Up @@ -1940,4 +1950,4 @@ export default Object.freeze({
FfiConverterTypeTokenMetaFfi,
FfiConverterTypeTransactionInput,
}
});
});
14 changes: 9 additions & 5 deletions bindings/swift/ClearSigningClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ public extension DescriptorResolutionOutcome {
}

public extension FormatFailure {
// Field is named `detail` in the UniFFI cases (renamed from `message`
// to avoid a `Throwable.message` collision in the generated Kotlin
// bindings). Kept as `.message` here for source compatibility with
// existing Swift callers.
var message: String {
switch self {
case .InvalidInput(let message, _),
.InvalidDescriptor(let message, _),
.ResolutionFailed(let message, _),
.Internal(let message, _):
return message
case .InvalidInput(let detail, _),
.InvalidDescriptor(let detail, _),
.ResolutionFailed(let detail, _),
.Internal(let detail, _):
return detail
}
}

Expand Down
Loading
Loading