@breeztech/breez-sdk-spark-react-native 0.15.1 → 0.16.1-dev1

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.
Files changed (29) hide show
  1. package/cpp/generated/breez_sdk_spark.cpp +4947 -2629
  2. package/cpp/generated/breez_sdk_spark.hpp +257 -110
  3. package/lib/commonjs/generated/breez_sdk_spark-ffi.js.map +1 -1
  4. package/lib/commonjs/generated/breez_sdk_spark.js +1304 -580
  5. package/lib/commonjs/generated/breez_sdk_spark.js.map +1 -1
  6. package/lib/commonjs/passkey-prf-provider.js +300 -0
  7. package/lib/commonjs/passkey-prf-provider.js.map +1 -0
  8. package/lib/module/generated/breez_sdk_spark-ffi.js.map +1 -1
  9. package/lib/module/generated/breez_sdk_spark.js +1304 -580
  10. package/lib/module/generated/breez_sdk_spark.js.map +1 -1
  11. package/lib/module/passkey-prf-provider.js +293 -0
  12. package/lib/module/passkey-prf-provider.js.map +1 -0
  13. package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts +199 -140
  14. package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
  15. package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts +6149 -3695
  16. package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts.map +1 -1
  17. package/lib/typescript/commonjs/src/passkey-prf-provider.d.ts +135 -0
  18. package/lib/typescript/commonjs/src/passkey-prf-provider.d.ts.map +1 -0
  19. package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts +199 -140
  20. package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
  21. package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts +6149 -3695
  22. package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts.map +1 -1
  23. package/lib/typescript/module/src/passkey-prf-provider.d.ts +135 -0
  24. package/lib/typescript/module/src/passkey-prf-provider.d.ts.map +1 -0
  25. package/package.json +17 -5
  26. package/scripts/post-ubrn.js +227 -0
  27. package/src/generated/breez_sdk_spark-ffi.ts +366 -198
  28. package/src/generated/breez_sdk_spark.ts +12343 -7056
  29. package/src/passkey-prf-provider.ts +372 -0
@@ -0,0 +1,135 @@
1
+ import { PasskeyClient as SdkPasskeyClient, PasskeyProviderOptions, type PasskeyConfig, type PrfProvider } from './generated/breez_sdk_spark';
2
+ /**
3
+ * A passkey credential from a register or sign-in ceremony. `credentialId`
4
+ * is always set; the attestation fields are populated on registration and
5
+ * absent on sign-in (an assertion carries no attestation). Persist
6
+ * `credentialId` to drive `excludeCredentials` / `allowCredentials` on later
7
+ * calls. Treat `aaguid` as an unverified display hint, never a trust decision.
8
+ * `userId` is the user handle minted by the native plugin (never host-supplied).
9
+ */
10
+ export interface PasskeyCredential {
11
+ credentialId: Uint8Array;
12
+ userId: Uint8Array | null;
13
+ aaguid: Uint8Array | null;
14
+ backupEligible: boolean | null;
15
+ }
16
+ /**
17
+ * Result of {@link PasskeyProvider.checkDomainAssociation}. Switch on `kind`
18
+ * to handle each outcome.
19
+ */
20
+ export type DomainAssociation = {
21
+ kind: 'Associated';
22
+ } | {
23
+ kind: 'NotAssociated';
24
+ source: string;
25
+ reason: string;
26
+ } | {
27
+ kind: 'Skipped';
28
+ reason: string;
29
+ };
30
+ /**
31
+ * Error thrown when a passkey operation fails, with a structured `code` for
32
+ * programmatic handling: `userCancelled`, `userTimedOut`, `prfNotSupported`,
33
+ * `noCredential`, `configuration`, `credentialAlreadyExists`, `unknown`.
34
+ * `userTimedOut` is the OS biometric inactivity timeout (distinct from the
35
+ * user dismissing the prompt), so hosts may safely auto-retry it.
36
+ */
37
+ export declare class PasskeyPrfException extends Error {
38
+ readonly code: string;
39
+ constructor(code: string, message: string);
40
+ }
41
+ /**
42
+ * Built-in React Native passkey PRF provider, backed by AuthenticationServices
43
+ * on iOS and Credential Manager on Android. The default {@link PrfProvider};
44
+ * inject a configured instance through {@link PasskeyClientBuilder}. Requires
45
+ * iOS 18+ or Android 14+ (API 34) plus the Associated Domains entitlement
46
+ * (iOS) or assetlinks.json (Android) for the RP domain.
47
+ */
48
+ export declare class PasskeyProvider {
49
+ /**
50
+ * Breez's shared `keys.breez.technology` RP. Pass as `rpId` to opt in
51
+ * (only valid for apps registered with Breez); apps with their own RP
52
+ * domain pass their own string.
53
+ */
54
+ static readonly BREEZ_RP_ID: string;
55
+ /** Default `rpName` for the zero-config client when none is supplied. */
56
+ static readonly DEFAULT_RP_NAME: string;
57
+ private rpId;
58
+ private rpName;
59
+ private userName;
60
+ private userDisplayName;
61
+ constructor(options: PasskeyProviderOptions);
62
+ /**
63
+ * Derive one 32-byte seed per salt from passkey PRF, in as few OS prompts
64
+ * as the platform supports. `allowCredentials` restricts the assertion to
65
+ * specific credential IDs (mainly for reauthentication) when non-empty;
66
+ * `preferImmediatelyAvailableCredentials` overrides the platform default
67
+ * when set. Returns the seeds plus the asserted credential ID.
68
+ */
69
+ deriveSeeds(request: {
70
+ salts: string[];
71
+ allowCredentials?: Uint8Array[];
72
+ preferImmediatelyAvailableCredentials?: boolean | null;
73
+ }): Promise<{
74
+ seeds: Uint8Array[];
75
+ credentialId?: Uint8Array;
76
+ }>;
77
+ /**
78
+ * Register a new PRF-capable passkey (one prompt, no seed derivation): use
79
+ * it to split credential creation from derivation in multi-step onboarding.
80
+ * `excludeCredentials` blocks re-registering a device that already holds a
81
+ * credential, surfaced as a `credentialAlreadyExists` failure. The returned
82
+ * user handle is minted fresh per call (never host-supplied).
83
+ */
84
+ createPasskey(excludeCredentials?: Uint8Array[]): Promise<PasskeyCredential>;
85
+ /** Whether this device supports passkeys with the PRF extension. */
86
+ isSupported(): Promise<boolean>;
87
+ /**
88
+ * Verify the app is associated with the configured `rpId` for WebAuthn.
89
+ * Android always returns `Skipped` rather than `NotAssociated`: Credential
90
+ * Manager runs its own check internally against fresher data.
91
+ */
92
+ checkDomainAssociation(): Promise<DomainAssociation>;
93
+ }
94
+ /**
95
+ * Builds a `PasskeyClient` backed by a caller-supplied provider. Use this
96
+ * for a custom PRF backend; omit the provider for the zero-config Breez-RP
97
+ * default and set `providerOptions` on the config to use your own RP.
98
+ */
99
+ export declare class PasskeyClientBuilder {
100
+ private readonly breezApiKey?;
101
+ private readonly config?;
102
+ private provider?;
103
+ /**
104
+ * @param breezApiKey Breez relay key for authenticated (NIP-42) label
105
+ * storage. Omit for public relays only.
106
+ * @param config Passkey client config. `providerOptions` configures the
107
+ * default provider (ignored when a provider is injected via
108
+ * {@link withPrfProvider}, which owns its RP); `defaultLabel` is the
109
+ * label-store default.
110
+ */
111
+ constructor(breezApiKey?: string | undefined, config?: PasskeyConfig | undefined);
112
+ /**
113
+ * Inject the provider the client derives seeds through: the built-in
114
+ * {@link PasskeyProvider} or any custom `PrfProvider` implementation.
115
+ * Supersedes the config's `providerOptions` (the injected provider owns
116
+ * its RP).
117
+ */
118
+ withPrfProvider(provider: PrfProvider): this;
119
+ /**
120
+ * Construct the client. Falls back to a default {@link PasskeyProvider}
121
+ * on the config's `providerOptions` (default: the Breez RP) when no
122
+ * provider was injected.
123
+ */
124
+ build(): SdkPasskeyClient;
125
+ }
126
+ /**
127
+ * Zero-config passkey client on the Breez shared RP (`keys.breez.technology`),
128
+ * so a Breez-registered app needs only its relay key; set `providerOptions` on
129
+ * the config to use your own RP. For a custom PRF backend, build the provider
130
+ * and inject it via {@link PasskeyClientBuilder}.
131
+ */
132
+ export declare const PasskeyClient: {
133
+ new (breezApiKey?: string, config?: PasskeyConfig): SdkPasskeyClient;
134
+ };
135
+ //# sourceMappingURL=passkey-prf-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey-prf-provider.d.ts","sourceRoot":"","sources":["../../../../src/passkey-prf-provider.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,IAAI,gBAAgB,EACjC,sBAAsB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,6BAA6B,CAAC;AAwCrC;;;;;;;GAOG;AACH,MAAM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