@yeomessagingcom/react-native-yeofr 0.1.12 → 0.1.14

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.
package/README.md CHANGED
@@ -6,4 +6,30 @@ iOS face recognition bridge for React Native (device-only).
6
6
  ## Install
7
7
  ```bash
8
8
  npm i @yeomessaging/react-native-yeofr
9
- cd ios && pod install && cd ..
9
+ cd ios && pod install && cd ..
10
+ ```
11
+
12
+ ## Bumping npm module version:
13
+ 1. update s.version in podspec with the new version number
14
+ 2. update "version" in package.json with the new version number
15
+
16
+ if need to update SPM version that is used for framework asset:
17
+ 1. update bin_ver in podspec
18
+ 2. update sha256 with checksum from spm in podspec
19
+
20
+ ## Publishing:
21
+ 1. deprecate previous version (if required) (NB 0.1.11 is an example):
22
+ ```bash
23
+ npm deprecate @yeomessagingcom/react-native-yeofr@0.1.11 "Deprecated"
24
+ ```
25
+
26
+ 2. tag with lastest version (NB 0.1.12 is an example - use the real next version of the nom module):
27
+ ```bash
28
+ git tag 0.1.12
29
+ git push --tags
30
+ ```
31
+
32
+ 3. publish
33
+ ```bash
34
+ npm publish --access public
35
+ ```
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>YEOFR.framework/YEOFR</string>
10
+ <key>LibraryIdentifier</key>
11
+ <string>ios-arm64</string>
12
+ <key>LibraryPath</key>
13
+ <string>YEOFR.framework</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ </array>
18
+ <key>SupportedPlatform</key>
19
+ <string>ios</string>
20
+ </dict>
21
+ </array>
22
+ <key>CFBundlePackageType</key>
23
+ <string>XFWK</string>
24
+ <key>XCFrameworkFormatVersion</key>
25
+ <string>1.0</string>
26
+ </dict>
27
+ </plist>
@@ -0,0 +1,18 @@
1
+ //
2
+ // YEOFR.h
3
+ // YEOFR
4
+ //
5
+ // Created by paul calver on 22/08/2025.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ //! Project version number for YEOFR.
11
+ FOUNDATION_EXPORT double YEOFRVersionNumber;
12
+
13
+ //! Project version string for YEOFR.
14
+ FOUNDATION_EXPORT const unsigned char YEOFRVersionString[];
15
+
16
+ // In this header, you should import all the public headers of your framework using statements like #import <YEOFR/PublicHeader.h>
17
+
18
+ #import <YEOFR/YEOFRBridge.h>
@@ -0,0 +1,261 @@
1
+ //
2
+ // YEOFRBridge.h
3
+ // YEOFR
4
+ //
5
+ // Created by paul calver on 02/09/2025.
6
+ //
7
+
8
+
9
+ //#ifndef YEOFRBridge_h
10
+ //#define YEOFRBridge_h
11
+ //
12
+ //
13
+ //#endif /* YEOFRBridge_h */
14
+
15
+ #import <Foundation/Foundation.h>
16
+
17
+ NS_ASSUME_NONNULL_BEGIN
18
+
19
+ FOUNDATION_EXPORT NSErrorDomain const FRSDKErrorDomain;
20
+
21
+ typedef NS_ENUM(NSInteger, FRSDKReturnCode) {
22
+ FRSDKReturnCodeOK = 0,
23
+ FRSDKReturnCodeFailed = -1,
24
+ FRSDKReturnCodeNotActivated = -2,
25
+ FRSDKReturnCodeOutOfMemory = -3,
26
+ FRSDKReturnCodeInvalidArgument = -4,
27
+ FRSDKReturnCodeIOError = -5,
28
+ FRSDKReturnCodeImageTooSmall = -6,
29
+ FRSDKReturnCodeFaceNotFound = -7,
30
+ FRSDKReturnCodeInsufficientBufferSize = -8,
31
+ FRSDKReturnCodeUnsupportedImageExtension = -9,
32
+ FRSDKReturnCodeCannotOpenFile = -10,
33
+ FRSDKReturnCodeCannotCreateFile = -11,
34
+ FRSDKReturnCodeBadFileFormat = -12,
35
+ FRSDKReturnCodeFileNotFound = -13,
36
+ FRSDKReturnCodeConnectionClosed = -14,
37
+ FRSDKReturnCodeConnectionFailed = -15,
38
+ FRSDKReturnCodeIPInitFailed = -16,
39
+ FRSDKReturnCodeNeedServerActivation = -17,
40
+ FRSDKReturnCodeIdNotFound = -18,
41
+ FRSDKReturnCodeAttributeNotDetected = -19,
42
+ FRSDKReturnCodeInsufficientTrackerMemoryLimit = -20,
43
+ FRSDKReturnCodeUnknownAttribute = -21,
44
+ FRSDKReturnCodeUnsupportedFileVersion = -22,
45
+ FRSDKReturnCodeSyntaxError = -23,
46
+ FRSDKReturnCodeParameterNotFound = -24,
47
+ FRSDKReturnCodeInvalidTemplate = -25,
48
+ FRSDKReturnCodeUnsupportedTemplateVersion = -26,
49
+ FRSDKReturnCodeCameraIndexDoesNotExist = -27,
50
+ FRSDKReturnCodePlatformNotLicensed = -28,
51
+ FRSDKReturnCodeTensorflowNotInitialized = -29,
52
+ FRSDKReturnCodePluginNotLoaded = -30,
53
+ FRSDKReturnCodePluginNoPermission = -31,
54
+ FRSDKReturnCodeTrackerIsNull = -32,
55
+ FRSDKReturnCodeBufferSizeInvalid = -33,
56
+ FRSDKReturnCodeTrackerBufferMallocFailed = -34,
57
+ FRSDKReturnCodeOutTrackerNull = -35,
58
+ FRSDKReturnCodeEmptyTrackerData = -36,
59
+ FRSDKReturnCodeSetParametersFailed = -37,
60
+ FRSDKReturnCodeTrackerExists = -38,
61
+ };
62
+
63
+ @interface YEOFRBridge : NSObject
64
+
65
+ + (NSString *)stringForReturnCode:(FRSDKReturnCode)rc;
66
+ /// ---------------------------------------------------------------------
67
+ /// @name SDK Activation / Queries
68
+ /// ---------------------------------------------------------------------
69
+
70
+ /// Activate and initialize the SDK.
71
+ ///
72
+ /// @param key License/activation key provided by the vendor.
73
+ /// @param dataPath Optional path to SDK data/resources (pass `nil` if not required by your build).
74
+ /// @param error Populated on failure with an NSError describing the underlying SDK error.
75
+ ///
76
+ /// @return FRSDKReturnCode.
77
+ ///
78
+ /// @discussion Call this once during app startup (before using any tracker APIs).
79
+ + (FRSDKReturnCode)activateWithKey:(NSString *)key
80
+ dataPath:(NSString * _Nullable)dataPath
81
+ error:(NSError * _Nullable * _Nullable)error;
82
+
83
+ /// Get a device hardware identifier from the SDK (smoke test).
84
+ ///
85
+ /// @param outHardwareID On success, receives a hardware ID string. Nil on failure.
86
+ /// @param error Populated on failure with an NSError describing the SDK error.
87
+ ///
88
+ /// @return FRSDKReturnCode.
89
+ + (FRSDKReturnCode)getHardwareID:(NSString * __autoreleasing _Nullable * _Nullable)outHardwareID
90
+ error:(NSError * _Nullable * _Nullable)error;
91
+
92
+ /// Retrieve license information from the SDK (optional).
93
+ ///
94
+ /// @param outLicenseInfo On success, receives a human-readable license string. Nil on failure.
95
+ /// @param error Populated on failure with an NSError describing the SDK error.
96
+ ///
97
+ /// @return FRSDKReturnCode.
98
+ + (FRSDKReturnCode)getLicenseInfo:(NSString * __autoreleasing _Nullable * _Nullable)outLicenseInfo
99
+ error:(NSError * _Nullable * _Nullable)error;
100
+
101
+ /// ---------------------------------------------------------------------
102
+ /// @name Frame Processing
103
+ /// ---------------------------------------------------------------------
104
+
105
+ /// Process a single ARGB32 frame through the SDK pipeline.
106
+ ///
107
+ /// Steps performed:
108
+ /// 1. Load image from buffer
109
+ /// 2. Mirror image horizontally
110
+ /// 3. Feed tracker
111
+ /// 4. Retrieve names per ID
112
+ /// 5. (Optional) Estimate face rect from tracker eyes
113
+ ///
114
+ /// @param buffer Pointer to ARGB32 pixel data (compatible with FSDK_LoadImageFromBuffer).
115
+ /// @param width Frame width in pixels.
116
+ /// @param height Frame height in pixels.
117
+ /// @param scanLine Bytes per row (stride).
118
+ /// @param tracker Tracker handle (`HTracker`) as `int64_t`.
119
+ /// @param needFaceRect If YES, computes face rects (additional per-face call).
120
+ /// @param ratio Scale factor to apply to rects (mirrors your Swift `imageFrameParameters.ratio`).
121
+ /// @param outIDs On success, receives an NSArray<NSNumber*> of face IDs (Int64).
122
+ /// @param outNames On success, receives an NSDictionary<NSNumber*, NSString*> mapping ID → name (empty string or absence means not enrolled).
123
+ /// @param outRects On success, receives an NSDictionary<NSNumber*, NSValue(CGRect)> mapping ID → face rect (image coordinates).
124
+ /// @param outDetectedCount On success, receives the number of detected faces.
125
+ /// @param error Populated on failure with an NSError describing the SDK error.
126
+ ///
127
+ /// @return FRSDKReturnCode.
128
+ ///
129
+ /// @note The `buffer` memory is owned by the caller and must remain valid for the call duration.
130
+ + (FRSDKReturnCode)processFrameWithBuffer:(const void *)buffer
131
+ width:(int)width
132
+ height:(int)height
133
+ scanLine:(int)scanLine
134
+ tracker:(int64_t)tracker
135
+ needFaceRect:(BOOL)needFaceRect
136
+ ratio:(float)ratio
137
+ outIDs:(NSArray<NSNumber *> * __autoreleasing _Nullable * _Nullable)outIDs
138
+ outNames:(NSDictionary<NSNumber *, NSString *> * __autoreleasing _Nullable * _Nullable)outNames
139
+ outRects:(NSDictionary<NSNumber *, NSValue *> * __autoreleasing _Nullable * _Nullable)outRects
140
+ outDetectedCount:(NSInteger * _Nullable)outDetectedCount
141
+ error:(NSError * __autoreleasing _Nullable * _Nullable)error;
142
+
143
+ /// ---------------------------------------------------------------------
144
+ /// @name Tracker Lifecycle
145
+ /// ---------------------------------------------------------------------
146
+
147
+ /// Create a new tracker.
148
+ ///
149
+ /// @param outTracker On success, receives the newly created tracker handle (`HTracker` as `int64_t`).
150
+ /// @param error Populated on failure with an NSError describing the SDK error.
151
+ ///
152
+ /// @return FRSDKReturnCode.
153
+ + (FRSDKReturnCode)createTracker:(int64_t * _Nonnull)outTracker
154
+ error:(NSError * _Nullable * _Nullable)error;
155
+
156
+ /// Free a tracker.
157
+ ///
158
+ /// @param tracker Tracker handle to free (`HTracker` as `int64_t`). If 0, this is a no-op.
159
+ /// @param error Populated on unexpected failure (usually unused; SDK free often returns void).
160
+ ///
161
+ /// @return FRSDKReturnCode.
162
+ + (FRSDKReturnCode)freeTracker:(int64_t)tracker
163
+ error:(NSError * _Nullable * _Nullable)error;
164
+
165
+ /// ---------------------------------------------------------------------
166
+ /// @name Enrollment
167
+ /// ---------------------------------------------------------------------
168
+
169
+ /// Assign a name (tag) to a face ID in the tracker.
170
+ ///
171
+ /// @param tracker Tracker handle (`HTracker` as `int64_t`).
172
+ /// @param faceID Face ID to name.
173
+ /// @param name Display name/tag to assign. Empty string may be treated as removal by the SDK.
174
+ /// @param error Populated on failure with an NSError describing the SDK error.
175
+ ///
176
+ /// @return FRSDKReturnCode.
177
+ ///
178
+ /// @note Typical flow: `LockID` → `SetName` → (optional) `LearnCurrentFace` → `UnlockID`.
179
+ + (FRSDKReturnCode)setName:(int64_t)tracker
180
+ faceID:(long long)faceID
181
+ name:(NSString *)name
182
+ error:(NSError * _Nullable * _Nullable)error;
183
+
184
+ /// Learn/improve the current face template (optional helper).
185
+ ///
186
+ /// @param tracker Tracker handle (`HTracker` as `int64_t`).
187
+ /// @param error Populated on failure with an NSError describing the SDK error.
188
+ ///
189
+ /// @return FRSDKReturnCode
190
+ + (FRSDKReturnCode)learnCurrentFace:(int64_t)tracker
191
+ error:(NSError * _Nullable * _Nullable)error;
192
+
193
+ /// ---------------------------------------------------------------------
194
+ /// @name Tracker (Memory) Serialization
195
+ /// ---------------------------------------------------------------------
196
+
197
+ /// Get the current tracker as an in-memory blob.
198
+ ///
199
+ /// @param tracker Tracker handle (`HTracker` as `int64_t`).
200
+ /// @param outData On success, receives NSData containing the serialized tracker.
201
+ /// @param error Populated on failure with an NSError describing the SDK error.
202
+ ///
203
+ /// @return FRSDKReturnCode.
204
+ ///
205
+ /// @discussion Use this to persist the tracker (e.g., write `outData` to file or upload).
206
+ + (FRSDKReturnCode)getTrackerData:(int64_t)tracker
207
+ outData:(NSData * _Nullable * _Nullable)outData
208
+ error:(NSError * _Nullable * _Nullable)error;
209
+
210
+ /// Load a tracker from an in-memory blob.
211
+ ///
212
+ /// @param data NSData previously obtained from `getTrackerData:outData:error:`.
213
+ /// @param outTracker On success, receives a new tracker handle (`HTracker` as `int64_t`).
214
+ /// @param error Populated on failure with an NSError describing the SDK error.
215
+ ///
216
+ /// @return FRSDKReturnCode.
217
+ ///
218
+ /// @note The caller is responsible for freeing any previously held tracker before swapping in the returned handle.
219
+ + (FRSDKReturnCode)loadTrackerFromData:(NSData *)data
220
+ outTracker:(int64_t * _Nonnull)outTracker
221
+ error:(NSError * _Nullable * _Nullable)error;
222
+
223
+ /// ---------------------------------------------------------------------
224
+ /// @name Tracker / Global Configuration
225
+ /// ---------------------------------------------------------------------
226
+
227
+ /// Apply tracker parameters from an FRSDK-formatted parameter string.
228
+ ///
229
+ /// @param tracker Tracker handle (`HTracker` as `int64_t`).
230
+ /// @param params Parameter string (same format as `config.asTrackerParameters`).
231
+ /// @param outErrPos Receives the 1-based position of the first error in the string; 0 on success.
232
+ /// @param error If `outErrPos != 0`, also populated with a descriptive NSError.
233
+ ///
234
+ /// @return FRSDKReturnCode.
235
+ ///
236
+ /// @discussion Wraps `FSDK_SetTrackerMultipleParameters`. Useful to atomically set multiple
237
+ /// parameters; check `outErrPos` for the failing position if NO is returned.
238
+ + (FRSDKReturnCode)setTrackerParameters:(int64_t)tracker
239
+ paramsUTF8:(NSString *)params
240
+ outErrorPosition:(int32_t * _Nullable)outErrPos
241
+ error:(NSError * _Nullable * _Nullable)error;
242
+
243
+ /// Configure global SDK parameters.
244
+ ///
245
+ /// @param threads Number of threads for the SDK to use.
246
+ /// @param resizeWidth Internal resize width for detection (see vendor docs).
247
+ /// @param threshold Detection threshold (higher is stricter).
248
+ /// @param error Populated on failure with an NSError describing the SDK error.
249
+ ///
250
+ /// @return FRSDKReturnCode.
251
+ ///
252
+ /// @discussion Applies common global knobs such as thread count and detection parameters.
253
+ /// Call this early (e.g., after activation) and whenever configuration changes.
254
+ + (FRSDKReturnCode)configureWithThreads:(int32_t)threads
255
+ internalResizeWidth:(int32_t)resizeWidth
256
+ detectionThreshold:(int32_t)threshold
257
+ error:(NSError * _Nullable * _Nullable)error;
258
+
259
+ @end
260
+
261
+ NS_ASSUME_NONNULL_END