@breeztech/breez-sdk-spark-react-native 0.7.3 → 0.7.4

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.
@@ -4335,6 +4335,58 @@ const FfiConverterTypeGetTokensMetadataResponse = (() => {
4335
4335
  return new FFIConverter();
4336
4336
  })();
4337
4337
 
4338
+ export type HashedMessageBytes = {
4339
+ bytes: ArrayBuffer;
4340
+ };
4341
+
4342
+ /**
4343
+ * Generated factory for {@link HashedMessageBytes} record objects.
4344
+ */
4345
+ export const HashedMessageBytes = (() => {
4346
+ const defaults = () => ({});
4347
+ const create = (() => {
4348
+ return uniffiCreateRecord<HashedMessageBytes, ReturnType<typeof defaults>>(
4349
+ defaults
4350
+ );
4351
+ })();
4352
+ return Object.freeze({
4353
+ /**
4354
+ * Create a frozen instance of {@link HashedMessageBytes}, with defaults specified
4355
+ * in Rust, in the {@link breez_sdk_spark} crate.
4356
+ */
4357
+ create,
4358
+
4359
+ /**
4360
+ * Create a frozen instance of {@link HashedMessageBytes}, with defaults specified
4361
+ * in Rust, in the {@link breez_sdk_spark} crate.
4362
+ */
4363
+ new: create,
4364
+
4365
+ /**
4366
+ * Defaults specified in the {@link breez_sdk_spark} crate.
4367
+ */
4368
+ defaults: () => Object.freeze(defaults()) as Partial<HashedMessageBytes>,
4369
+ });
4370
+ })();
4371
+
4372
+ const FfiConverterTypeHashedMessageBytes = (() => {
4373
+ type TypeName = HashedMessageBytes;
4374
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
4375
+ read(from: RustBuffer): TypeName {
4376
+ return {
4377
+ bytes: FfiConverterArrayBuffer.read(from),
4378
+ };
4379
+ }
4380
+ write(value: TypeName, into: RustBuffer): void {
4381
+ FfiConverterArrayBuffer.write(value.bytes, into);
4382
+ }
4383
+ allocationSize(value: TypeName): number {
4384
+ return FfiConverterArrayBuffer.allocationSize(value.bytes);
4385
+ }
4386
+ }
4387
+ return new FFIConverter();
4388
+ })();
4389
+
4338
4390
  /**
4339
4391
  * FFI-safe wrapper for (Identifier, `SigningCommitments`) pair
4340
4392
  */
@@ -5285,6 +5337,61 @@ const FfiConverterTypeLnurlAuthRequestDetails = (() => {
5285
5337
  return new FFIConverter();
5286
5338
  })();
5287
5339
 
5340
+ /**
5341
+ * LNURL error details
5342
+ */
5343
+ export type LnurlErrorDetails = {
5344
+ reason: string;
5345
+ };
5346
+
5347
+ /**
5348
+ * Generated factory for {@link LnurlErrorDetails} record objects.
5349
+ */
5350
+ export const LnurlErrorDetails = (() => {
5351
+ const defaults = () => ({});
5352
+ const create = (() => {
5353
+ return uniffiCreateRecord<LnurlErrorDetails, ReturnType<typeof defaults>>(
5354
+ defaults
5355
+ );
5356
+ })();
5357
+ return Object.freeze({
5358
+ /**
5359
+ * Create a frozen instance of {@link LnurlErrorDetails}, with defaults specified
5360
+ * in Rust, in the {@link breez_sdk_spark} crate.
5361
+ */
5362
+ create,
5363
+
5364
+ /**
5365
+ * Create a frozen instance of {@link LnurlErrorDetails}, with defaults specified
5366
+ * in Rust, in the {@link breez_sdk_spark} crate.
5367
+ */
5368
+ new: create,
5369
+
5370
+ /**
5371
+ * Defaults specified in the {@link breez_sdk_spark} crate.
5372
+ */
5373
+ defaults: () => Object.freeze(defaults()) as Partial<LnurlErrorDetails>,
5374
+ });
5375
+ })();
5376
+
5377
+ const FfiConverterTypeLnurlErrorDetails = (() => {
5378
+ type TypeName = LnurlErrorDetails;
5379
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
5380
+ read(from: RustBuffer): TypeName {
5381
+ return {
5382
+ reason: FfiConverterString.read(from),
5383
+ };
5384
+ }
5385
+ write(value: TypeName, into: RustBuffer): void {
5386
+ FfiConverterString.write(value.reason, into);
5387
+ }
5388
+ allocationSize(value: TypeName): number {
5389
+ return FfiConverterString.allocationSize(value.reason);
5390
+ }
5391
+ }
5392
+ return new FFIConverter();
5393
+ })();
5394
+
5288
5395
  /**
5289
5396
  * Represents the payment LNURL info
5290
5397
  */
@@ -6146,6 +6253,61 @@ const FfiConverterTypeLogEntry = (() => {
6146
6253
  return new FFIConverter();
6147
6254
  })();
6148
6255
 
6256
+ /**
6257
+ * FFI-safe representation of a 32-byte message digest for ECDSA signing
6258
+ */
6259
+ export type MessageBytes = {
6260
+ bytes: ArrayBuffer;
6261
+ };
6262
+
6263
+ /**
6264
+ * Generated factory for {@link MessageBytes} record objects.
6265
+ */
6266
+ export const MessageBytes = (() => {
6267
+ const defaults = () => ({});
6268
+ const create = (() => {
6269
+ return uniffiCreateRecord<MessageBytes, ReturnType<typeof defaults>>(
6270
+ defaults
6271
+ );
6272
+ })();
6273
+ return Object.freeze({
6274
+ /**
6275
+ * Create a frozen instance of {@link MessageBytes}, with defaults specified
6276
+ * in Rust, in the {@link breez_sdk_spark} crate.
6277
+ */
6278
+ create,
6279
+
6280
+ /**
6281
+ * Create a frozen instance of {@link MessageBytes}, with defaults specified
6282
+ * in Rust, in the {@link breez_sdk_spark} crate.
6283
+ */
6284
+ new: create,
6285
+
6286
+ /**
6287
+ * Defaults specified in the {@link breez_sdk_spark} crate.
6288
+ */
6289
+ defaults: () => Object.freeze(defaults()) as Partial<MessageBytes>,
6290
+ });
6291
+ })();
6292
+
6293
+ const FfiConverterTypeMessageBytes = (() => {
6294
+ type TypeName = MessageBytes;
6295
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
6296
+ read(from: RustBuffer): TypeName {
6297
+ return {
6298
+ bytes: FfiConverterArrayBuffer.read(from),
6299
+ };
6300
+ }
6301
+ write(value: TypeName, into: RustBuffer): void {
6302
+ FfiConverterArrayBuffer.write(value.bytes, into);
6303
+ }
6304
+ allocationSize(value: TypeName): number {
6305
+ return FfiConverterArrayBuffer.allocationSize(value.bytes);
6306
+ }
6307
+ }
6308
+ return new FFIConverter();
6309
+ })();
6310
+
6149
6311
  export type MessageSuccessActionData = {
6150
6312
  message: string;
6151
6313
  };
@@ -12236,6 +12398,149 @@ const FfiConverterTypeKeySetType = (() => {
12236
12398
  return new FFIConverter();
12237
12399
  })();
12238
12400
 
12401
+ // Enum: LnurlCallbackStatus
12402
+ export enum LnurlCallbackStatus_Tags {
12403
+ Ok = 'Ok',
12404
+ ErrorStatus = 'ErrorStatus',
12405
+ }
12406
+ /**
12407
+ * The response from a LNURL-auth callback, indicating success or failure.
12408
+ */
12409
+ export const LnurlCallbackStatus = (() => {
12410
+ type Ok__interface = {
12411
+ tag: LnurlCallbackStatus_Tags.Ok;
12412
+ };
12413
+
12414
+ /**
12415
+ * On-wire format is: `{"status": "OK"}`
12416
+ */
12417
+ class Ok_ extends UniffiEnum implements Ok__interface {
12418
+ /**
12419
+ * @private
12420
+ * This field is private and should not be used, use `tag` instead.
12421
+ */
12422
+ readonly [uniffiTypeNameSymbol] = 'LnurlCallbackStatus';
12423
+ readonly tag = LnurlCallbackStatus_Tags.Ok;
12424
+ constructor() {
12425
+ super('LnurlCallbackStatus', 'Ok');
12426
+ }
12427
+
12428
+ static new(): Ok_ {
12429
+ return new Ok_();
12430
+ }
12431
+
12432
+ static instanceOf(obj: any): obj is Ok_ {
12433
+ return obj.tag === LnurlCallbackStatus_Tags.Ok;
12434
+ }
12435
+ }
12436
+
12437
+ type ErrorStatus__interface = {
12438
+ tag: LnurlCallbackStatus_Tags.ErrorStatus;
12439
+ inner: Readonly<{ errorDetails: LnurlErrorDetails }>;
12440
+ };
12441
+
12442
+ /**
12443
+ * On-wire format is: `{"status": "ERROR", "reason": "error details..."}`
12444
+ */
12445
+ class ErrorStatus_ extends UniffiEnum implements ErrorStatus__interface {
12446
+ /**
12447
+ * @private
12448
+ * This field is private and should not be used, use `tag` instead.
12449
+ */
12450
+ readonly [uniffiTypeNameSymbol] = 'LnurlCallbackStatus';
12451
+ readonly tag = LnurlCallbackStatus_Tags.ErrorStatus;
12452
+ readonly inner: Readonly<{ errorDetails: LnurlErrorDetails }>;
12453
+ constructor(inner: { errorDetails: LnurlErrorDetails }) {
12454
+ super('LnurlCallbackStatus', 'ErrorStatus');
12455
+ this.inner = Object.freeze(inner);
12456
+ }
12457
+
12458
+ static new(inner: { errorDetails: LnurlErrorDetails }): ErrorStatus_ {
12459
+ return new ErrorStatus_(inner);
12460
+ }
12461
+
12462
+ static instanceOf(obj: any): obj is ErrorStatus_ {
12463
+ return obj.tag === LnurlCallbackStatus_Tags.ErrorStatus;
12464
+ }
12465
+ }
12466
+
12467
+ function instanceOf(obj: any): obj is LnurlCallbackStatus {
12468
+ return obj[uniffiTypeNameSymbol] === 'LnurlCallbackStatus';
12469
+ }
12470
+
12471
+ return Object.freeze({
12472
+ instanceOf,
12473
+ Ok: Ok_,
12474
+ ErrorStatus: ErrorStatus_,
12475
+ });
12476
+ })();
12477
+
12478
+ /**
12479
+ * The response from a LNURL-auth callback, indicating success or failure.
12480
+ */
12481
+
12482
+ export type LnurlCallbackStatus = InstanceType<
12483
+ (typeof LnurlCallbackStatus)[keyof Omit<
12484
+ typeof LnurlCallbackStatus,
12485
+ 'instanceOf'
12486
+ >]
12487
+ >;
12488
+
12489
+ // FfiConverter for enum LnurlCallbackStatus
12490
+ const FfiConverterTypeLnurlCallbackStatus = (() => {
12491
+ const ordinalConverter = FfiConverterInt32;
12492
+ type TypeName = LnurlCallbackStatus;
12493
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
12494
+ read(from: RustBuffer): TypeName {
12495
+ switch (ordinalConverter.read(from)) {
12496
+ case 1:
12497
+ return new LnurlCallbackStatus.Ok();
12498
+ case 2:
12499
+ return new LnurlCallbackStatus.ErrorStatus({
12500
+ errorDetails: FfiConverterTypeLnurlErrorDetails.read(from),
12501
+ });
12502
+ default:
12503
+ throw new UniffiInternalError.UnexpectedEnumCase();
12504
+ }
12505
+ }
12506
+ write(value: TypeName, into: RustBuffer): void {
12507
+ switch (value.tag) {
12508
+ case LnurlCallbackStatus_Tags.Ok: {
12509
+ ordinalConverter.write(1, into);
12510
+ return;
12511
+ }
12512
+ case LnurlCallbackStatus_Tags.ErrorStatus: {
12513
+ ordinalConverter.write(2, into);
12514
+ const inner = value.inner;
12515
+ FfiConverterTypeLnurlErrorDetails.write(inner.errorDetails, into);
12516
+ return;
12517
+ }
12518
+ default:
12519
+ // Throwing from here means that LnurlCallbackStatus_Tags hasn't matched an ordinal.
12520
+ throw new UniffiInternalError.UnexpectedEnumCase();
12521
+ }
12522
+ }
12523
+ allocationSize(value: TypeName): number {
12524
+ switch (value.tag) {
12525
+ case LnurlCallbackStatus_Tags.Ok: {
12526
+ return ordinalConverter.allocationSize(1);
12527
+ }
12528
+ case LnurlCallbackStatus_Tags.ErrorStatus: {
12529
+ const inner = value.inner;
12530
+ let size = ordinalConverter.allocationSize(2);
12531
+ size += FfiConverterTypeLnurlErrorDetails.allocationSize(
12532
+ inner.errorDetails
12533
+ );
12534
+ return size;
12535
+ }
12536
+ default:
12537
+ throw new UniffiInternalError.UnexpectedEnumCase();
12538
+ }
12539
+ }
12540
+ }
12541
+ return new FFIConverter();
12542
+ })();
12543
+
12239
12544
  // Enum: MaxFee
12240
12545
  export enum MaxFee_Tags {
12241
12546
  Fixed = 'Fixed',
@@ -18990,6 +19295,59 @@ export interface BreezSdkInterface {
18990
19295
  request: ListUnclaimedDepositsRequest,
18991
19296
  asyncOpts_?: { signal: AbortSignal }
18992
19297
  ): /*throws*/ Promise<ListUnclaimedDepositsResponse>;
19298
+ /**
19299
+ * Performs LNURL-auth with the service.
19300
+ *
19301
+ * This method implements the LNURL-auth protocol as specified in LUD-04 and LUD-05.
19302
+ * It derives a domain-specific linking key, signs the challenge, and sends the
19303
+ * authentication request to the service.
19304
+ *
19305
+ * # Arguments
19306
+ *
19307
+ * * `request_data` - The parsed LNURL-auth request details obtained from [`parse`]
19308
+ *
19309
+ * # Returns
19310
+ *
19311
+ * * `Ok(LnurlCallbackStatus::Ok)` - Authentication was successful
19312
+ * * `Ok(LnurlCallbackStatus::ErrorStatus{reason})` - Service returned an error
19313
+ * * `Err(SdkError)` - An error occurred during the authentication process
19314
+ *
19315
+ * # Example
19316
+ *
19317
+ * ```rust,no_run
19318
+ * # use breez_sdk_spark::{BreezSdk, InputType};
19319
+ * # async fn example(sdk: BreezSdk) -> Result<(), Box<dyn std::error::Error>> {
19320
+ * // 1. Parse the LNURL-auth string
19321
+ * let input = sdk.parse("lnurl1...").await?;
19322
+ * let auth_request = match input {
19323
+ * InputType::LnurlAuth(data) => data,
19324
+ * _ => return Err("Not an auth request".into()),
19325
+ * };
19326
+ *
19327
+ * // 2. Show user the domain and get confirmation
19328
+ * println!("Authenticate with {}?", auth_request.domain);
19329
+ *
19330
+ * // 3. Perform authentication
19331
+ * let status = sdk.lnurl_auth(auth_request).await?;
19332
+ * match status {
19333
+ * breez_sdk_spark::LnurlCallbackStatus::Ok => println!("Success!"),
19334
+ * breez_sdk_spark::LnurlCallbackStatus::ErrorStatus { error_details } => {
19335
+ * println!("Error: {}", error_details.reason)
19336
+ * }
19337
+ * }
19338
+ * # Ok(())
19339
+ * # }
19340
+ * ```
19341
+ *
19342
+ * # See Also
19343
+ *
19344
+ * * LUD-04: <https://github.com/lnurl/luds/blob/luds/04.md>
19345
+ * * LUD-05: <https://github.com/lnurl/luds/blob/luds/05.md>
19346
+ */
19347
+ lnurlAuth(
19348
+ requestData: LnurlAuthRequestDetails,
19349
+ asyncOpts_?: { signal: AbortSignal }
19350
+ ): /*throws*/ Promise<LnurlCallbackStatus>;
18993
19351
  lnurlPay(
18994
19352
  request: LnurlPayRequest,
18995
19353
  asyncOpts_?: { signal: AbortSignal }
@@ -19912,6 +20270,94 @@ export class BreezSdk
19912
20270
  }
19913
20271
  }
19914
20272
 
20273
+ /**
20274
+ * Performs LNURL-auth with the service.
20275
+ *
20276
+ * This method implements the LNURL-auth protocol as specified in LUD-04 and LUD-05.
20277
+ * It derives a domain-specific linking key, signs the challenge, and sends the
20278
+ * authentication request to the service.
20279
+ *
20280
+ * # Arguments
20281
+ *
20282
+ * * `request_data` - The parsed LNURL-auth request details obtained from [`parse`]
20283
+ *
20284
+ * # Returns
20285
+ *
20286
+ * * `Ok(LnurlCallbackStatus::Ok)` - Authentication was successful
20287
+ * * `Ok(LnurlCallbackStatus::ErrorStatus{reason})` - Service returned an error
20288
+ * * `Err(SdkError)` - An error occurred during the authentication process
20289
+ *
20290
+ * # Example
20291
+ *
20292
+ * ```rust,no_run
20293
+ * # use breez_sdk_spark::{BreezSdk, InputType};
20294
+ * # async fn example(sdk: BreezSdk) -> Result<(), Box<dyn std::error::Error>> {
20295
+ * // 1. Parse the LNURL-auth string
20296
+ * let input = sdk.parse("lnurl1...").await?;
20297
+ * let auth_request = match input {
20298
+ * InputType::LnurlAuth(data) => data,
20299
+ * _ => return Err("Not an auth request".into()),
20300
+ * };
20301
+ *
20302
+ * // 2. Show user the domain and get confirmation
20303
+ * println!("Authenticate with {}?", auth_request.domain);
20304
+ *
20305
+ * // 3. Perform authentication
20306
+ * let status = sdk.lnurl_auth(auth_request).await?;
20307
+ * match status {
20308
+ * breez_sdk_spark::LnurlCallbackStatus::Ok => println!("Success!"),
20309
+ * breez_sdk_spark::LnurlCallbackStatus::ErrorStatus { error_details } => {
20310
+ * println!("Error: {}", error_details.reason)
20311
+ * }
20312
+ * }
20313
+ * # Ok(())
20314
+ * # }
20315
+ * ```
20316
+ *
20317
+ * # See Also
20318
+ *
20319
+ * * LUD-04: <https://github.com/lnurl/luds/blob/luds/04.md>
20320
+ * * LUD-05: <https://github.com/lnurl/luds/blob/luds/05.md>
20321
+ */
20322
+ public async lnurlAuth(
20323
+ requestData: LnurlAuthRequestDetails,
20324
+ asyncOpts_?: { signal: AbortSignal }
20325
+ ): Promise<LnurlCallbackStatus> /*throws*/ {
20326
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
20327
+ try {
20328
+ return await uniffiRustCallAsync(
20329
+ /*rustCaller:*/ uniffiCaller,
20330
+ /*rustFutureFunc:*/ () => {
20331
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_auth(
20332
+ uniffiTypeBreezSdkObjectFactory.clonePointer(this),
20333
+ FfiConverterTypeLnurlAuthRequestDetails.lower(requestData)
20334
+ );
20335
+ },
20336
+ /*pollFunc:*/ nativeModule()
20337
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
20338
+ /*cancelFunc:*/ nativeModule()
20339
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
20340
+ /*completeFunc:*/ nativeModule()
20341
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
20342
+ /*freeFunc:*/ nativeModule()
20343
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
20344
+ /*liftFunc:*/ FfiConverterTypeLnurlCallbackStatus.lift.bind(
20345
+ FfiConverterTypeLnurlCallbackStatus
20346
+ ),
20347
+ /*liftString:*/ FfiConverterString.lift,
20348
+ /*asyncOpts:*/ asyncOpts_,
20349
+ /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
20350
+ FfiConverterTypeSdkError
20351
+ )
20352
+ );
20353
+ } catch (__error: any) {
20354
+ if (uniffiIsDebug && __error instanceof Error) {
20355
+ __error.stack = __stack;
20356
+ }
20357
+ throw __error;
20358
+ }
20359
+ }
20360
+
19915
20361
  public async lnurlPay(
19916
20362
  request: LnurlPayRequest,
19917
20363
  asyncOpts_?: { signal: AbortSignal }
@@ -20640,30 +21086,34 @@ export interface ExternalSigner {
20640
21086
  /**
20641
21087
  * Signs a message using ECDSA at the given derivation path.
20642
21088
  *
21089
+ * The message should be a 32-byte digest (typically a hash of the original data).
21090
+ *
20643
21091
  * # Arguments
20644
- * * `message` - The message to sign
21092
+ * * `message` - The 32-byte message digest to sign
20645
21093
  * * `path` - BIP32 derivation path as a string
20646
21094
  *
20647
21095
  * # Returns
20648
21096
  * 64-byte compact ECDSA signature, or a `SignerError`
20649
21097
  */
20650
21098
  signEcdsa(
20651
- message: ArrayBuffer,
21099
+ message: MessageBytes,
20652
21100
  path: string,
20653
21101
  asyncOpts_?: { signal: AbortSignal }
20654
21102
  ): /*throws*/ Promise<EcdsaSignatureBytes>;
20655
21103
  /**
20656
21104
  * Signs a message using recoverable ECDSA at the given derivation path.
20657
21105
  *
21106
+ * The message should be a 32-byte digest (typically a hash of the original data).
21107
+ *
20658
21108
  * # Arguments
20659
- * * `message` - The message to sign (will be double-SHA256 hashed)
21109
+ * * `message` - The 32-byte message digest to sign
20660
21110
  * * `path` - BIP32 derivation path as a string
20661
21111
  *
20662
21112
  * # Returns
20663
21113
  * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError`
20664
21114
  */
20665
21115
  signEcdsaRecoverable(
20666
- message: ArrayBuffer,
21116
+ message: MessageBytes,
20667
21117
  path: string,
20668
21118
  asyncOpts_?: { signal: AbortSignal }
20669
21119
  ): /*throws*/ Promise<RecoverableEcdsaSignatureBytes>;
@@ -20712,6 +21162,21 @@ export interface ExternalSigner {
20712
21162
  path: string,
20713
21163
  asyncOpts_?: { signal: AbortSignal }
20714
21164
  ): /*throws*/ Promise<SchnorrSignatureBytes>;
21165
+ /**
21166
+ * HMAC-SHA256 of a message at the given derivation path.
21167
+ *
21168
+ * # Arguments
21169
+ * * `message` - The message to hash
21170
+ * * `path` - BIP32 derivation path as a string
21171
+ *
21172
+ * # Returns
21173
+ * 32-byte HMAC-SHA256, or a `SignerError`
21174
+ */
21175
+ hmacSha256(
21176
+ message: ArrayBuffer,
21177
+ path: string,
21178
+ asyncOpts_?: { signal: AbortSignal }
21179
+ ): /*throws*/ Promise<HashedMessageBytes>;
20715
21180
  /**
20716
21181
  * Generates Frost signing commitments for multi-party signing.
20717
21182
  *
@@ -20969,15 +21434,17 @@ export class ExternalSignerImpl
20969
21434
  /**
20970
21435
  * Signs a message using ECDSA at the given derivation path.
20971
21436
  *
21437
+ * The message should be a 32-byte digest (typically a hash of the original data).
21438
+ *
20972
21439
  * # Arguments
20973
- * * `message` - The message to sign
21440
+ * * `message` - The 32-byte message digest to sign
20974
21441
  * * `path` - BIP32 derivation path as a string
20975
21442
  *
20976
21443
  * # Returns
20977
21444
  * 64-byte compact ECDSA signature, or a `SignerError`
20978
21445
  */
20979
21446
  public async signEcdsa(
20980
- message: ArrayBuffer,
21447
+ message: MessageBytes,
20981
21448
  path: string,
20982
21449
  asyncOpts_?: { signal: AbortSignal }
20983
21450
  ): Promise<EcdsaSignatureBytes> /*throws*/ {
@@ -20988,7 +21455,7 @@ export class ExternalSignerImpl
20988
21455
  /*rustFutureFunc:*/ () => {
20989
21456
  return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigner_sign_ecdsa(
20990
21457
  uniffiTypeExternalSignerImplObjectFactory.clonePointer(this),
20991
- FfiConverterArrayBuffer.lower(message),
21458
+ FfiConverterTypeMessageBytes.lower(message),
20992
21459
  FfiConverterString.lower(path)
20993
21460
  );
20994
21461
  },
@@ -21020,15 +21487,17 @@ export class ExternalSignerImpl
21020
21487
  /**
21021
21488
  * Signs a message using recoverable ECDSA at the given derivation path.
21022
21489
  *
21490
+ * The message should be a 32-byte digest (typically a hash of the original data).
21491
+ *
21023
21492
  * # Arguments
21024
- * * `message` - The message to sign (will be double-SHA256 hashed)
21493
+ * * `message` - The 32-byte message digest to sign
21025
21494
  * * `path` - BIP32 derivation path as a string
21026
21495
  *
21027
21496
  * # Returns
21028
21497
  * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError`
21029
21498
  */
21030
21499
  public async signEcdsaRecoverable(
21031
- message: ArrayBuffer,
21500
+ message: MessageBytes,
21032
21501
  path: string,
21033
21502
  asyncOpts_?: { signal: AbortSignal }
21034
21503
  ): Promise<RecoverableEcdsaSignatureBytes> /*throws*/ {
@@ -21039,7 +21508,7 @@ export class ExternalSignerImpl
21039
21508
  /*rustFutureFunc:*/ () => {
21040
21509
  return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigner_sign_ecdsa_recoverable(
21041
21510
  uniffiTypeExternalSignerImplObjectFactory.clonePointer(this),
21042
- FfiConverterArrayBuffer.lower(message),
21511
+ FfiConverterTypeMessageBytes.lower(message),
21043
21512
  FfiConverterString.lower(path)
21044
21513
  );
21045
21514
  },
@@ -21221,6 +21690,57 @@ export class ExternalSignerImpl
21221
21690
  }
21222
21691
  }
21223
21692
 
21693
+ /**
21694
+ * HMAC-SHA256 of a message at the given derivation path.
21695
+ *
21696
+ * # Arguments
21697
+ * * `message` - The message to hash
21698
+ * * `path` - BIP32 derivation path as a string
21699
+ *
21700
+ * # Returns
21701
+ * 32-byte HMAC-SHA256, or a `SignerError`
21702
+ */
21703
+ public async hmacSha256(
21704
+ message: ArrayBuffer,
21705
+ path: string,
21706
+ asyncOpts_?: { signal: AbortSignal }
21707
+ ): Promise<HashedMessageBytes> /*throws*/ {
21708
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
21709
+ try {
21710
+ return await uniffiRustCallAsync(
21711
+ /*rustCaller:*/ uniffiCaller,
21712
+ /*rustFutureFunc:*/ () => {
21713
+ return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigner_hmac_sha256(
21714
+ uniffiTypeExternalSignerImplObjectFactory.clonePointer(this),
21715
+ FfiConverterArrayBuffer.lower(message),
21716
+ FfiConverterString.lower(path)
21717
+ );
21718
+ },
21719
+ /*pollFunc:*/ nativeModule()
21720
+ .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer,
21721
+ /*cancelFunc:*/ nativeModule()
21722
+ .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer,
21723
+ /*completeFunc:*/ nativeModule()
21724
+ .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer,
21725
+ /*freeFunc:*/ nativeModule()
21726
+ .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer,
21727
+ /*liftFunc:*/ FfiConverterTypeHashedMessageBytes.lift.bind(
21728
+ FfiConverterTypeHashedMessageBytes
21729
+ ),
21730
+ /*liftString:*/ FfiConverterString.lift,
21731
+ /*asyncOpts:*/ asyncOpts_,
21732
+ /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind(
21733
+ FfiConverterTypeSignerError
21734
+ )
21735
+ );
21736
+ } catch (__error: any) {
21737
+ if (uniffiIsDebug && __error instanceof Error) {
21738
+ __error.stack = __stack;
21739
+ }
21740
+ throw __error;
21741
+ }
21742
+ }
21743
+
21224
21744
  /**
21225
21745
  * Generates Frost signing commitments for multi-party signing.
21226
21746
  *
@@ -21978,7 +22498,7 @@ const uniffiCallbackInterfaceExternalSigner: {
21978
22498
  ): Promise<EcdsaSignatureBytes> => {
21979
22499
  const jsCallback = FfiConverterTypeExternalSigner.lift(uniffiHandle);
21980
22500
  return await jsCallback.signEcdsa(
21981
- FfiConverterArrayBuffer.lift(message),
22501
+ FfiConverterTypeMessageBytes.lift(message),
21982
22502
  FfiConverterString.lift(path),
21983
22503
  { signal }
21984
22504
  );
@@ -22026,7 +22546,7 @@ const uniffiCallbackInterfaceExternalSigner: {
22026
22546
  ): Promise<RecoverableEcdsaSignatureBytes> => {
22027
22547
  const jsCallback = FfiConverterTypeExternalSigner.lift(uniffiHandle);
22028
22548
  return await jsCallback.signEcdsaRecoverable(
22029
- FfiConverterArrayBuffer.lift(message),
22549
+ FfiConverterTypeMessageBytes.lift(message),
22030
22550
  FfiConverterString.lift(path),
22031
22551
  { signal }
22032
22552
  );
@@ -22210,6 +22730,54 @@ const uniffiCallbackInterfaceExternalSigner: {
22210
22730
  );
22211
22731
  return UniffiResult.success(uniffiForeignFuture);
22212
22732
  },
22733
+ hmacSha256: (
22734
+ uniffiHandle: bigint,
22735
+ message: Uint8Array,
22736
+ path: Uint8Array,
22737
+ uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
22738
+ uniffiCallbackData: bigint
22739
+ ) => {
22740
+ const uniffiMakeCall = async (
22741
+ signal: AbortSignal
22742
+ ): Promise<HashedMessageBytes> => {
22743
+ const jsCallback = FfiConverterTypeExternalSigner.lift(uniffiHandle);
22744
+ return await jsCallback.hmacSha256(
22745
+ FfiConverterArrayBuffer.lift(message),
22746
+ FfiConverterString.lift(path),
22747
+ { signal }
22748
+ );
22749
+ };
22750
+ const uniffiHandleSuccess = (returnValue: HashedMessageBytes) => {
22751
+ uniffiFutureCallback(
22752
+ uniffiCallbackData,
22753
+ /* UniffiForeignFutureStructRustBuffer */ {
22754
+ returnValue: FfiConverterTypeHashedMessageBytes.lower(returnValue),
22755
+ callStatus: uniffiCaller.createCallStatus(),
22756
+ }
22757
+ );
22758
+ };
22759
+ const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => {
22760
+ uniffiFutureCallback(
22761
+ uniffiCallbackData,
22762
+ /* UniffiForeignFutureStructRustBuffer */ {
22763
+ returnValue: /*empty*/ new Uint8Array(0),
22764
+ // TODO create callstatus with error.
22765
+ callStatus: { code, errorBuf },
22766
+ }
22767
+ );
22768
+ };
22769
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
22770
+ /*makeCall:*/ uniffiMakeCall,
22771
+ /*handleSuccess:*/ uniffiHandleSuccess,
22772
+ /*handleError:*/ uniffiHandleError,
22773
+ /*isErrorType:*/ SignerError.instanceOf,
22774
+ /*lowerError:*/ FfiConverterTypeSignerError.lower.bind(
22775
+ FfiConverterTypeSignerError
22776
+ ),
22777
+ /*lowerString:*/ FfiConverterString.lower
22778
+ );
22779
+ return UniffiResult.success(uniffiForeignFuture);
22780
+ },
22213
22781
  generateFrostSigningCommitments: (
22214
22782
  uniffiHandle: bigint,
22215
22783
  uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer,
@@ -27977,6 +28545,14 @@ function uniffiEnsureInitialized() {
27977
28545
  'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_unclaimed_deposits'
27978
28546
  );
27979
28547
  }
28548
+ if (
28549
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_auth() !==
28550
+ 37942
28551
+ ) {
28552
+ throw new UniffiInternalError.ApiChecksumMismatch(
28553
+ 'uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_auth'
28554
+ );
28555
+ }
27980
28556
  if (
27981
28557
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_pay() !==
27982
28558
  10147
@@ -28115,7 +28691,7 @@ function uniffiEnsureInitialized() {
28115
28691
  }
28116
28692
  if (
28117
28693
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_sign_ecdsa() !==
28118
- 52291
28694
+ 37648
28119
28695
  ) {
28120
28696
  throw new UniffiInternalError.ApiChecksumMismatch(
28121
28697
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_sign_ecdsa'
@@ -28123,7 +28699,7 @@ function uniffiEnsureInitialized() {
28123
28699
  }
28124
28700
  if (
28125
28701
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_sign_ecdsa_recoverable() !==
28126
- 8564
28702
+ 3107
28127
28703
  ) {
28128
28704
  throw new UniffiInternalError.ApiChecksumMismatch(
28129
28705
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_sign_ecdsa_recoverable'
@@ -28153,9 +28729,17 @@ function uniffiEnsureInitialized() {
28153
28729
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_sign_hash_schnorr'
28154
28730
  );
28155
28731
  }
28732
+ if (
28733
+ nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_hmac_sha256() !==
28734
+ 19799
28735
+ ) {
28736
+ throw new UniffiInternalError.ApiChecksumMismatch(
28737
+ 'uniffi_breez_sdk_spark_checksum_method_externalsigner_hmac_sha256'
28738
+ );
28739
+ }
28156
28740
  if (
28157
28741
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_generate_frost_signing_commitments() !==
28158
- 24826
28742
+ 24833
28159
28743
  ) {
28160
28744
  throw new UniffiInternalError.ApiChecksumMismatch(
28161
28745
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_generate_frost_signing_commitments'
@@ -28163,7 +28747,7 @@ function uniffiEnsureInitialized() {
28163
28747
  }
28164
28748
  if (
28165
28749
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_get_public_key_for_node() !==
28166
- 32818
28750
+ 62425
28167
28751
  ) {
28168
28752
  throw new UniffiInternalError.ApiChecksumMismatch(
28169
28753
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_get_public_key_for_node'
@@ -28171,7 +28755,7 @@ function uniffiEnsureInitialized() {
28171
28755
  }
28172
28756
  if (
28173
28757
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_generate_random_key() !==
28174
- 22789
28758
+ 21363
28175
28759
  ) {
28176
28760
  throw new UniffiInternalError.ApiChecksumMismatch(
28177
28761
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_generate_random_key'
@@ -28179,7 +28763,7 @@ function uniffiEnsureInitialized() {
28179
28763
  }
28180
28764
  if (
28181
28765
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_get_static_deposit_private_key_source() !==
28182
- 37751
28766
+ 61352
28183
28767
  ) {
28184
28768
  throw new UniffiInternalError.ApiChecksumMismatch(
28185
28769
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_get_static_deposit_private_key_source'
@@ -28187,7 +28771,7 @@ function uniffiEnsureInitialized() {
28187
28771
  }
28188
28772
  if (
28189
28773
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_get_static_deposit_private_key() !==
28190
- 55375
28774
+ 57038
28191
28775
  ) {
28192
28776
  throw new UniffiInternalError.ApiChecksumMismatch(
28193
28777
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_get_static_deposit_private_key'
@@ -28195,7 +28779,7 @@ function uniffiEnsureInitialized() {
28195
28779
  }
28196
28780
  if (
28197
28781
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_get_static_deposit_public_key() !==
28198
- 49264
28782
+ 47081
28199
28783
  ) {
28200
28784
  throw new UniffiInternalError.ApiChecksumMismatch(
28201
28785
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_get_static_deposit_public_key'
@@ -28203,7 +28787,7 @@ function uniffiEnsureInitialized() {
28203
28787
  }
28204
28788
  if (
28205
28789
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_subtract_private_keys() !==
28206
- 46671
28790
+ 63060
28207
28791
  ) {
28208
28792
  throw new UniffiInternalError.ApiChecksumMismatch(
28209
28793
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_subtract_private_keys'
@@ -28211,7 +28795,7 @@ function uniffiEnsureInitialized() {
28211
28795
  }
28212
28796
  if (
28213
28797
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_split_secret() !==
28214
- 840
28798
+ 22937
28215
28799
  ) {
28216
28800
  throw new UniffiInternalError.ApiChecksumMismatch(
28217
28801
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_split_secret'
@@ -28219,7 +28803,7 @@ function uniffiEnsureInitialized() {
28219
28803
  }
28220
28804
  if (
28221
28805
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_encrypt_private_key_for_receiver() !==
28222
- 42476
28806
+ 52786
28223
28807
  ) {
28224
28808
  throw new UniffiInternalError.ApiChecksumMismatch(
28225
28809
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_encrypt_private_key_for_receiver'
@@ -28227,7 +28811,7 @@ function uniffiEnsureInitialized() {
28227
28811
  }
28228
28812
  if (
28229
28813
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_get_public_key_from_private_key_source() !==
28230
- 38684
28814
+ 58178
28231
28815
  ) {
28232
28816
  throw new UniffiInternalError.ApiChecksumMismatch(
28233
28817
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_get_public_key_from_private_key_source'
@@ -28235,7 +28819,7 @@ function uniffiEnsureInitialized() {
28235
28819
  }
28236
28820
  if (
28237
28821
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_sign_frost() !==
28238
- 1497
28822
+ 44847
28239
28823
  ) {
28240
28824
  throw new UniffiInternalError.ApiChecksumMismatch(
28241
28825
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_sign_frost'
@@ -28243,7 +28827,7 @@ function uniffiEnsureInitialized() {
28243
28827
  }
28244
28828
  if (
28245
28829
  nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigner_aggregate_frost_signatures() !==
28246
- 26523
28830
+ 61746
28247
28831
  ) {
28248
28832
  throw new UniffiInternalError.ApiChecksumMismatch(
28249
28833
  'uniffi_breez_sdk_spark_checksum_method_externalsigner_aggregate_frost_signatures'
@@ -28730,6 +29314,7 @@ export default Object.freeze({
28730
29314
  FfiConverterTypeGetPaymentResponse,
28731
29315
  FfiConverterTypeGetTokensMetadataRequest,
28732
29316
  FfiConverterTypeGetTokensMetadataResponse,
29317
+ FfiConverterTypeHashedMessageBytes,
28733
29318
  FfiConverterTypeIdentifierCommitmentPair,
28734
29319
  FfiConverterTypeIdentifierPublicKeyPair,
28735
29320
  FfiConverterTypeIdentifierSignaturePair,
@@ -28746,6 +29331,8 @@ export default Object.freeze({
28746
29331
  FfiConverterTypeListUnclaimedDepositsRequest,
28747
29332
  FfiConverterTypeListUnclaimedDepositsResponse,
28748
29333
  FfiConverterTypeLnurlAuthRequestDetails,
29334
+ FfiConverterTypeLnurlCallbackStatus,
29335
+ FfiConverterTypeLnurlErrorDetails,
28749
29336
  FfiConverterTypeLnurlPayInfo,
28750
29337
  FfiConverterTypeLnurlPayRequest,
28751
29338
  FfiConverterTypeLnurlPayRequestDetails,
@@ -28759,6 +29346,7 @@ export default Object.freeze({
28759
29346
  FfiConverterTypeLocalizedName,
28760
29347
  FfiConverterTypeLogEntry,
28761
29348
  FfiConverterTypeMaxFee,
29349
+ FfiConverterTypeMessageBytes,
28762
29350
  FfiConverterTypeMessageSuccessActionData,
28763
29351
  FfiConverterTypeMintIssuerTokenRequest,
28764
29352
  FfiConverterTypeNetwork,