biometry-react-components 3.0.0 → 3.0.1
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 +13 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +290 -221
- package/dist/index.js +290 -221
- package/package.json +3 -7
package/README.md
CHANGED
|
@@ -172,9 +172,19 @@ import { VoiceRecorder, type VoiceEnrollment } from 'biometry-react-components';
|
|
|
172
172
|
function Enroll() {
|
|
173
173
|
// Fires once, after the last take is confirmed.
|
|
174
174
|
const handleConfirm = async ({ files, phrases }: VoiceEnrollment) => {
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
|
|
175
|
+
// Send every take to your backend; a partial set is worse than none.
|
|
176
|
+
// phrases[i] was spoken in files[i].
|
|
177
|
+
const form = new FormData();
|
|
178
|
+
files.forEach((file) => form.append('voice', file));
|
|
179
|
+
form.append('phrases', phrases.join(','));
|
|
180
|
+
// await fetch('/your-backend/enroll-voice', { method: 'POST', body: form });
|
|
181
|
+
//
|
|
182
|
+
// Your backend makes ONE call to POST /v2/enrollments/voice with its own
|
|
183
|
+
// token: the takes as repeated `voice` parts, plus a `request` part such as
|
|
184
|
+
// {"user_id": "<the signed-in user, from your session>",
|
|
185
|
+
// "phrase": "<the phrases joined by commas, in file order>"}.
|
|
186
|
+
// Never take user_id from the browser, or anyone can enroll their voice
|
|
187
|
+
// under another user's id.
|
|
178
188
|
};
|
|
179
189
|
|
|
180
190
|
return <VoiceRecorder onConfirmRecording={handleConfirm} />;
|
package/dist/index.d.ts
CHANGED
|
@@ -238,8 +238,9 @@ declare const useRecorder: (stream: MediaStream | null, type: "audio" | "video",
|
|
|
238
238
|
interface UsePermissionsProps {
|
|
239
239
|
rectWidth?: number;
|
|
240
240
|
rectHeight?: number;
|
|
241
|
+
audio?: boolean;
|
|
241
242
|
}
|
|
242
|
-
declare const usePermissions: ({ rectWidth, rectHeight }?: UsePermissionsProps) => {
|
|
243
|
+
declare const usePermissions: ({ rectWidth, rectHeight, audio }?: UsePermissionsProps) => {
|
|
243
244
|
permission: boolean;
|
|
244
245
|
stream: MediaStream | null;
|
|
245
246
|
stopStreamTracks: () => void;
|