@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.
@@ -30,19 +30,50 @@ export declare function connect(request: ConnectRequest, asyncOpts_?: {
30
30
  export declare function connectWithSigner(request: ConnectWithSignerRequest, asyncOpts_?: {
31
31
  signal: AbortSignal;
32
32
  }): Promise<BreezSdkInterface>;
33
+ /**
34
+ * Connects to the Spark network using a signing-only external signer.
35
+ *
36
+ * Use this instead of [`connect_with_signer`] for a signer that can't perform
37
+ * the SDK's local ECIES/HMAC operations (for example a policy-restricted
38
+ * enclave). The SDK keeps session tokens in plaintext and disables the features
39
+ * that rely on ECIES/HMAC.
40
+ *
41
+ * # Arguments
42
+ *
43
+ * * `request` - The connection request object with a signing-only external signer
44
+ *
45
+ * # Returns
46
+ *
47
+ * Result containing either the initialized `BreezSdk` or an `SdkError`
48
+ */
49
+ export declare function connectWithSigningOnlySigner(request: ConnectWithSigningOnlySignerRequest, asyncOpts_?: {
50
+ signal: AbortSignal;
51
+ }): Promise<BreezSdkInterface>;
33
52
  /**
34
53
  * Builds the Turnkey-backed Breez and Spark signers from `config`, sharing one
35
54
  * Turnkey client.
36
55
  *
37
56
  * The Spark signer keeps every signing operation in the Turnkey enclave; the
38
57
  * Breez signer does too, except ECIES and HMAC, which run locally against a
39
- * dedicated, non-Spark key exported once here. Exporting a non-Spark key keeps
40
- * every Spark key (the identity key included) in the enclave; ECIES/HMAC only
41
- * need a stable key, not a Spark one.
58
+ * dedicated, non-Spark key exported on first use (see `TurnkeyBreezSigner`).
59
+ * Exporting a non-Spark key keeps every Spark key (the identity key included)
60
+ * in the enclave; ECIES/HMAC only need a stable key, not a Spark one.
61
+ *
62
+ * For a wallet under a deny-export policy, use
63
+ * [`create_turnkey_signing_only_signer`] instead: it never exports a key.
42
64
  */
43
65
  export declare function createTurnkeySigner(config: TurnkeyConfig, asyncOpts_?: {
44
66
  signal: AbortSignal;
45
67
  }): Promise<ExternalSigners>;
68
+ /**
69
+ * Builds signing-only Turnkey-backed signers from `config`, for a wallet under
70
+ * a deny-export policy. The Breez half performs signing only and never exports
71
+ * a key, so no ECIES/HMAC is attempted. Pair with
72
+ * [`connect_with_signing_only_signer`](crate::connect_with_signing_only_signer).
73
+ */
74
+ export declare function createTurnkeySigningOnlySigner(config: TurnkeyConfig, asyncOpts_?: {
75
+ signal: AbortSignal;
76
+ }): Promise<SigningOnlyExternalSigners>;
46
77
  /**
47
78
  * Wraps a caller-supplied [`Storage`] implementation as a [`StorageBackend`].
48
79
  * The tree, token-output and session stores use the in-memory defaults.
@@ -1151,6 +1182,46 @@ export declare const ConnectWithSignerRequest: Readonly<{
1151
1182
  */
1152
1183
  defaults: () => Partial<ConnectWithSignerRequest>;
1153
1184
  }>;
1185
+ /**
1186
+ * Request object for connecting to the Spark network using a signing-only
1187
+ * external signer.
1188
+ *
1189
+ * Use this instead of [`ConnectWithSignerRequest`] for a signer that can't
1190
+ * perform the SDK's local ECIES/HMAC operations (for example a
1191
+ * policy-restricted enclave). The SDK keeps session tokens in plaintext and
1192
+ * disables the features that rely on ECIES/HMAC.
1193
+ */
1194
+ export type ConnectWithSigningOnlySignerRequest = {
1195
+ config: Config;
1196
+ /**
1197
+ * Signing-only external signer for non-Spark SDK signing.
1198
+ */
1199
+ breezSigner: ExternalSigningSigner;
1200
+ /**
1201
+ * External high-level Spark signer for the Spark wallet flows.
1202
+ */
1203
+ sparkSigner: ExternalSparkSigner;
1204
+ storageDir: string;
1205
+ };
1206
+ /**
1207
+ * Generated factory for {@link ConnectWithSigningOnlySignerRequest} record objects.
1208
+ */
1209
+ export declare const ConnectWithSigningOnlySignerRequest: Readonly<{
1210
+ /**
1211
+ * Create a frozen instance of {@link ConnectWithSigningOnlySignerRequest}, with defaults specified
1212
+ * in Rust, in the {@link breez_sdk_spark} crate.
1213
+ */
1214
+ create: (partial: Partial<ConnectWithSigningOnlySignerRequest> & Required<Omit<ConnectWithSigningOnlySignerRequest, never>>) => ConnectWithSigningOnlySignerRequest;
1215
+ /**
1216
+ * Create a frozen instance of {@link ConnectWithSigningOnlySignerRequest}, with defaults specified
1217
+ * in Rust, in the {@link breez_sdk_spark} crate.
1218
+ */
1219
+ new: (partial: Partial<ConnectWithSigningOnlySignerRequest> & Required<Omit<ConnectWithSigningOnlySignerRequest, never>>) => ConnectWithSigningOnlySignerRequest;
1220
+ /**
1221
+ * Defaults specified in the {@link breez_sdk_spark} crate.
1222
+ */
1223
+ defaults: () => Partial<ConnectWithSigningOnlySignerRequest>;
1224
+ }>;
1154
1225
  /**
1155
1226
  * A contact entry containing a name and payment identifier.
1156
1227
  */
@@ -5425,6 +5496,40 @@ export declare const SignMessageResponse: Readonly<{
5425
5496
  */
5426
5497
  defaults: () => Partial<SignMessageResponse>;
5427
5498
  }>;
5499
+ /**
5500
+ * A signing-only external signer paired with the Spark signer, for wallets that
5501
+ * connect via [`connect_with_signing_only_signer`]. The Breez half performs
5502
+ * signing only, without the SDK's local ECIES/HMAC operations.
5503
+ */
5504
+ export type SigningOnlyExternalSigners = {
5505
+ /**
5506
+ * Signing-only external signer for non-Spark SDK signing.
5507
+ */
5508
+ breezSigner: ExternalSigningSigner;
5509
+ /**
5510
+ * External high-level Spark signer for the Spark wallet flows.
5511
+ */
5512
+ sparkSigner: ExternalSparkSigner;
5513
+ };
5514
+ /**
5515
+ * Generated factory for {@link SigningOnlyExternalSigners} record objects.
5516
+ */
5517
+ export declare const SigningOnlyExternalSigners: Readonly<{
5518
+ /**
5519
+ * Create a frozen instance of {@link SigningOnlyExternalSigners}, with defaults specified
5520
+ * in Rust, in the {@link breez_sdk_spark} crate.
5521
+ */
5522
+ create: (partial: Partial<SigningOnlyExternalSigners> & Required<Omit<SigningOnlyExternalSigners, never>>) => SigningOnlyExternalSigners;
5523
+ /**
5524
+ * Create a frozen instance of {@link SigningOnlyExternalSigners}, with defaults specified
5525
+ * in Rust, in the {@link breez_sdk_spark} crate.
5526
+ */
5527
+ new: (partial: Partial<SigningOnlyExternalSigners> & Required<Omit<SigningOnlyExternalSigners, never>>) => SigningOnlyExternalSigners;
5528
+ /**
5529
+ * Defaults specified in the {@link breez_sdk_spark} crate.
5530
+ */
5531
+ defaults: () => Partial<SigningOnlyExternalSigners>;
5532
+ }>;
5428
5533
  export type SilentPaymentAddressDetails = {
5429
5534
  address: string;
5430
5535
  network: BitcoinNetwork;
@@ -15715,6 +15820,7 @@ export declare enum SignerError_Tags {
15715
15820
  Signing = "Signing",
15716
15821
  Encryption = "Encryption",
15717
15822
  Decryption = "Decryption",
15823
+ EncryptionUnavailable = "EncryptionUnavailable",
15718
15824
  Frost = "Frost",
15719
15825
  InvalidInput = "InvalidInput",
15720
15826
  Generic = "Generic"
@@ -16008,6 +16114,77 @@ export declare const SignerError: Readonly<{
16008
16114
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
16009
16115
  stackTraceLimit: number;
16010
16116
  };
16117
+ EncryptionUnavailable: {
16118
+ new (v0: string): {
16119
+ readonly tag: SignerError_Tags.EncryptionUnavailable;
16120
+ readonly inner: Readonly<[string]>;
16121
+ /**
16122
+ * @private
16123
+ * This field is private and should not be used, use `tag` instead.
16124
+ */
16125
+ readonly [uniffiTypeNameSymbol]: "SignerError";
16126
+ name: string;
16127
+ message: string;
16128
+ stack?: string;
16129
+ cause?: unknown;
16130
+ };
16131
+ "new"(v0: string): {
16132
+ readonly tag: SignerError_Tags.EncryptionUnavailable;
16133
+ readonly inner: Readonly<[string]>;
16134
+ /**
16135
+ * @private
16136
+ * This field is private and should not be used, use `tag` instead.
16137
+ */
16138
+ readonly [uniffiTypeNameSymbol]: "SignerError";
16139
+ name: string;
16140
+ message: string;
16141
+ stack?: string;
16142
+ cause?: unknown;
16143
+ };
16144
+ instanceOf(obj: any): obj is {
16145
+ readonly tag: SignerError_Tags.EncryptionUnavailable;
16146
+ readonly inner: Readonly<[string]>;
16147
+ /**
16148
+ * @private
16149
+ * This field is private and should not be used, use `tag` instead.
16150
+ */
16151
+ readonly [uniffiTypeNameSymbol]: "SignerError";
16152
+ name: string;
16153
+ message: string;
16154
+ stack?: string;
16155
+ cause?: unknown;
16156
+ };
16157
+ hasInner(obj: any): obj is {
16158
+ readonly tag: SignerError_Tags.EncryptionUnavailable;
16159
+ readonly inner: Readonly<[string]>;
16160
+ /**
16161
+ * @private
16162
+ * This field is private and should not be used, use `tag` instead.
16163
+ */
16164
+ readonly [uniffiTypeNameSymbol]: "SignerError";
16165
+ name: string;
16166
+ message: string;
16167
+ stack?: string;
16168
+ cause?: unknown;
16169
+ };
16170
+ getInner(obj: {
16171
+ readonly tag: SignerError_Tags.EncryptionUnavailable;
16172
+ readonly inner: Readonly<[string]>;
16173
+ /**
16174
+ * @private
16175
+ * This field is private and should not be used, use `tag` instead.
16176
+ */
16177
+ readonly [uniffiTypeNameSymbol]: "SignerError";
16178
+ name: string;
16179
+ message: string;
16180
+ stack?: string;
16181
+ cause?: unknown;
16182
+ }): Readonly<[string]>;
16183
+ isError(error: unknown): error is Error;
16184
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
16185
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
16186
+ stackTraceLimit: number;
16187
+ };
16011
16188
  Frost: {
16012
16189
  new (v0: string): {
16013
16190
  readonly tag: SignerError_Tags.Frost;
@@ -18544,6 +18721,151 @@ export declare class ExternalBreezSignerImpl extends UniffiAbstractObject implem
18544
18721
  uniffiDestroy(): void;
18545
18722
  static instanceOf(obj: any): obj is ExternalBreezSignerImpl;
18546
18723
  }
18724
+ /**
18725
+ * External signer that provides signing only, without the SDK's local
18726
+ * ECIES/HMAC operations.
18727
+ *
18728
+ * Implement this instead of [`ExternalBreezSigner`] for a signer that can't
18729
+ * release key material for local encryption (for example a policy-restricted
18730
+ * enclave). The capability is declared by the type: the SDK keeps session
18731
+ * tokens in plaintext and the features that rely on ECIES/HMAC are unavailable.
18732
+ */
18733
+ export interface ExternalSigningSigner {
18734
+ /**
18735
+ * Derives a public key for the given BIP32 derivation path.
18736
+ *
18737
+ * # Arguments
18738
+ * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0")
18739
+ *
18740
+ * # Returns
18741
+ * The derived public key as 33 bytes, or a `SignerError`
18742
+ *
18743
+ * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation)
18744
+ */
18745
+ derivePublicKey(path: string, asyncOpts_?: {
18746
+ signal: AbortSignal;
18747
+ }): Promise<PublicKeyBytes>;
18748
+ /**
18749
+ * Signs a message using ECDSA at the given derivation path.
18750
+ *
18751
+ * The message should be a 32-byte digest (typically a hash of the original data).
18752
+ *
18753
+ * # Arguments
18754
+ * * `message` - The 32-byte message digest to sign
18755
+ * * `path` - BIP32 derivation path as a string
18756
+ *
18757
+ * # Returns
18758
+ * 64-byte compact ECDSA signature, or a `SignerError`
18759
+ */
18760
+ signEcdsa(message: MessageBytes, path: string, asyncOpts_?: {
18761
+ signal: AbortSignal;
18762
+ }): Promise<EcdsaSignatureBytes>;
18763
+ /**
18764
+ * Signs a message using recoverable ECDSA at the given derivation path.
18765
+ *
18766
+ * The message should be a 32-byte digest (typically a hash of the original data).
18767
+ *
18768
+ * # Arguments
18769
+ * * `message` - The 32-byte message digest to sign
18770
+ * * `path` - BIP32 derivation path as a string
18771
+ *
18772
+ * # Returns
18773
+ * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError`
18774
+ */
18775
+ signEcdsaRecoverable(message: MessageBytes, path: string, asyncOpts_?: {
18776
+ signal: AbortSignal;
18777
+ }): Promise<RecoverableEcdsaSignatureBytes>;
18778
+ /**
18779
+ * Signs a hash using Schnorr signature at the given derivation path.
18780
+ *
18781
+ * # Arguments
18782
+ * * `hash` - The 32-byte hash to sign (must be 32 bytes)
18783
+ * * `path` - BIP32 derivation path as a string
18784
+ *
18785
+ * # Returns
18786
+ * 64-byte Schnorr signature, or a `SignerError`
18787
+ */
18788
+ signHashSchnorr(hash: ArrayBuffer, path: string, asyncOpts_?: {
18789
+ signal: AbortSignal;
18790
+ }): Promise<SchnorrSignatureBytes>;
18791
+ }
18792
+ /**
18793
+ * External signer that provides signing only, without the SDK's local
18794
+ * ECIES/HMAC operations.
18795
+ *
18796
+ * Implement this instead of [`ExternalBreezSigner`] for a signer that can't
18797
+ * release key material for local encryption (for example a policy-restricted
18798
+ * enclave). The capability is declared by the type: the SDK keeps session
18799
+ * tokens in plaintext and the features that rely on ECIES/HMAC are unavailable.
18800
+ */
18801
+ export declare class ExternalSigningSignerImpl extends UniffiAbstractObject implements ExternalSigningSigner {
18802
+ readonly [uniffiTypeNameSymbol] = "ExternalSigningSignerImpl";
18803
+ readonly [destructorGuardSymbol]: UniffiRustArcPtr;
18804
+ readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
18805
+ private constructor();
18806
+ /**
18807
+ * Derives a public key for the given BIP32 derivation path.
18808
+ *
18809
+ * # Arguments
18810
+ * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0")
18811
+ *
18812
+ * # Returns
18813
+ * The derived public key as 33 bytes, or a `SignerError`
18814
+ *
18815
+ * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation)
18816
+ */
18817
+ derivePublicKey(path: string, asyncOpts_?: {
18818
+ signal: AbortSignal;
18819
+ }): Promise<PublicKeyBytes>;
18820
+ /**
18821
+ * Signs a message using ECDSA at the given derivation path.
18822
+ *
18823
+ * The message should be a 32-byte digest (typically a hash of the original data).
18824
+ *
18825
+ * # Arguments
18826
+ * * `message` - The 32-byte message digest to sign
18827
+ * * `path` - BIP32 derivation path as a string
18828
+ *
18829
+ * # Returns
18830
+ * 64-byte compact ECDSA signature, or a `SignerError`
18831
+ */
18832
+ signEcdsa(message: MessageBytes, path: string, asyncOpts_?: {
18833
+ signal: AbortSignal;
18834
+ }): Promise<EcdsaSignatureBytes>;
18835
+ /**
18836
+ * Signs a message using recoverable ECDSA at the given derivation path.
18837
+ *
18838
+ * The message should be a 32-byte digest (typically a hash of the original data).
18839
+ *
18840
+ * # Arguments
18841
+ * * `message` - The 32-byte message digest to sign
18842
+ * * `path` - BIP32 derivation path as a string
18843
+ *
18844
+ * # Returns
18845
+ * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError`
18846
+ */
18847
+ signEcdsaRecoverable(message: MessageBytes, path: string, asyncOpts_?: {
18848
+ signal: AbortSignal;
18849
+ }): Promise<RecoverableEcdsaSignatureBytes>;
18850
+ /**
18851
+ * Signs a hash using Schnorr signature at the given derivation path.
18852
+ *
18853
+ * # Arguments
18854
+ * * `hash` - The 32-byte hash to sign (must be 32 bytes)
18855
+ * * `path` - BIP32 derivation path as a string
18856
+ *
18857
+ * # Returns
18858
+ * 64-byte Schnorr signature, or a `SignerError`
18859
+ */
18860
+ signHashSchnorr(hash: ArrayBuffer, path: string, asyncOpts_?: {
18861
+ signal: AbortSignal;
18862
+ }): Promise<SchnorrSignatureBytes>;
18863
+ /**
18864
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
18865
+ */
18866
+ uniffiDestroy(): void;
18867
+ static instanceOf(obj: any): obj is ExternalSigningSignerImpl;
18868
+ }
18547
18869
  /**
18548
18870
  * FFI-compatible mirror of `spark_wallet::SparkSigner`.
18549
18871
  */
@@ -19421,6 +19743,19 @@ export declare class SdkBuilder extends UniffiAbstractObject implements SdkBuild
19421
19743
  * - `spark_signer`: External high-level Spark signer for the Spark wallet.
19422
19744
  */
19423
19745
  static newWithSigner(config: Config, breezSigner: ExternalBreezSigner, sparkSigner: ExternalSparkSigner): SdkBuilderInterface;
19746
+ /**
19747
+ * Creates a new `SdkBuilder` with a signing-only external signer.
19748
+ *
19749
+ * Use this for a signer that can't perform the SDK's local ECIES/HMAC
19750
+ * operations (for example a policy-restricted enclave). The SDK keeps
19751
+ * session tokens in plaintext and disables the features that rely on
19752
+ * ECIES/HMAC.
19753
+ * Arguments:
19754
+ * - `config`: The configuration to be used.
19755
+ * - `breez_signer`: Signing-only external signer for non-Spark SDK signing.
19756
+ * - `spark_signer`: External high-level Spark signer for the Spark wallet.
19757
+ */
19758
+ static newWithSigningOnlySigner(config: Config, breezSigner: ExternalSigningSigner, sparkSigner: ExternalSparkSigner): SdkBuilderInterface;
19424
19759
  /**
19425
19760
  * Builds the `BreezSdk` instance with the configured components.
19426
19761
  */
@@ -20674,6 +21009,13 @@ declare const _default: Readonly<{
20674
21009
  lift(value: UniffiByteArray): ConnectWithSignerRequest;
20675
21010
  lower(value: ConnectWithSignerRequest): UniffiByteArray;
20676
21011
  };
21012
+ FfiConverterTypeConnectWithSigningOnlySignerRequest: {
21013
+ read(from: RustBuffer): ConnectWithSigningOnlySignerRequest;
21014
+ write(value: ConnectWithSigningOnlySignerRequest, into: RustBuffer): void;
21015
+ allocationSize(value: ConnectWithSigningOnlySignerRequest): number;
21016
+ lift(value: UniffiByteArray): ConnectWithSigningOnlySignerRequest;
21017
+ lower(value: ConnectWithSigningOnlySignerRequest): UniffiByteArray;
21018
+ };
20677
21019
  FfiConverterTypeContact: {
20678
21020
  read(from: RustBuffer): Contact;
20679
21021
  write(value: Contact, into: RustBuffer): void;
@@ -21102,6 +21444,7 @@ declare const _default: Readonly<{
21102
21444
  lift(value: UniffiByteArray): ExternalSigningCommitments;
21103
21445
  lower(value: ExternalSigningCommitments): UniffiByteArray;
21104
21446
  };
21447
+ FfiConverterTypeExternalSigningSigner: FfiConverterObjectWithCallbacks<ExternalSigningSigner>;
21105
21448
  FfiConverterTypeExternalSparkInvoiceKind: {
21106
21449
  read(from: RustBuffer): ExternalSparkInvoiceKind;
21107
21450
  write(value: ExternalSparkInvoiceKind, into: RustBuffer): void;
@@ -21996,6 +22339,13 @@ declare const _default: Readonly<{
21996
22339
  lift(value: UniffiByteArray): SignerError;
21997
22340
  lower(value: SignerError): UniffiByteArray;
21998
22341
  };
22342
+ FfiConverterTypeSigningOnlyExternalSigners: {
22343
+ read(from: RustBuffer): SigningOnlyExternalSigners;
22344
+ write(value: SigningOnlyExternalSigners, into: RustBuffer): void;
22345
+ allocationSize(value: SigningOnlyExternalSigners): number;
22346
+ lift(value: UniffiByteArray): SigningOnlyExternalSigners;
22347
+ lower(value: SigningOnlyExternalSigners): UniffiByteArray;
22348
+ };
21999
22349
  FfiConverterTypeSilentPaymentAddressDetails: {
22000
22350
  read(from: RustBuffer): SilentPaymentAddressDetails;
22001
22351
  write(value: SilentPaymentAddressDetails, into: RustBuffer): void;