@breeztech/breez-sdk-spark-react-native 0.18.0-dev4 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,7 @@ import nativeModule, {
33
33
  type UniffiVTableCallbackInterfaceLogger,
34
34
  type UniffiVTableCallbackInterfaceBitcoinChainService,
35
35
  type UniffiVTableCallbackInterfaceExternalBreezSigner,
36
+ type UniffiVTableCallbackInterfaceExternalSigningSigner,
36
37
  type UniffiVTableCallbackInterfaceExternalSparkSigner,
37
38
  type UniffiVTableCallbackInterfaceFiatService,
38
39
  type UniffiVTableCallbackInterfacePaymentObserver,
@@ -195,15 +196,71 @@ export async function connectWithSigner(
195
196
  throw __error;
196
197
  }
197
198
  }
199
+ /**
200
+ * Connects to the Spark network using a signing-only external signer.
201
+ *
202
+ * Use this instead of [`connect_with_signer`] for a signer that can't perform
203
+ * the SDK's local ECIES/HMAC operations (for example a policy-restricted
204
+ * enclave). The SDK keeps session tokens in plaintext and disables the features
205
+ * that rely on ECIES/HMAC.
206
+ *
207
+ * # Arguments
208
+ *
209
+ * * `request` - The connection request object with a signing-only external signer
210
+ *
211
+ * # Returns
212
+ *
213
+ * Result containing either the initialized `BreezSdk` or an `SdkError`
214
+ */
215
+ export async function connectWithSigningOnlySigner(
216
+ request: ConnectWithSigningOnlySignerRequest,
217
+ asyncOpts_?: { signal: AbortSignal }
218
+ ): Promise<BreezSdkInterface> /*throws*/ {
219
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
220
+ try {
221
+ return await uniffiRustCallAsync(
222
+ /*rustCaller:*/ uniffiCaller,
223
+ /*rustFutureFunc:*/ () => {
224
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_connect_with_signing_only_signer(
225
+ FfiConverterTypeConnectWithSigningOnlySignerRequest.lower(request)
226
+ );
227
+ },
228
+ /*pollFunc:*/ nativeModule()
229
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer,
230
+ /*cancelFunc:*/ nativeModule()
231
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer,
232
+ /*completeFunc:*/ nativeModule()
233
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer,
234
+ /*freeFunc:*/ nativeModule()
235
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer,
236
+ /*liftFunc:*/ FfiConverterTypeBreezSdk.lift.bind(
237
+ FfiConverterTypeBreezSdk
238
+ ),
239
+ /*liftString:*/ FfiConverterString.lift,
240
+ /*asyncOpts:*/ asyncOpts_,
241
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
242
+ FfiConverterTypeSdkError
243
+ )
244
+ );
245
+ } catch (__error: any) {
246
+ if (uniffiIsDebug && __error instanceof Error) {
247
+ __error.stack = __stack;
248
+ }
249
+ throw __error;
250
+ }
251
+ }
198
252
  /**
199
253
  * Builds the Turnkey-backed Breez and Spark signers from `config`, sharing one
200
254
  * Turnkey client.
201
255
  *
202
256
  * The Spark signer keeps every signing operation in the Turnkey enclave; the
203
257
  * Breez signer does too, except ECIES and HMAC, which run locally against a
204
- * dedicated, non-Spark key exported once here. Exporting a non-Spark key keeps
205
- * every Spark key (the identity key included) in the enclave; ECIES/HMAC only
206
- * need a stable key, not a Spark one.
258
+ * dedicated, non-Spark key exported on first use (see `TurnkeyBreezSigner`).
259
+ * Exporting a non-Spark key keeps every Spark key (the identity key included)
260
+ * in the enclave; ECIES/HMAC only need a stable key, not a Spark one.
261
+ *
262
+ * For a wallet under a deny-export policy, use
263
+ * [`create_turnkey_signing_only_signer`] instead: it never exports a key.
207
264
  */
208
265
  export async function createTurnkeySigner(
209
266
  config: TurnkeyConfig,
@@ -242,6 +299,49 @@ export async function createTurnkeySigner(
242
299
  throw __error;
243
300
  }
244
301
  }
302
+ /**
303
+ * Builds signing-only Turnkey-backed signers from `config`, for a wallet under
304
+ * a deny-export policy. The Breez half performs signing only and never exports
305
+ * a key, so no ECIES/HMAC is attempted. Pair with
306
+ * [`connect_with_signing_only_signer`](crate::connect_with_signing_only_signer).
307
+ */
308
+ export async function createTurnkeySigningOnlySigner(
309
+ config: TurnkeyConfig,
310
+ asyncOpts_?: { signal: AbortSignal }
311
+ ): Promise<SigningOnlyExternalSigners> /*throws*/ {
312
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
313
+ try {
314
+ return await uniffiRustCallAsync(
315
+ /*rustCaller:*/ uniffiCaller,
316
+ /*rustFutureFunc:*/ () => {
317
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_create_turnkey_signing_only_signer(
318
+ FfiConverterTypeTurnkeyConfig.lower(config)
319
+ );
320
+ },
321
+ /*pollFunc:*/ nativeModule()
322
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
323
+ /*cancelFunc:*/ nativeModule()
324
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
325
+ /*completeFunc:*/ nativeModule()
326
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
327
+ /*freeFunc:*/ nativeModule()
328
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
329
+ /*liftFunc:*/ FfiConverterTypeSigningOnlyExternalSigners.lift.bind(
330
+ FfiConverterTypeSigningOnlyExternalSigners
331
+ ),
332
+ /*liftString:*/ FfiConverterString.lift,
333
+ /*asyncOpts:*/ asyncOpts_,
334
+ /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
335
+ FfiConverterTypeSignerError
336
+ )
337
+ );
338
+ } catch (__error: any) {
339
+ if (uniffiIsDebug && __error instanceof Error) {
340
+ __error.stack = __stack;
341
+ }
342
+ throw __error;
343
+ }
344
+ }
245
345
  /**
246
346
  * Wraps a caller-supplied [`Storage`] implementation as a [`StorageBackend`].
247
347
  * The tree, token-output and session stores use the in-memory defaults.
@@ -2928,6 +3028,91 @@ const FfiConverterTypeConnectWithSignerRequest = (() => {
2928
3028
  return new FFIConverter();
2929
3029
  })();
2930
3030
 
3031
+ /**
3032
+ * Request object for connecting to the Spark network using a signing-only
3033
+ * external signer.
3034
+ *
3035
+ * Use this instead of [`ConnectWithSignerRequest`] for a signer that can't
3036
+ * perform the SDK's local ECIES/HMAC operations (for example a
3037
+ * policy-restricted enclave). The SDK keeps session tokens in plaintext and
3038
+ * disables the features that rely on ECIES/HMAC.
3039
+ */
3040
+ export type ConnectWithSigningOnlySignerRequest = {
3041
+ config: Config;
3042
+ /**
3043
+ * Signing-only external signer for non-Spark SDK signing.
3044
+ */
3045
+ breezSigner: ExternalSigningSigner;
3046
+ /**
3047
+ * External high-level Spark signer for the Spark wallet flows.
3048
+ */
3049
+ sparkSigner: ExternalSparkSigner;
3050
+ storageDir: string;
3051
+ };
3052
+
3053
+ /**
3054
+ * Generated factory for {@link ConnectWithSigningOnlySignerRequest} record objects.
3055
+ */
3056
+ export const ConnectWithSigningOnlySignerRequest = (() => {
3057
+ const defaults = () => ({});
3058
+ const create = (() => {
3059
+ return uniffiCreateRecord<
3060
+ ConnectWithSigningOnlySignerRequest,
3061
+ ReturnType<typeof defaults>
3062
+ >(defaults);
3063
+ })();
3064
+ return Object.freeze({
3065
+ /**
3066
+ * Create a frozen instance of {@link ConnectWithSigningOnlySignerRequest}, with defaults specified
3067
+ * in Rust, in the {@link breez_sdk_spark} crate.
3068
+ */
3069
+ create,
3070
+
3071
+ /**
3072
+ * Create a frozen instance of {@link ConnectWithSigningOnlySignerRequest}, with defaults specified
3073
+ * in Rust, in the {@link breez_sdk_spark} crate.
3074
+ */
3075
+ new: create,
3076
+
3077
+ /**
3078
+ * Defaults specified in the {@link breez_sdk_spark} crate.
3079
+ */
3080
+ defaults: () =>
3081
+ Object.freeze(defaults()) as Partial<ConnectWithSigningOnlySignerRequest>,
3082
+ });
3083
+ })();
3084
+
3085
+ const FfiConverterTypeConnectWithSigningOnlySignerRequest = (() => {
3086
+ type TypeName = ConnectWithSigningOnlySignerRequest;
3087
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
3088
+ read(from: RustBuffer): TypeName {
3089
+ return {
3090
+ config: FfiConverterTypeConfig.read(from),
3091
+ breezSigner: FfiConverterTypeExternalSigningSigner.read(from),
3092
+ sparkSigner: FfiConverterTypeExternalSparkSigner.read(from),
3093
+ storageDir: FfiConverterString.read(from),
3094
+ };
3095
+ }
3096
+ write(value: TypeName, into: RustBuffer): void {
3097
+ FfiConverterTypeConfig.write(value.config, into);
3098
+ FfiConverterTypeExternalSigningSigner.write(value.breezSigner, into);
3099
+ FfiConverterTypeExternalSparkSigner.write(value.sparkSigner, into);
3100
+ FfiConverterString.write(value.storageDir, into);
3101
+ }
3102
+ allocationSize(value: TypeName): number {
3103
+ return (
3104
+ FfiConverterTypeConfig.allocationSize(value.config) +
3105
+ FfiConverterTypeExternalSigningSigner.allocationSize(
3106
+ value.breezSigner
3107
+ ) +
3108
+ FfiConverterTypeExternalSparkSigner.allocationSize(value.sparkSigner) +
3109
+ FfiConverterString.allocationSize(value.storageDir)
3110
+ );
3111
+ }
3112
+ }
3113
+ return new FFIConverter();
3114
+ })();
3115
+
2931
3116
  /**
2932
3117
  * A contact entry containing a name and payment identifier.
2933
3118
  */
@@ -12757,6 +12942,79 @@ const FfiConverterTypeSignMessageResponse = (() => {
12757
12942
  return new FFIConverter();
12758
12943
  })();
12759
12944
 
12945
+ /**
12946
+ * A signing-only external signer paired with the Spark signer, for wallets that
12947
+ * connect via [`connect_with_signing_only_signer`]. The Breez half performs
12948
+ * signing only, without the SDK's local ECIES/HMAC operations.
12949
+ */
12950
+ export type SigningOnlyExternalSigners = {
12951
+ /**
12952
+ * Signing-only external signer for non-Spark SDK signing.
12953
+ */
12954
+ breezSigner: ExternalSigningSigner;
12955
+ /**
12956
+ * External high-level Spark signer for the Spark wallet flows.
12957
+ */
12958
+ sparkSigner: ExternalSparkSigner;
12959
+ };
12960
+
12961
+ /**
12962
+ * Generated factory for {@link SigningOnlyExternalSigners} record objects.
12963
+ */
12964
+ export const SigningOnlyExternalSigners = (() => {
12965
+ const defaults = () => ({});
12966
+ const create = (() => {
12967
+ return uniffiCreateRecord<
12968
+ SigningOnlyExternalSigners,
12969
+ ReturnType<typeof defaults>
12970
+ >(defaults);
12971
+ })();
12972
+ return Object.freeze({
12973
+ /**
12974
+ * Create a frozen instance of {@link SigningOnlyExternalSigners}, with defaults specified
12975
+ * in Rust, in the {@link breez_sdk_spark} crate.
12976
+ */
12977
+ create,
12978
+
12979
+ /**
12980
+ * Create a frozen instance of {@link SigningOnlyExternalSigners}, with defaults specified
12981
+ * in Rust, in the {@link breez_sdk_spark} crate.
12982
+ */
12983
+ new: create,
12984
+
12985
+ /**
12986
+ * Defaults specified in the {@link breez_sdk_spark} crate.
12987
+ */
12988
+ defaults: () =>
12989
+ Object.freeze(defaults()) as Partial<SigningOnlyExternalSigners>,
12990
+ });
12991
+ })();
12992
+
12993
+ const FfiConverterTypeSigningOnlyExternalSigners = (() => {
12994
+ type TypeName = SigningOnlyExternalSigners;
12995
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
12996
+ read(from: RustBuffer): TypeName {
12997
+ return {
12998
+ breezSigner: FfiConverterTypeExternalSigningSigner.read(from),
12999
+ sparkSigner: FfiConverterTypeExternalSparkSigner.read(from),
13000
+ };
13001
+ }
13002
+ write(value: TypeName, into: RustBuffer): void {
13003
+ FfiConverterTypeExternalSigningSigner.write(value.breezSigner, into);
13004
+ FfiConverterTypeExternalSparkSigner.write(value.sparkSigner, into);
13005
+ }
13006
+ allocationSize(value: TypeName): number {
13007
+ return (
13008
+ FfiConverterTypeExternalSigningSigner.allocationSize(
13009
+ value.breezSigner
13010
+ ) +
13011
+ FfiConverterTypeExternalSparkSigner.allocationSize(value.sparkSigner)
13012
+ );
13013
+ }
13014
+ }
13015
+ return new FFIConverter();
13016
+ })();
13017
+
12760
13018
  export type SilentPaymentAddressDetails = {
12761
13019
  address: string;
12762
13020
  network: BitcoinNetwork;
@@ -27458,6 +27716,7 @@ export enum SignerError_Tags {
27458
27716
  Signing = 'Signing',
27459
27717
  Encryption = 'Encryption',
27460
27718
  Decryption = 'Decryption',
27719
+ EncryptionUnavailable = 'EncryptionUnavailable',
27461
27720
  Frost = 'Frost',
27462
27721
  InvalidInput = 'InvalidInput',
27463
27722
  Generic = 'Generic',
@@ -27606,6 +27865,44 @@ export const SignerError = (() => {
27606
27865
  }
27607
27866
  }
27608
27867
 
27868
+ type EncryptionUnavailable__interface = {
27869
+ tag: SignerError_Tags.EncryptionUnavailable;
27870
+ inner: Readonly<[string]>;
27871
+ };
27872
+
27873
+ class EncryptionUnavailable_
27874
+ extends UniffiError
27875
+ implements EncryptionUnavailable__interface
27876
+ {
27877
+ /**
27878
+ * @private
27879
+ * This field is private and should not be used, use `tag` instead.
27880
+ */
27881
+ readonly [uniffiTypeNameSymbol] = 'SignerError';
27882
+ readonly tag = SignerError_Tags.EncryptionUnavailable;
27883
+ readonly inner: Readonly<[string]>;
27884
+ constructor(v0: string) {
27885
+ super('SignerError', 'EncryptionUnavailable');
27886
+ this.inner = Object.freeze([v0]);
27887
+ }
27888
+
27889
+ static new(v0: string): EncryptionUnavailable_ {
27890
+ return new EncryptionUnavailable_(v0);
27891
+ }
27892
+
27893
+ static instanceOf(obj: any): obj is EncryptionUnavailable_ {
27894
+ return obj.tag === SignerError_Tags.EncryptionUnavailable;
27895
+ }
27896
+
27897
+ static hasInner(obj: any): obj is EncryptionUnavailable_ {
27898
+ return EncryptionUnavailable_.instanceOf(obj);
27899
+ }
27900
+
27901
+ static getInner(obj: EncryptionUnavailable_): Readonly<[string]> {
27902
+ return obj.inner;
27903
+ }
27904
+ }
27905
+
27609
27906
  type Frost__interface = {
27610
27907
  tag: SignerError_Tags.Frost;
27611
27908
  inner: Readonly<[string]>;
@@ -27721,6 +28018,7 @@ export const SignerError = (() => {
27721
28018
  Signing: Signing_,
27722
28019
  Encryption: Encryption_,
27723
28020
  Decryption: Decryption_,
28021
+ EncryptionUnavailable: EncryptionUnavailable_,
27724
28022
  Frost: Frost_,
27725
28023
  InvalidInput: InvalidInput_,
27726
28024
  Generic: Generic_,
@@ -27751,10 +28049,14 @@ const FfiConverterTypeSignerError = (() => {
27751
28049
  case 4:
27752
28050
  return new SignerError.Decryption(FfiConverterString.read(from));
27753
28051
  case 5:
27754
- return new SignerError.Frost(FfiConverterString.read(from));
28052
+ return new SignerError.EncryptionUnavailable(
28053
+ FfiConverterString.read(from)
28054
+ );
27755
28055
  case 6:
27756
- return new SignerError.InvalidInput(FfiConverterString.read(from));
28056
+ return new SignerError.Frost(FfiConverterString.read(from));
27757
28057
  case 7:
28058
+ return new SignerError.InvalidInput(FfiConverterString.read(from));
28059
+ case 8:
27758
28060
  return new SignerError.Generic(FfiConverterString.read(from));
27759
28061
  default:
27760
28062
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -27786,24 +28088,30 @@ const FfiConverterTypeSignerError = (() => {
27786
28088
  FfiConverterString.write(inner[0], into);
27787
28089
  return;
27788
28090
  }
27789
- case SignerError_Tags.Frost: {
28091
+ case SignerError_Tags.EncryptionUnavailable: {
27790
28092
  ordinalConverter.write(5, into);
27791
28093
  const inner = value.inner;
27792
28094
  FfiConverterString.write(inner[0], into);
27793
28095
  return;
27794
28096
  }
27795
- case SignerError_Tags.InvalidInput: {
28097
+ case SignerError_Tags.Frost: {
27796
28098
  ordinalConverter.write(6, into);
27797
28099
  const inner = value.inner;
27798
28100
  FfiConverterString.write(inner[0], into);
27799
28101
  return;
27800
28102
  }
27801
- case SignerError_Tags.Generic: {
28103
+ case SignerError_Tags.InvalidInput: {
27802
28104
  ordinalConverter.write(7, into);
27803
28105
  const inner = value.inner;
27804
28106
  FfiConverterString.write(inner[0], into);
27805
28107
  return;
27806
28108
  }
28109
+ case SignerError_Tags.Generic: {
28110
+ ordinalConverter.write(8, into);
28111
+ const inner = value.inner;
28112
+ FfiConverterString.write(inner[0], into);
28113
+ return;
28114
+ }
27807
28115
  default:
27808
28116
  // Throwing from here means that SignerError_Tags hasn't matched an ordinal.
27809
28117
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -27835,24 +28143,30 @@ const FfiConverterTypeSignerError = (() => {
27835
28143
  size += FfiConverterString.allocationSize(inner[0]);
27836
28144
  return size;
27837
28145
  }
27838
- case SignerError_Tags.Frost: {
28146
+ case SignerError_Tags.EncryptionUnavailable: {
27839
28147
  const inner = value.inner;
27840
28148
  let size = ordinalConverter.allocationSize(5);
27841
28149
  size += FfiConverterString.allocationSize(inner[0]);
27842
28150
  return size;
27843
28151
  }
27844
- case SignerError_Tags.InvalidInput: {
28152
+ case SignerError_Tags.Frost: {
27845
28153
  const inner = value.inner;
27846
28154
  let size = ordinalConverter.allocationSize(6);
27847
28155
  size += FfiConverterString.allocationSize(inner[0]);
27848
28156
  return size;
27849
28157
  }
27850
- case SignerError_Tags.Generic: {
28158
+ case SignerError_Tags.InvalidInput: {
27851
28159
  const inner = value.inner;
27852
28160
  let size = ordinalConverter.allocationSize(7);
27853
28161
  size += FfiConverterString.allocationSize(inner[0]);
27854
28162
  return size;
27855
28163
  }
28164
+ case SignerError_Tags.Generic: {
28165
+ const inner = value.inner;
28166
+ let size = ordinalConverter.allocationSize(8);
28167
+ size += FfiConverterString.allocationSize(inner[0]);
28168
+ return size;
28169
+ }
27856
28170
  default:
27857
28171
  throw new UniffiInternalError.UnexpectedEnumCase();
27858
28172
  }
@@ -33207,8 +33521,836 @@ export class ExternalBreezSignerImpl
33207
33521
  return await uniffiRustCallAsync(
33208
33522
  /*rustCaller:*/ uniffiCaller,
33209
33523
  /*rustFutureFunc:*/ () => {
33210
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_sign_hash_schnorr(
33211
- uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this),
33524
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_sign_hash_schnorr(
33525
+ uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this),
33526
+ FfiConverterArrayBuffer.lower(hash),
33527
+ FfiConverterString.lower(path)
33528
+ );
33529
+ },
33530
+ /*pollFunc:*/ nativeModule()
33531
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
33532
+ /*cancelFunc:*/ nativeModule()
33533
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
33534
+ /*completeFunc:*/ nativeModule()
33535
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
33536
+ /*freeFunc:*/ nativeModule()
33537
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
33538
+ /*liftFunc:*/ FfiConverterTypeSchnorrSignatureBytes.lift.bind(
33539
+ FfiConverterTypeSchnorrSignatureBytes
33540
+ ),
33541
+ /*liftString:*/ FfiConverterString.lift,
33542
+ /*asyncOpts:*/ asyncOpts_,
33543
+ /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
33544
+ FfiConverterTypeSignerError
33545
+ )
33546
+ );
33547
+ } catch (__error: any) {
33548
+ if (uniffiIsDebug && __error instanceof Error) {
33549
+ __error.stack = __stack;
33550
+ }
33551
+ throw __error;
33552
+ }
33553
+ }
33554
+
33555
+ /**
33556
+ * HMAC-SHA256 of a message at the given derivation path.
33557
+ *
33558
+ * # Arguments
33559
+ * * `message` - The message to hash
33560
+ * * `path` - BIP32 derivation path as a string
33561
+ *
33562
+ * # Returns
33563
+ * 32-byte HMAC-SHA256, or a `SignerError`
33564
+ *
33565
+ * See also: [JavaScript `htlcHMAC`](https://docs.spark.money/wallets/spark-signer#generate-htlc-hmac)
33566
+ */
33567
+ public async hmacSha256(
33568
+ message: ArrayBuffer,
33569
+ path: string,
33570
+ asyncOpts_?: { signal: AbortSignal }
33571
+ ): Promise<HashedMessageBytes> /*throws*/ {
33572
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
33573
+ try {
33574
+ return await uniffiRustCallAsync(
33575
+ /*rustCaller:*/ uniffiCaller,
33576
+ /*rustFutureFunc:*/ () => {
33577
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_hmac_sha256(
33578
+ uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this),
33579
+ FfiConverterArrayBuffer.lower(message),
33580
+ FfiConverterString.lower(path)
33581
+ );
33582
+ },
33583
+ /*pollFunc:*/ nativeModule()
33584
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
33585
+ /*cancelFunc:*/ nativeModule()
33586
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
33587
+ /*completeFunc:*/ nativeModule()
33588
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
33589
+ /*freeFunc:*/ nativeModule()
33590
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
33591
+ /*liftFunc:*/ FfiConverterTypeHashedMessageBytes.lift.bind(
33592
+ FfiConverterTypeHashedMessageBytes
33593
+ ),
33594
+ /*liftString:*/ FfiConverterString.lift,
33595
+ /*asyncOpts:*/ asyncOpts_,
33596
+ /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
33597
+ FfiConverterTypeSignerError
33598
+ )
33599
+ );
33600
+ } catch (__error: any) {
33601
+ if (uniffiIsDebug && __error instanceof Error) {
33602
+ __error.stack = __stack;
33603
+ }
33604
+ throw __error;
33605
+ }
33606
+ }
33607
+
33608
+ /**
33609
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
33610
+ */
33611
+ uniffiDestroy(): void {
33612
+ const ptr = (this as any)[destructorGuardSymbol];
33613
+ if (ptr !== undefined) {
33614
+ const pointer =
33615
+ uniffiTypeExternalBreezSignerImplObjectFactory.pointer(this);
33616
+ uniffiTypeExternalBreezSignerImplObjectFactory.freePointer(pointer);
33617
+ uniffiTypeExternalBreezSignerImplObjectFactory.unbless(ptr);
33618
+ delete (this as any)[destructorGuardSymbol];
33619
+ }
33620
+ }
33621
+
33622
+ static instanceOf(obj: any): obj is ExternalBreezSignerImpl {
33623
+ return uniffiTypeExternalBreezSignerImplObjectFactory.isConcreteType(obj);
33624
+ }
33625
+ }
33626
+
33627
+ const uniffiTypeExternalBreezSignerImplObjectFactory: UniffiObjectFactory<ExternalBreezSigner> =
33628
+ (() => {
33629
+ return {
33630
+ create(pointer: UnsafeMutableRawPointer): ExternalBreezSigner {
33631
+ const instance = Object.create(ExternalBreezSignerImpl.prototype);
33632
+ instance[pointerLiteralSymbol] = pointer;
33633
+ instance[destructorGuardSymbol] = this.bless(pointer);
33634
+ instance[uniffiTypeNameSymbol] = 'ExternalBreezSignerImpl';
33635
+ return instance;
33636
+ },
33637
+
33638
+ bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
33639
+ return uniffiCaller.rustCall(
33640
+ /*caller:*/ (status) =>
33641
+ nativeModule().ubrn_uniffi_internal_fn_method_externalbreezsigner_ffi__bless_pointer(
33642
+ p,
33643
+ status
33644
+ ),
33645
+ /*liftString:*/ FfiConverterString.lift
33646
+ );
33647
+ },
33648
+
33649
+ unbless(ptr: UniffiRustArcPtr) {
33650
+ ptr.markDestroyed();
33651
+ },
33652
+
33653
+ pointer(obj: ExternalBreezSigner): UnsafeMutableRawPointer {
33654
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
33655
+ throw new UniffiInternalError.UnexpectedNullPointer();
33656
+ }
33657
+ return (obj as any)[pointerLiteralSymbol];
33658
+ },
33659
+
33660
+ clonePointer(obj: ExternalBreezSigner): UnsafeMutableRawPointer {
33661
+ const pointer = this.pointer(obj);
33662
+ return uniffiCaller.rustCall(
33663
+ /*caller:*/ (callStatus) =>
33664
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_externalbreezsigner(
33665
+ pointer,
33666
+ callStatus
33667
+ ),
33668
+ /*liftString:*/ FfiConverterString.lift
33669
+ );
33670
+ },
33671
+
33672
+ freePointer(pointer: UnsafeMutableRawPointer): void {
33673
+ uniffiCaller.rustCall(
33674
+ /*caller:*/ (callStatus) =>
33675
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_externalbreezsigner(
33676
+ pointer,
33677
+ callStatus
33678
+ ),
33679
+ /*liftString:*/ FfiConverterString.lift
33680
+ );
33681
+ },
33682
+
33683
+ isConcreteType(obj: any): obj is ExternalBreezSigner {
33684
+ return (
33685
+ obj[destructorGuardSymbol] &&
33686
+ obj[uniffiTypeNameSymbol] === 'ExternalBreezSignerImpl'
33687
+ );
33688
+ },
33689
+ };
33690
+ })();
33691
+ // FfiConverter for ExternalBreezSigner
33692
+ const FfiConverterTypeExternalBreezSigner = new FfiConverterObjectWithCallbacks(
33693
+ uniffiTypeExternalBreezSignerImplObjectFactory
33694
+ );
33695
+
33696
+ // Add a vtavble for the callbacks that go in ExternalBreezSigner.
33697
+
33698
+ // Put the implementation in a struct so we don't pollute the top-level namespace
33699
+ const uniffiCallbackInterfaceExternalBreezSigner: {
33700
+ vtable: UniffiVTableCallbackInterfaceExternalBreezSigner;
33701
+ register: () => void;
33702
+ } = {
33703
+ // Create the VTable using a series of closures.
33704
+ // ts automatically converts these into C callback functions.
33705
+ vtable: {
33706
+ derivePublicKey: (
33707
+ uniffiHandle: bigint,
33708
+ path: Uint8Array,
33709
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33710
+ uniffiCallbackData: bigint
33711
+ ) => {
33712
+ const uniffiMakeCall = async (
33713
+ signal: AbortSignal
33714
+ ): Promise<PublicKeyBytes> => {
33715
+ const jsCallback =
33716
+ FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33717
+ return await jsCallback.derivePublicKey(FfiConverterString.lift(path), {
33718
+ signal,
33719
+ });
33720
+ };
33721
+ const uniffiHandleSuccess = (returnValue: PublicKeyBytes) => {
33722
+ uniffiFutureCallback.call(
33723
+ uniffiFutureCallback,
33724
+ uniffiCallbackData,
33725
+ /* UniffiForeignFutureStructRustBuffer */ {
33726
+ returnValue: FfiConverterTypePublicKeyBytes.lower(returnValue),
33727
+ callStatus: uniffiCaller.createCallStatus(),
33728
+ }
33729
+ );
33730
+ };
33731
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33732
+ uniffiFutureCallback.call(
33733
+ uniffiFutureCallback,
33734
+ uniffiCallbackData,
33735
+ /* UniffiForeignFutureStructRustBuffer */ {
33736
+ returnValue: /*empty*/ new Uint8Array(0),
33737
+ // TODO create callstatus with error.
33738
+ callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33739
+ }
33740
+ );
33741
+ };
33742
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33743
+ /*makeCall:*/ uniffiMakeCall,
33744
+ /*handleSuccess:*/ uniffiHandleSuccess,
33745
+ /*handleError:*/ uniffiHandleError,
33746
+ /*isErrorType:*/ SignerError.instanceOf,
33747
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33748
+ FfiConverterTypeSignerError
33749
+ ),
33750
+ /*lowerString:*/ FfiConverterString.lower
33751
+ );
33752
+ return uniffiForeignFuture;
33753
+ },
33754
+ signEcdsa: (
33755
+ uniffiHandle: bigint,
33756
+ message: Uint8Array,
33757
+ path: Uint8Array,
33758
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33759
+ uniffiCallbackData: bigint
33760
+ ) => {
33761
+ const uniffiMakeCall = async (
33762
+ signal: AbortSignal
33763
+ ): Promise<EcdsaSignatureBytes> => {
33764
+ const jsCallback =
33765
+ FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33766
+ return await jsCallback.signEcdsa(
33767
+ FfiConverterTypeMessageBytes.lift(message),
33768
+ FfiConverterString.lift(path),
33769
+ { signal }
33770
+ );
33771
+ };
33772
+ const uniffiHandleSuccess = (returnValue: EcdsaSignatureBytes) => {
33773
+ uniffiFutureCallback.call(
33774
+ uniffiFutureCallback,
33775
+ uniffiCallbackData,
33776
+ /* UniffiForeignFutureStructRustBuffer */ {
33777
+ returnValue: FfiConverterTypeEcdsaSignatureBytes.lower(returnValue),
33778
+ callStatus: uniffiCaller.createCallStatus(),
33779
+ }
33780
+ );
33781
+ };
33782
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33783
+ uniffiFutureCallback.call(
33784
+ uniffiFutureCallback,
33785
+ uniffiCallbackData,
33786
+ /* UniffiForeignFutureStructRustBuffer */ {
33787
+ returnValue: /*empty*/ new Uint8Array(0),
33788
+ // TODO create callstatus with error.
33789
+ callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33790
+ }
33791
+ );
33792
+ };
33793
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33794
+ /*makeCall:*/ uniffiMakeCall,
33795
+ /*handleSuccess:*/ uniffiHandleSuccess,
33796
+ /*handleError:*/ uniffiHandleError,
33797
+ /*isErrorType:*/ SignerError.instanceOf,
33798
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33799
+ FfiConverterTypeSignerError
33800
+ ),
33801
+ /*lowerString:*/ FfiConverterString.lower
33802
+ );
33803
+ return uniffiForeignFuture;
33804
+ },
33805
+ signEcdsaRecoverable: (
33806
+ uniffiHandle: bigint,
33807
+ message: Uint8Array,
33808
+ path: Uint8Array,
33809
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33810
+ uniffiCallbackData: bigint
33811
+ ) => {
33812
+ const uniffiMakeCall = async (
33813
+ signal: AbortSignal
33814
+ ): Promise<RecoverableEcdsaSignatureBytes> => {
33815
+ const jsCallback =
33816
+ FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33817
+ return await jsCallback.signEcdsaRecoverable(
33818
+ FfiConverterTypeMessageBytes.lift(message),
33819
+ FfiConverterString.lift(path),
33820
+ { signal }
33821
+ );
33822
+ };
33823
+ const uniffiHandleSuccess = (
33824
+ returnValue: RecoverableEcdsaSignatureBytes
33825
+ ) => {
33826
+ uniffiFutureCallback.call(
33827
+ uniffiFutureCallback,
33828
+ uniffiCallbackData,
33829
+ /* UniffiForeignFutureStructRustBuffer */ {
33830
+ returnValue:
33831
+ FfiConverterTypeRecoverableEcdsaSignatureBytes.lower(returnValue),
33832
+ callStatus: uniffiCaller.createCallStatus(),
33833
+ }
33834
+ );
33835
+ };
33836
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33837
+ uniffiFutureCallback.call(
33838
+ uniffiFutureCallback,
33839
+ uniffiCallbackData,
33840
+ /* UniffiForeignFutureStructRustBuffer */ {
33841
+ returnValue: /*empty*/ new Uint8Array(0),
33842
+ // TODO create callstatus with error.
33843
+ callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33844
+ }
33845
+ );
33846
+ };
33847
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33848
+ /*makeCall:*/ uniffiMakeCall,
33849
+ /*handleSuccess:*/ uniffiHandleSuccess,
33850
+ /*handleError:*/ uniffiHandleError,
33851
+ /*isErrorType:*/ SignerError.instanceOf,
33852
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33853
+ FfiConverterTypeSignerError
33854
+ ),
33855
+ /*lowerString:*/ FfiConverterString.lower
33856
+ );
33857
+ return uniffiForeignFuture;
33858
+ },
33859
+ encryptEcies: (
33860
+ uniffiHandle: bigint,
33861
+ message: Uint8Array,
33862
+ path: Uint8Array,
33863
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33864
+ uniffiCallbackData: bigint
33865
+ ) => {
33866
+ const uniffiMakeCall = async (
33867
+ signal: AbortSignal
33868
+ ): Promise<ArrayBuffer> => {
33869
+ const jsCallback =
33870
+ FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33871
+ return await jsCallback.encryptEcies(
33872
+ FfiConverterArrayBuffer.lift(message),
33873
+ FfiConverterString.lift(path),
33874
+ { signal }
33875
+ );
33876
+ };
33877
+ const uniffiHandleSuccess = (returnValue: ArrayBuffer) => {
33878
+ uniffiFutureCallback.call(
33879
+ uniffiFutureCallback,
33880
+ uniffiCallbackData,
33881
+ /* UniffiForeignFutureStructRustBuffer */ {
33882
+ returnValue: FfiConverterArrayBuffer.lower(returnValue),
33883
+ callStatus: uniffiCaller.createCallStatus(),
33884
+ }
33885
+ );
33886
+ };
33887
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33888
+ uniffiFutureCallback.call(
33889
+ uniffiFutureCallback,
33890
+ uniffiCallbackData,
33891
+ /* UniffiForeignFutureStructRustBuffer */ {
33892
+ returnValue: /*empty*/ new Uint8Array(0),
33893
+ // TODO create callstatus with error.
33894
+ callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33895
+ }
33896
+ );
33897
+ };
33898
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33899
+ /*makeCall:*/ uniffiMakeCall,
33900
+ /*handleSuccess:*/ uniffiHandleSuccess,
33901
+ /*handleError:*/ uniffiHandleError,
33902
+ /*isErrorType:*/ SignerError.instanceOf,
33903
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33904
+ FfiConverterTypeSignerError
33905
+ ),
33906
+ /*lowerString:*/ FfiConverterString.lower
33907
+ );
33908
+ return uniffiForeignFuture;
33909
+ },
33910
+ decryptEcies: (
33911
+ uniffiHandle: bigint,
33912
+ message: Uint8Array,
33913
+ path: Uint8Array,
33914
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33915
+ uniffiCallbackData: bigint
33916
+ ) => {
33917
+ const uniffiMakeCall = async (
33918
+ signal: AbortSignal
33919
+ ): Promise<ArrayBuffer> => {
33920
+ const jsCallback =
33921
+ FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33922
+ return await jsCallback.decryptEcies(
33923
+ FfiConverterArrayBuffer.lift(message),
33924
+ FfiConverterString.lift(path),
33925
+ { signal }
33926
+ );
33927
+ };
33928
+ const uniffiHandleSuccess = (returnValue: ArrayBuffer) => {
33929
+ uniffiFutureCallback.call(
33930
+ uniffiFutureCallback,
33931
+ uniffiCallbackData,
33932
+ /* UniffiForeignFutureStructRustBuffer */ {
33933
+ returnValue: FfiConverterArrayBuffer.lower(returnValue),
33934
+ callStatus: uniffiCaller.createCallStatus(),
33935
+ }
33936
+ );
33937
+ };
33938
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33939
+ uniffiFutureCallback.call(
33940
+ uniffiFutureCallback,
33941
+ uniffiCallbackData,
33942
+ /* UniffiForeignFutureStructRustBuffer */ {
33943
+ returnValue: /*empty*/ new Uint8Array(0),
33944
+ // TODO create callstatus with error.
33945
+ callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33946
+ }
33947
+ );
33948
+ };
33949
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33950
+ /*makeCall:*/ uniffiMakeCall,
33951
+ /*handleSuccess:*/ uniffiHandleSuccess,
33952
+ /*handleError:*/ uniffiHandleError,
33953
+ /*isErrorType:*/ SignerError.instanceOf,
33954
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33955
+ FfiConverterTypeSignerError
33956
+ ),
33957
+ /*lowerString:*/ FfiConverterString.lower
33958
+ );
33959
+ return uniffiForeignFuture;
33960
+ },
33961
+ signHashSchnorr: (
33962
+ uniffiHandle: bigint,
33963
+ hash: Uint8Array,
33964
+ path: Uint8Array,
33965
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33966
+ uniffiCallbackData: bigint
33967
+ ) => {
33968
+ const uniffiMakeCall = async (
33969
+ signal: AbortSignal
33970
+ ): Promise<SchnorrSignatureBytes> => {
33971
+ const jsCallback =
33972
+ FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33973
+ return await jsCallback.signHashSchnorr(
33974
+ FfiConverterArrayBuffer.lift(hash),
33975
+ FfiConverterString.lift(path),
33976
+ { signal }
33977
+ );
33978
+ };
33979
+ const uniffiHandleSuccess = (returnValue: SchnorrSignatureBytes) => {
33980
+ uniffiFutureCallback.call(
33981
+ uniffiFutureCallback,
33982
+ uniffiCallbackData,
33983
+ /* UniffiForeignFutureStructRustBuffer */ {
33984
+ returnValue:
33985
+ FfiConverterTypeSchnorrSignatureBytes.lower(returnValue),
33986
+ callStatus: uniffiCaller.createCallStatus(),
33987
+ }
33988
+ );
33989
+ };
33990
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33991
+ uniffiFutureCallback.call(
33992
+ uniffiFutureCallback,
33993
+ uniffiCallbackData,
33994
+ /* UniffiForeignFutureStructRustBuffer */ {
33995
+ returnValue: /*empty*/ new Uint8Array(0),
33996
+ // TODO create callstatus with error.
33997
+ callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33998
+ }
33999
+ );
34000
+ };
34001
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
34002
+ /*makeCall:*/ uniffiMakeCall,
34003
+ /*handleSuccess:*/ uniffiHandleSuccess,
34004
+ /*handleError:*/ uniffiHandleError,
34005
+ /*isErrorType:*/ SignerError.instanceOf,
34006
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
34007
+ FfiConverterTypeSignerError
34008
+ ),
34009
+ /*lowerString:*/ FfiConverterString.lower
34010
+ );
34011
+ return uniffiForeignFuture;
34012
+ },
34013
+ hmacSha256: (
34014
+ uniffiHandle: bigint,
34015
+ message: Uint8Array,
34016
+ path: Uint8Array,
34017
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
34018
+ uniffiCallbackData: bigint
34019
+ ) => {
34020
+ const uniffiMakeCall = async (
34021
+ signal: AbortSignal
34022
+ ): Promise<HashedMessageBytes> => {
34023
+ const jsCallback =
34024
+ FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
34025
+ return await jsCallback.hmacSha256(
34026
+ FfiConverterArrayBuffer.lift(message),
34027
+ FfiConverterString.lift(path),
34028
+ { signal }
34029
+ );
34030
+ };
34031
+ const uniffiHandleSuccess = (returnValue: HashedMessageBytes) => {
34032
+ uniffiFutureCallback.call(
34033
+ uniffiFutureCallback,
34034
+ uniffiCallbackData,
34035
+ /* UniffiForeignFutureStructRustBuffer */ {
34036
+ returnValue: FfiConverterTypeHashedMessageBytes.lower(returnValue),
34037
+ callStatus: uniffiCaller.createCallStatus(),
34038
+ }
34039
+ );
34040
+ };
34041
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
34042
+ uniffiFutureCallback.call(
34043
+ uniffiFutureCallback,
34044
+ uniffiCallbackData,
34045
+ /* UniffiForeignFutureStructRustBuffer */ {
34046
+ returnValue: /*empty*/ new Uint8Array(0),
34047
+ // TODO create callstatus with error.
34048
+ callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
34049
+ }
34050
+ );
34051
+ };
34052
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
34053
+ /*makeCall:*/ uniffiMakeCall,
34054
+ /*handleSuccess:*/ uniffiHandleSuccess,
34055
+ /*handleError:*/ uniffiHandleError,
34056
+ /*isErrorType:*/ SignerError.instanceOf,
34057
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
34058
+ FfiConverterTypeSignerError
34059
+ ),
34060
+ /*lowerString:*/ FfiConverterString.lower
34061
+ );
34062
+ return uniffiForeignFuture;
34063
+ },
34064
+ uniffiFree: (uniffiHandle: UniffiHandle): void => {
34065
+ // ExternalBreezSigner: this will throw a stale handle error if the handle isn't found.
34066
+ FfiConverterTypeExternalBreezSigner.drop(uniffiHandle);
34067
+ },
34068
+ },
34069
+ register: () => {
34070
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_externalbreezsigner(
34071
+ uniffiCallbackInterfaceExternalBreezSigner.vtable
34072
+ );
34073
+ },
34074
+ };
34075
+
34076
+ /**
34077
+ * External signer that provides signing only, without the SDK's local
34078
+ * ECIES/HMAC operations.
34079
+ *
34080
+ * Implement this instead of [`ExternalBreezSigner`] for a signer that can't
34081
+ * release key material for local encryption (for example a policy-restricted
34082
+ * enclave). The capability is declared by the type: the SDK keeps session
34083
+ * tokens in plaintext and the features that rely on ECIES/HMAC are unavailable.
34084
+ */
34085
+ export interface ExternalSigningSigner {
34086
+ /**
34087
+ * Derives a public key for the given BIP32 derivation path.
34088
+ *
34089
+ * # Arguments
34090
+ * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0")
34091
+ *
34092
+ * # Returns
34093
+ * The derived public key as 33 bytes, or a `SignerError`
34094
+ *
34095
+ * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation)
34096
+ */
34097
+ derivePublicKey(
34098
+ path: string,
34099
+ asyncOpts_?: { signal: AbortSignal }
34100
+ ): /*throws*/ Promise<PublicKeyBytes>;
34101
+ /**
34102
+ * Signs a message using ECDSA at the given derivation path.
34103
+ *
34104
+ * The message should be a 32-byte digest (typically a hash of the original data).
34105
+ *
34106
+ * # Arguments
34107
+ * * `message` - The 32-byte message digest to sign
34108
+ * * `path` - BIP32 derivation path as a string
34109
+ *
34110
+ * # Returns
34111
+ * 64-byte compact ECDSA signature, or a `SignerError`
34112
+ */
34113
+ signEcdsa(
34114
+ message: MessageBytes,
34115
+ path: string,
34116
+ asyncOpts_?: { signal: AbortSignal }
34117
+ ): /*throws*/ Promise<EcdsaSignatureBytes>;
34118
+ /**
34119
+ * Signs a message using recoverable ECDSA at the given derivation path.
34120
+ *
34121
+ * The message should be a 32-byte digest (typically a hash of the original data).
34122
+ *
34123
+ * # Arguments
34124
+ * * `message` - The 32-byte message digest to sign
34125
+ * * `path` - BIP32 derivation path as a string
34126
+ *
34127
+ * # Returns
34128
+ * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError`
34129
+ */
34130
+ signEcdsaRecoverable(
34131
+ message: MessageBytes,
34132
+ path: string,
34133
+ asyncOpts_?: { signal: AbortSignal }
34134
+ ): /*throws*/ Promise<RecoverableEcdsaSignatureBytes>;
34135
+ /**
34136
+ * Signs a hash using Schnorr signature at the given derivation path.
34137
+ *
34138
+ * # Arguments
34139
+ * * `hash` - The 32-byte hash to sign (must be 32 bytes)
34140
+ * * `path` - BIP32 derivation path as a string
34141
+ *
34142
+ * # Returns
34143
+ * 64-byte Schnorr signature, or a `SignerError`
34144
+ */
34145
+ signHashSchnorr(
34146
+ hash: ArrayBuffer,
34147
+ path: string,
34148
+ asyncOpts_?: { signal: AbortSignal }
34149
+ ): /*throws*/ Promise<SchnorrSignatureBytes>;
34150
+ }
34151
+
34152
+ /**
34153
+ * External signer that provides signing only, without the SDK's local
34154
+ * ECIES/HMAC operations.
34155
+ *
34156
+ * Implement this instead of [`ExternalBreezSigner`] for a signer that can't
34157
+ * release key material for local encryption (for example a policy-restricted
34158
+ * enclave). The capability is declared by the type: the SDK keeps session
34159
+ * tokens in plaintext and the features that rely on ECIES/HMAC are unavailable.
34160
+ */
34161
+ export class ExternalSigningSignerImpl
34162
+ extends UniffiAbstractObject
34163
+ implements ExternalSigningSigner
34164
+ {
34165
+ readonly [uniffiTypeNameSymbol] = 'ExternalSigningSignerImpl';
34166
+ readonly [destructorGuardSymbol]: UniffiRustArcPtr;
34167
+ readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
34168
+ // No primary constructor declared for this class.
34169
+ private constructor(pointer: UnsafeMutableRawPointer) {
34170
+ super();
34171
+ this[pointerLiteralSymbol] = pointer;
34172
+ this[destructorGuardSymbol] =
34173
+ uniffiTypeExternalSigningSignerImplObjectFactory.bless(pointer);
34174
+ }
34175
+
34176
+ /**
34177
+ * Derives a public key for the given BIP32 derivation path.
34178
+ *
34179
+ * # Arguments
34180
+ * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0")
34181
+ *
34182
+ * # Returns
34183
+ * The derived public key as 33 bytes, or a `SignerError`
34184
+ *
34185
+ * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation)
34186
+ */
34187
+ public async derivePublicKey(
34188
+ path: string,
34189
+ asyncOpts_?: { signal: AbortSignal }
34190
+ ): Promise<PublicKeyBytes> /*throws*/ {
34191
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
34192
+ try {
34193
+ return await uniffiRustCallAsync(
34194
+ /*rustCaller:*/ uniffiCaller,
34195
+ /*rustFutureFunc:*/ () => {
34196
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_derive_public_key(
34197
+ uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this),
34198
+ FfiConverterString.lower(path)
34199
+ );
34200
+ },
34201
+ /*pollFunc:*/ nativeModule()
34202
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
34203
+ /*cancelFunc:*/ nativeModule()
34204
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
34205
+ /*completeFunc:*/ nativeModule()
34206
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
34207
+ /*freeFunc:*/ nativeModule()
34208
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
34209
+ /*liftFunc:*/ FfiConverterTypePublicKeyBytes.lift.bind(
34210
+ FfiConverterTypePublicKeyBytes
34211
+ ),
34212
+ /*liftString:*/ FfiConverterString.lift,
34213
+ /*asyncOpts:*/ asyncOpts_,
34214
+ /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
34215
+ FfiConverterTypeSignerError
34216
+ )
34217
+ );
34218
+ } catch (__error: any) {
34219
+ if (uniffiIsDebug && __error instanceof Error) {
34220
+ __error.stack = __stack;
34221
+ }
34222
+ throw __error;
34223
+ }
34224
+ }
34225
+
34226
+ /**
34227
+ * Signs a message using ECDSA at the given derivation path.
34228
+ *
34229
+ * The message should be a 32-byte digest (typically a hash of the original data).
34230
+ *
34231
+ * # Arguments
34232
+ * * `message` - The 32-byte message digest to sign
34233
+ * * `path` - BIP32 derivation path as a string
34234
+ *
34235
+ * # Returns
34236
+ * 64-byte compact ECDSA signature, or a `SignerError`
34237
+ */
34238
+ public async signEcdsa(
34239
+ message: MessageBytes,
34240
+ path: string,
34241
+ asyncOpts_?: { signal: AbortSignal }
34242
+ ): Promise<EcdsaSignatureBytes> /*throws*/ {
34243
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
34244
+ try {
34245
+ return await uniffiRustCallAsync(
34246
+ /*rustCaller:*/ uniffiCaller,
34247
+ /*rustFutureFunc:*/ () => {
34248
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_sign_ecdsa(
34249
+ uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this),
34250
+ FfiConverterTypeMessageBytes.lower(message),
34251
+ FfiConverterString.lower(path)
34252
+ );
34253
+ },
34254
+ /*pollFunc:*/ nativeModule()
34255
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
34256
+ /*cancelFunc:*/ nativeModule()
34257
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
34258
+ /*completeFunc:*/ nativeModule()
34259
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
34260
+ /*freeFunc:*/ nativeModule()
34261
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
34262
+ /*liftFunc:*/ FfiConverterTypeEcdsaSignatureBytes.lift.bind(
34263
+ FfiConverterTypeEcdsaSignatureBytes
34264
+ ),
34265
+ /*liftString:*/ FfiConverterString.lift,
34266
+ /*asyncOpts:*/ asyncOpts_,
34267
+ /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
34268
+ FfiConverterTypeSignerError
34269
+ )
34270
+ );
34271
+ } catch (__error: any) {
34272
+ if (uniffiIsDebug && __error instanceof Error) {
34273
+ __error.stack = __stack;
34274
+ }
34275
+ throw __error;
34276
+ }
34277
+ }
34278
+
34279
+ /**
34280
+ * Signs a message using recoverable ECDSA at the given derivation path.
34281
+ *
34282
+ * The message should be a 32-byte digest (typically a hash of the original data).
34283
+ *
34284
+ * # Arguments
34285
+ * * `message` - The 32-byte message digest to sign
34286
+ * * `path` - BIP32 derivation path as a string
34287
+ *
34288
+ * # Returns
34289
+ * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError`
34290
+ */
34291
+ public async signEcdsaRecoverable(
34292
+ message: MessageBytes,
34293
+ path: string,
34294
+ asyncOpts_?: { signal: AbortSignal }
34295
+ ): Promise<RecoverableEcdsaSignatureBytes> /*throws*/ {
34296
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
34297
+ try {
34298
+ return await uniffiRustCallAsync(
34299
+ /*rustCaller:*/ uniffiCaller,
34300
+ /*rustFutureFunc:*/ () => {
34301
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_sign_ecdsa_recoverable(
34302
+ uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this),
34303
+ FfiConverterTypeMessageBytes.lower(message),
34304
+ FfiConverterString.lower(path)
34305
+ );
34306
+ },
34307
+ /*pollFunc:*/ nativeModule()
34308
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
34309
+ /*cancelFunc:*/ nativeModule()
34310
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
34311
+ /*completeFunc:*/ nativeModule()
34312
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
34313
+ /*freeFunc:*/ nativeModule()
34314
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
34315
+ /*liftFunc:*/ FfiConverterTypeRecoverableEcdsaSignatureBytes.lift.bind(
34316
+ FfiConverterTypeRecoverableEcdsaSignatureBytes
34317
+ ),
34318
+ /*liftString:*/ FfiConverterString.lift,
34319
+ /*asyncOpts:*/ asyncOpts_,
34320
+ /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
34321
+ FfiConverterTypeSignerError
34322
+ )
34323
+ );
34324
+ } catch (__error: any) {
34325
+ if (uniffiIsDebug && __error instanceof Error) {
34326
+ __error.stack = __stack;
34327
+ }
34328
+ throw __error;
34329
+ }
34330
+ }
34331
+
34332
+ /**
34333
+ * Signs a hash using Schnorr signature at the given derivation path.
34334
+ *
34335
+ * # Arguments
34336
+ * * `hash` - The 32-byte hash to sign (must be 32 bytes)
34337
+ * * `path` - BIP32 derivation path as a string
34338
+ *
34339
+ * # Returns
34340
+ * 64-byte Schnorr signature, or a `SignerError`
34341
+ */
34342
+ public async signHashSchnorr(
34343
+ hash: ArrayBuffer,
34344
+ path: string,
34345
+ asyncOpts_?: { signal: AbortSignal }
34346
+ ): Promise<SchnorrSignatureBytes> /*throws*/ {
34347
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
34348
+ try {
34349
+ return await uniffiRustCallAsync(
34350
+ /*rustCaller:*/ uniffiCaller,
34351
+ /*rustFutureFunc:*/ () => {
34352
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_sign_hash_schnorr(
34353
+ uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this),
33212
34354
  FfiConverterArrayBuffer.lower(hash),
33213
34355
  FfiConverterString.lower(path)
33214
34356
  );
@@ -33238,59 +34380,6 @@ export class ExternalBreezSignerImpl
33238
34380
  }
33239
34381
  }
33240
34382
 
33241
- /**
33242
- * HMAC-SHA256 of a message at the given derivation path.
33243
- *
33244
- * # Arguments
33245
- * * `message` - The message to hash
33246
- * * `path` - BIP32 derivation path as a string
33247
- *
33248
- * # Returns
33249
- * 32-byte HMAC-SHA256, or a `SignerError`
33250
- *
33251
- * See also: [JavaScript `htlcHMAC`](https://docs.spark.money/wallets/spark-signer#generate-htlc-hmac)
33252
- */
33253
- public async hmacSha256(
33254
- message: ArrayBuffer,
33255
- path: string,
33256
- asyncOpts_?: { signal: AbortSignal }
33257
- ): Promise<HashedMessageBytes> /*throws*/ {
33258
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
33259
- try {
33260
- return await uniffiRustCallAsync(
33261
- /*rustCaller:*/ uniffiCaller,
33262
- /*rustFutureFunc:*/ () => {
33263
- return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_hmac_sha256(
33264
- uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this),
33265
- FfiConverterArrayBuffer.lower(message),
33266
- FfiConverterString.lower(path)
33267
- );
33268
- },
33269
- /*pollFunc:*/ nativeModule()
33270
- .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
33271
- /*cancelFunc:*/ nativeModule()
33272
- .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
33273
- /*completeFunc:*/ nativeModule()
33274
- .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
33275
- /*freeFunc:*/ nativeModule()
33276
- .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
33277
- /*liftFunc:*/ FfiConverterTypeHashedMessageBytes.lift.bind(
33278
- FfiConverterTypeHashedMessageBytes
33279
- ),
33280
- /*liftString:*/ FfiConverterString.lift,
33281
- /*asyncOpts:*/ asyncOpts_,
33282
- /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
33283
- FfiConverterTypeSignerError
33284
- )
33285
- );
33286
- } catch (__error: any) {
33287
- if (uniffiIsDebug && __error instanceof Error) {
33288
- __error.stack = __stack;
33289
- }
33290
- throw __error;
33291
- }
33292
- }
33293
-
33294
34383
  /**
33295
34384
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
33296
34385
  */
@@ -33298,33 +34387,33 @@ export class ExternalBreezSignerImpl
33298
34387
  const ptr = (this as any)[destructorGuardSymbol];
33299
34388
  if (ptr !== undefined) {
33300
34389
  const pointer =
33301
- uniffiTypeExternalBreezSignerImplObjectFactory.pointer(this);
33302
- uniffiTypeExternalBreezSignerImplObjectFactory.freePointer(pointer);
33303
- uniffiTypeExternalBreezSignerImplObjectFactory.unbless(ptr);
34390
+ uniffiTypeExternalSigningSignerImplObjectFactory.pointer(this);
34391
+ uniffiTypeExternalSigningSignerImplObjectFactory.freePointer(pointer);
34392
+ uniffiTypeExternalSigningSignerImplObjectFactory.unbless(ptr);
33304
34393
  delete (this as any)[destructorGuardSymbol];
33305
34394
  }
33306
34395
  }
33307
34396
 
33308
- static instanceOf(obj: any): obj is ExternalBreezSignerImpl {
33309
- return uniffiTypeExternalBreezSignerImplObjectFactory.isConcreteType(obj);
34397
+ static instanceOf(obj: any): obj is ExternalSigningSignerImpl {
34398
+ return uniffiTypeExternalSigningSignerImplObjectFactory.isConcreteType(obj);
33310
34399
  }
33311
34400
  }
33312
34401
 
33313
- const uniffiTypeExternalBreezSignerImplObjectFactory: UniffiObjectFactory<ExternalBreezSigner> =
34402
+ const uniffiTypeExternalSigningSignerImplObjectFactory: UniffiObjectFactory<ExternalSigningSigner> =
33314
34403
  (() => {
33315
34404
  return {
33316
- create(pointer: UnsafeMutableRawPointer): ExternalBreezSigner {
33317
- const instance = Object.create(ExternalBreezSignerImpl.prototype);
34405
+ create(pointer: UnsafeMutableRawPointer): ExternalSigningSigner {
34406
+ const instance = Object.create(ExternalSigningSignerImpl.prototype);
33318
34407
  instance[pointerLiteralSymbol] = pointer;
33319
34408
  instance[destructorGuardSymbol] = this.bless(pointer);
33320
- instance[uniffiTypeNameSymbol] = 'ExternalBreezSignerImpl';
34409
+ instance[uniffiTypeNameSymbol] = 'ExternalSigningSignerImpl';
33321
34410
  return instance;
33322
34411
  },
33323
34412
 
33324
34413
  bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
33325
34414
  return uniffiCaller.rustCall(
33326
34415
  /*caller:*/ (status) =>
33327
- nativeModule().ubrn_uniffi_internal_fn_method_externalbreezsigner_ffi__bless_pointer(
34416
+ nativeModule().ubrn_uniffi_internal_fn_method_externalsigningsigner_ffi__bless_pointer(
33328
34417
  p,
33329
34418
  status
33330
34419
  ),
@@ -33336,18 +34425,18 @@ const uniffiTypeExternalBreezSignerImplObjectFactory: UniffiObjectFactory<Extern
33336
34425
  ptr.markDestroyed();
33337
34426
  },
33338
34427
 
33339
- pointer(obj: ExternalBreezSigner): UnsafeMutableRawPointer {
34428
+ pointer(obj: ExternalSigningSigner): UnsafeMutableRawPointer {
33340
34429
  if ((obj as any)[destructorGuardSymbol] === undefined) {
33341
34430
  throw new UniffiInternalError.UnexpectedNullPointer();
33342
34431
  }
33343
34432
  return (obj as any)[pointerLiteralSymbol];
33344
34433
  },
33345
34434
 
33346
- clonePointer(obj: ExternalBreezSigner): UnsafeMutableRawPointer {
34435
+ clonePointer(obj: ExternalSigningSigner): UnsafeMutableRawPointer {
33347
34436
  const pointer = this.pointer(obj);
33348
34437
  return uniffiCaller.rustCall(
33349
34438
  /*caller:*/ (callStatus) =>
33350
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_externalbreezsigner(
34439
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_externalsigningsigner(
33351
34440
  pointer,
33352
34441
  callStatus
33353
34442
  ),
@@ -33358,7 +34447,7 @@ const uniffiTypeExternalBreezSignerImplObjectFactory: UniffiObjectFactory<Extern
33358
34447
  freePointer(pointer: UnsafeMutableRawPointer): void {
33359
34448
  uniffiCaller.rustCall(
33360
34449
  /*caller:*/ (callStatus) =>
33361
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_externalbreezsigner(
34450
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_externalsigningsigner(
33362
34451
  pointer,
33363
34452
  callStatus
33364
34453
  ),
@@ -33366,24 +34455,25 @@ const uniffiTypeExternalBreezSignerImplObjectFactory: UniffiObjectFactory<Extern
33366
34455
  );
33367
34456
  },
33368
34457
 
33369
- isConcreteType(obj: any): obj is ExternalBreezSigner {
34458
+ isConcreteType(obj: any): obj is ExternalSigningSigner {
33370
34459
  return (
33371
34460
  obj[destructorGuardSymbol] &&
33372
- obj[uniffiTypeNameSymbol] === 'ExternalBreezSignerImpl'
34461
+ obj[uniffiTypeNameSymbol] === 'ExternalSigningSignerImpl'
33373
34462
  );
33374
34463
  },
33375
34464
  };
33376
34465
  })();
33377
- // FfiConverter for ExternalBreezSigner
33378
- const FfiConverterTypeExternalBreezSigner = new FfiConverterObjectWithCallbacks(
33379
- uniffiTypeExternalBreezSignerImplObjectFactory
33380
- );
34466
+ // FfiConverter for ExternalSigningSigner
34467
+ const FfiConverterTypeExternalSigningSigner =
34468
+ new FfiConverterObjectWithCallbacks(
34469
+ uniffiTypeExternalSigningSignerImplObjectFactory
34470
+ );
33381
34471
 
33382
- // Add a vtavble for the callbacks that go in ExternalBreezSigner.
34472
+ // Add a vtavble for the callbacks that go in ExternalSigningSigner.
33383
34473
 
33384
34474
  // Put the implementation in a struct so we don't pollute the top-level namespace
33385
- const uniffiCallbackInterfaceExternalBreezSigner: {
33386
- vtable: UniffiVTableCallbackInterfaceExternalBreezSigner;
34475
+ const uniffiCallbackInterfaceExternalSigningSigner: {
34476
+ vtable: UniffiVTableCallbackInterfaceExternalSigningSigner;
33387
34477
  register: () => void;
33388
34478
  } = {
33389
34479
  // Create the VTable using a series of closures.
@@ -33399,7 +34489,7 @@ const uniffiCallbackInterfaceExternalBreezSigner: {
33399
34489
  signal: AbortSignal
33400
34490
  ): Promise<PublicKeyBytes> => {
33401
34491
  const jsCallback =
33402
- FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
34492
+ FfiConverterTypeExternalSigningSigner.lift(uniffiHandle);
33403
34493
  return await jsCallback.derivePublicKey(FfiConverterString.lift(path), {
33404
34494
  signal,
33405
34495
  });
@@ -33448,7 +34538,7 @@ const uniffiCallbackInterfaceExternalBreezSigner: {
33448
34538
  signal: AbortSignal
33449
34539
  ): Promise<EcdsaSignatureBytes> => {
33450
34540
  const jsCallback =
33451
- FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
34541
+ FfiConverterTypeExternalSigningSigner.lift(uniffiHandle);
33452
34542
  return await jsCallback.signEcdsa(
33453
34543
  FfiConverterTypeMessageBytes.lift(message),
33454
34544
  FfiConverterString.lift(path),
@@ -33499,7 +34589,7 @@ const uniffiCallbackInterfaceExternalBreezSigner: {
33499
34589
  signal: AbortSignal
33500
34590
  ): Promise<RecoverableEcdsaSignatureBytes> => {
33501
34591
  const jsCallback =
33502
- FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
34592
+ FfiConverterTypeExternalSigningSigner.lift(uniffiHandle);
33503
34593
  return await jsCallback.signEcdsaRecoverable(
33504
34594
  FfiConverterTypeMessageBytes.lift(message),
33505
34595
  FfiConverterString.lift(path),
@@ -33542,108 +34632,6 @@ const uniffiCallbackInterfaceExternalBreezSigner: {
33542
34632
  );
33543
34633
  return uniffiForeignFuture;
33544
34634
  },
33545
- encryptEcies: (
33546
- uniffiHandle: bigint,
33547
- message: Uint8Array,
33548
- path: Uint8Array,
33549
- uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33550
- uniffiCallbackData: bigint
33551
- ) => {
33552
- const uniffiMakeCall = async (
33553
- signal: AbortSignal
33554
- ): Promise<ArrayBuffer> => {
33555
- const jsCallback =
33556
- FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33557
- return await jsCallback.encryptEcies(
33558
- FfiConverterArrayBuffer.lift(message),
33559
- FfiConverterString.lift(path),
33560
- { signal }
33561
- );
33562
- };
33563
- const uniffiHandleSuccess = (returnValue: ArrayBuffer) => {
33564
- uniffiFutureCallback.call(
33565
- uniffiFutureCallback,
33566
- uniffiCallbackData,
33567
- /* UniffiForeignFutureStructRustBuffer */ {
33568
- returnValue: FfiConverterArrayBuffer.lower(returnValue),
33569
- callStatus: uniffiCaller.createCallStatus(),
33570
- }
33571
- );
33572
- };
33573
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33574
- uniffiFutureCallback.call(
33575
- uniffiFutureCallback,
33576
- uniffiCallbackData,
33577
- /* UniffiForeignFutureStructRustBuffer */ {
33578
- returnValue: /*empty*/ new Uint8Array(0),
33579
- // TODO create callstatus with error.
33580
- callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33581
- }
33582
- );
33583
- };
33584
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33585
- /*makeCall:*/ uniffiMakeCall,
33586
- /*handleSuccess:*/ uniffiHandleSuccess,
33587
- /*handleError:*/ uniffiHandleError,
33588
- /*isErrorType:*/ SignerError.instanceOf,
33589
- /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33590
- FfiConverterTypeSignerError
33591
- ),
33592
- /*lowerString:*/ FfiConverterString.lower
33593
- );
33594
- return uniffiForeignFuture;
33595
- },
33596
- decryptEcies: (
33597
- uniffiHandle: bigint,
33598
- message: Uint8Array,
33599
- path: Uint8Array,
33600
- uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33601
- uniffiCallbackData: bigint
33602
- ) => {
33603
- const uniffiMakeCall = async (
33604
- signal: AbortSignal
33605
- ): Promise<ArrayBuffer> => {
33606
- const jsCallback =
33607
- FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33608
- return await jsCallback.decryptEcies(
33609
- FfiConverterArrayBuffer.lift(message),
33610
- FfiConverterString.lift(path),
33611
- { signal }
33612
- );
33613
- };
33614
- const uniffiHandleSuccess = (returnValue: ArrayBuffer) => {
33615
- uniffiFutureCallback.call(
33616
- uniffiFutureCallback,
33617
- uniffiCallbackData,
33618
- /* UniffiForeignFutureStructRustBuffer */ {
33619
- returnValue: FfiConverterArrayBuffer.lower(returnValue),
33620
- callStatus: uniffiCaller.createCallStatus(),
33621
- }
33622
- );
33623
- };
33624
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33625
- uniffiFutureCallback.call(
33626
- uniffiFutureCallback,
33627
- uniffiCallbackData,
33628
- /* UniffiForeignFutureStructRustBuffer */ {
33629
- returnValue: /*empty*/ new Uint8Array(0),
33630
- // TODO create callstatus with error.
33631
- callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33632
- }
33633
- );
33634
- };
33635
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33636
- /*makeCall:*/ uniffiMakeCall,
33637
- /*handleSuccess:*/ uniffiHandleSuccess,
33638
- /*handleError:*/ uniffiHandleError,
33639
- /*isErrorType:*/ SignerError.instanceOf,
33640
- /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33641
- FfiConverterTypeSignerError
33642
- ),
33643
- /*lowerString:*/ FfiConverterString.lower
33644
- );
33645
- return uniffiForeignFuture;
33646
- },
33647
34635
  signHashSchnorr: (
33648
34636
  uniffiHandle: bigint,
33649
34637
  hash: Uint8Array,
@@ -33655,7 +34643,7 @@ const uniffiCallbackInterfaceExternalBreezSigner: {
33655
34643
  signal: AbortSignal
33656
34644
  ): Promise<SchnorrSignatureBytes> => {
33657
34645
  const jsCallback =
33658
- FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
34646
+ FfiConverterTypeExternalSigningSigner.lift(uniffiHandle);
33659
34647
  return await jsCallback.signHashSchnorr(
33660
34648
  FfiConverterArrayBuffer.lift(hash),
33661
34649
  FfiConverterString.lift(path),
@@ -33696,65 +34684,14 @@ const uniffiCallbackInterfaceExternalBreezSigner: {
33696
34684
  );
33697
34685
  return uniffiForeignFuture;
33698
34686
  },
33699
- hmacSha256: (
33700
- uniffiHandle: bigint,
33701
- message: Uint8Array,
33702
- path: Uint8Array,
33703
- uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
33704
- uniffiCallbackData: bigint
33705
- ) => {
33706
- const uniffiMakeCall = async (
33707
- signal: AbortSignal
33708
- ): Promise<HashedMessageBytes> => {
33709
- const jsCallback =
33710
- FfiConverterTypeExternalBreezSigner.lift(uniffiHandle);
33711
- return await jsCallback.hmacSha256(
33712
- FfiConverterArrayBuffer.lift(message),
33713
- FfiConverterString.lift(path),
33714
- { signal }
33715
- );
33716
- };
33717
- const uniffiHandleSuccess = (returnValue: HashedMessageBytes) => {
33718
- uniffiFutureCallback.call(
33719
- uniffiFutureCallback,
33720
- uniffiCallbackData,
33721
- /* UniffiForeignFutureStructRustBuffer */ {
33722
- returnValue: FfiConverterTypeHashedMessageBytes.lower(returnValue),
33723
- callStatus: uniffiCaller.createCallStatus(),
33724
- }
33725
- );
33726
- };
33727
- const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
33728
- uniffiFutureCallback.call(
33729
- uniffiFutureCallback,
33730
- uniffiCallbackData,
33731
- /* UniffiForeignFutureStructRustBuffer */ {
33732
- returnValue: /*empty*/ new Uint8Array(0),
33733
- // TODO create callstatus with error.
33734
- callStatus: uniffiCaller.createErrorStatus(code, errorBuf),
33735
- }
33736
- );
33737
- };
33738
- const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
33739
- /*makeCall:*/ uniffiMakeCall,
33740
- /*handleSuccess:*/ uniffiHandleSuccess,
33741
- /*handleError:*/ uniffiHandleError,
33742
- /*isErrorType:*/ SignerError.instanceOf,
33743
- /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
33744
- FfiConverterTypeSignerError
33745
- ),
33746
- /*lowerString:*/ FfiConverterString.lower
33747
- );
33748
- return uniffiForeignFuture;
33749
- },
33750
34687
  uniffiFree: (uniffiHandle: UniffiHandle): void => {
33751
- // ExternalBreezSigner: this will throw a stale handle error if the handle isn't found.
33752
- FfiConverterTypeExternalBreezSigner.drop(uniffiHandle);
34688
+ // ExternalSigningSigner: this will throw a stale handle error if the handle isn't found.
34689
+ FfiConverterTypeExternalSigningSigner.drop(uniffiHandle);
33753
34690
  },
33754
34691
  },
33755
34692
  register: () => {
33756
- nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_externalbreezsigner(
33757
- uniffiCallbackInterfaceExternalBreezSigner.vtable
34693
+ nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_externalsigningsigner(
34694
+ uniffiCallbackInterfaceExternalSigningSigner.vtable
33758
34695
  );
33759
34696
  },
33760
34697
  };
@@ -38010,6 +38947,38 @@ export class SdkBuilder
38010
38947
  );
38011
38948
  }
38012
38949
 
38950
+ /**
38951
+ * Creates a new `SdkBuilder` with a signing-only external signer.
38952
+ *
38953
+ * Use this for a signer that can't perform the SDK's local ECIES/HMAC
38954
+ * operations (for example a policy-restricted enclave). The SDK keeps
38955
+ * session tokens in plaintext and disables the features that rely on
38956
+ * ECIES/HMAC.
38957
+ * Arguments:
38958
+ * - `config`: The configuration to be used.
38959
+ * - `breez_signer`: Signing-only external signer for non-Spark SDK signing.
38960
+ * - `spark_signer`: External high-level Spark signer for the Spark wallet.
38961
+ */
38962
+ public static newWithSigningOnlySigner(
38963
+ config: Config,
38964
+ breezSigner: ExternalSigningSigner,
38965
+ sparkSigner: ExternalSparkSigner
38966
+ ): SdkBuilderInterface {
38967
+ return FfiConverterTypeSdkBuilder.lift(
38968
+ uniffiCaller.rustCall(
38969
+ /*caller:*/ (callStatus) => {
38970
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_constructor_sdkbuilder_new_with_signing_only_signer(
38971
+ FfiConverterTypeConfig.lower(config),
38972
+ FfiConverterTypeExternalSigningSigner.lower(breezSigner),
38973
+ FfiConverterTypeExternalSparkSigner.lower(sparkSigner),
38974
+ callStatus
38975
+ );
38976
+ },
38977
+ /*liftString:*/ FfiConverterString.lift
38978
+ )
38979
+ );
38980
+ }
38981
+
38013
38982
  /**
38014
38983
  * Builds the `BreezSdk` instance with the configured components.
38015
38984
  */
@@ -43371,14 +44340,30 @@ function uniffiEnsureInitialized() {
43371
44340
  'uniffi_breez_sdk_spark_checksum_func_connect_with_signer'
43372
44341
  );
43373
44342
  }
44343
+ if (
44344
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_connect_with_signing_only_signer() !==
44345
+ 17952
44346
+ ) {
44347
+ throw new UniffiInternalError.ApiChecksumMismatch(
44348
+ 'uniffi_breez_sdk_spark_checksum_func_connect_with_signing_only_signer'
44349
+ );
44350
+ }
43374
44351
  if (
43375
44352
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_create_turnkey_signer() !==
43376
- 31659
44353
+ 50635
43377
44354
  ) {
43378
44355
  throw new UniffiInternalError.ApiChecksumMismatch(
43379
44356
  'uniffi_breez_sdk_spark_checksum_func_create_turnkey_signer'
43380
44357
  );
43381
44358
  }
44359
+ if (
44360
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_create_turnkey_signing_only_signer() !==
44361
+ 37791
44362
+ ) {
44363
+ throw new UniffiInternalError.ApiChecksumMismatch(
44364
+ 'uniffi_breez_sdk_spark_checksum_func_create_turnkey_signing_only_signer'
44365
+ );
44366
+ }
43382
44367
  if (
43383
44368
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_custom_storage() !==
43384
44369
  18116
@@ -43915,6 +44900,38 @@ function uniffiEnsureInitialized() {
43915
44900
  'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_hmac_sha256'
43916
44901
  );
43917
44902
  }
44903
+ if (
44904
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_derive_public_key() !==
44905
+ 28092
44906
+ ) {
44907
+ throw new UniffiInternalError.ApiChecksumMismatch(
44908
+ 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_derive_public_key'
44909
+ );
44910
+ }
44911
+ if (
44912
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa() !==
44913
+ 13755
44914
+ ) {
44915
+ throw new UniffiInternalError.ApiChecksumMismatch(
44916
+ 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa'
44917
+ );
44918
+ }
44919
+ if (
44920
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa_recoverable() !==
44921
+ 34935
44922
+ ) {
44923
+ throw new UniffiInternalError.ApiChecksumMismatch(
44924
+ 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa_recoverable'
44925
+ );
44926
+ }
44927
+ if (
44928
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_hash_schnorr() !==
44929
+ 21395
44930
+ ) {
44931
+ throw new UniffiInternalError.ApiChecksumMismatch(
44932
+ 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_hash_schnorr'
44933
+ );
44934
+ }
43918
44935
  if (
43919
44936
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_get_identity_public_key() !==
43920
44937
  38705
@@ -44611,6 +45628,14 @@ function uniffiEnsureInitialized() {
44611
45628
  'uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new_with_signer'
44612
45629
  );
44613
45630
  }
45631
+ if (
45632
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new_with_signing_only_signer() !==
45633
+ 27342
45634
+ ) {
45635
+ throw new UniffiInternalError.ApiChecksumMismatch(
45636
+ 'uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new_with_signing_only_signer'
45637
+ );
45638
+ }
44614
45639
  if (
44615
45640
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event() !==
44616
45641
  24807
@@ -44632,6 +45657,7 @@ function uniffiEnsureInitialized() {
44632
45657
  uniffiCallbackInterfaceLogger.register();
44633
45658
  uniffiCallbackInterfaceBitcoinChainService.register();
44634
45659
  uniffiCallbackInterfaceExternalBreezSigner.register();
45660
+ uniffiCallbackInterfaceExternalSigningSigner.register();
44635
45661
  uniffiCallbackInterfaceExternalSparkSigner.register();
44636
45662
  uniffiCallbackInterfaceFiatService.register();
44637
45663
  uniffiCallbackInterfacePaymentObserver.register();
@@ -44687,6 +45713,7 @@ export default Object.freeze({
44687
45713
  FfiConverterTypeConnectWithPasskeyRequest,
44688
45714
  FfiConverterTypeConnectWithPasskeyResponse,
44689
45715
  FfiConverterTypeConnectWithSignerRequest,
45716
+ FfiConverterTypeConnectWithSigningOnlySignerRequest,
44690
45717
  FfiConverterTypeContact,
44691
45718
  FfiConverterTypeConversion,
44692
45719
  FfiConverterTypeConversionAsset,
@@ -44749,6 +45776,7 @@ export default Object.freeze({
44749
45776
  FfiConverterTypeExternalSignedSparkInvoice,
44750
45777
  FfiConverterTypeExternalSigners,
44751
45778
  FfiConverterTypeExternalSigningCommitments,
45779
+ FfiConverterTypeExternalSigningSigner,
44752
45780
  FfiConverterTypeExternalSparkInvoiceKind,
44753
45781
  FfiConverterTypeExternalSparkSigner,
44754
45782
  FfiConverterTypeExternalStartStaticDepositRefundRequest,
@@ -44887,6 +45915,7 @@ export default Object.freeze({
44887
45915
  FfiConverterTypeSignMessageRequest,
44888
45916
  FfiConverterTypeSignMessageResponse,
44889
45917
  FfiConverterTypeSignerError,
45918
+ FfiConverterTypeSigningOnlyExternalSigners,
44890
45919
  FfiConverterTypeSilentPaymentAddressDetails,
44891
45920
  FfiConverterTypeSourceAsset,
44892
45921
  FfiConverterTypeSparkAddressDetails,