@seams/voiceid 0.26.0 → 0.28.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.
- package/README.md +37 -3
- package/dist/esm/browser/microphoneInput.js +13 -0
- package/dist/esm/capture/prompt.js +41 -2
- package/dist/esm/descriptor.js +5 -2
- package/dist/public/sdk/voiceid/CITRINET_LICENSE.txt +395 -0
- package/dist/public/sdk/voiceid/NOTICE.txt +19 -2
- package/dist/public/sdk/voiceid/addVoiceId-Dbd-PwWG.js +1 -0
- package/dist/public/sdk/voiceid/approval-C4KlEQYu.js +1 -0
- package/dist/public/sdk/voiceid/citrinet-int8.onnx +0 -0
- package/dist/public/sdk/voiceid/{deviceBridge-DDviNxL6.js → deviceBridge-DQLPNdC8.js} +1 -1
- package/dist/public/sdk/voiceid/enrollment-DPOYb36Z.js +1 -0
- package/dist/public/sdk/voiceid/host.js +2 -2
- package/dist/public/sdk/voiceid/prompt-vztg41jG.js +614 -0
- package/dist/public/sdk/voiceid/unlock-Da49yYxd.js +1 -0
- package/dist/types/activation/addVoiceId.d.ts +2 -1
- package/dist/types/activation/manageEnrollment.d.ts +2 -1
- package/dist/types/browser/enrollment.d.ts +3 -2
- package/dist/types/browser/inference.d.ts +5 -0
- package/dist/types/browser/microphone.d.ts +6 -6
- package/dist/types/browser/microphoneInput.d.ts +27 -0
- package/dist/types/browser/model.d.ts +1 -1
- package/dist/types/browser/phrase.d.ts +5 -2
- package/dist/types/browser/phraseTokens.d.ts +2 -0
- package/dist/types/browser/phraseVocabulary.d.ts +3 -3
- package/dist/types/browser/progress.d.ts +2 -1
- package/dist/types/capture/approval.d.ts +5 -2
- package/dist/types/capture/bridge.d.ts +2 -1
- package/dist/types/capture/deviceBridge.d.ts +7 -4
- package/dist/types/capture/prompt.d.ts +4 -0
- package/dist/types/descriptor.d.ts +5 -2
- package/dist/types/host.d.ts +3 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/session/activation.d.ts +2 -2
- package/dist/types/session/unlock.d.ts +2 -1
- package/dist/types/session/unlockFromDevice.d.ts +2 -2
- package/package.json +2 -2
- package/src/README.md +26 -16
- package/dist/public/sdk/voiceid/addVoiceId-Bz9BDPI4.js +0 -1
- package/dist/public/sdk/voiceid/approval-CME3DxNc.js +0 -1
- package/dist/public/sdk/voiceid/enrollment-D8oQnM_e.js +0 -1
- package/dist/public/sdk/voiceid/prompt-DEkI70F2.js +0 -606
- package/dist/public/sdk/voiceid/unlock-CGnhhdt4.js +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @seams/voiceid
|
|
2
2
|
|
|
3
|
-
Optional browser VoiceID authentication for `@seams/wallet` 0.
|
|
3
|
+
Optional browser VoiceID authentication for `@seams/wallet` 0.27.0.
|
|
4
4
|
This package owns microphone capture, enrollment, local inference, voice UI,
|
|
5
5
|
and the model/runtime assets. The Wallet SDK owns custody, sessions, signing,
|
|
6
6
|
and the trusted host API. Existing voice enrollments keep their storage identity.
|
|
@@ -17,10 +17,25 @@ const config = defineSeamsConfig({
|
|
|
17
17
|
walletOrigin,
|
|
18
18
|
relayerUrl,
|
|
19
19
|
publishableKey,
|
|
20
|
-
authMethods: [voiceIdAuthMethod()],
|
|
20
|
+
authMethods: [voiceIdAuthMethod({ transcriptionModel: 'citrinet' })],
|
|
21
21
|
});
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
Choose `transcriptionModel: 'aurora'` for the smaller speech model. Citrinet is
|
|
25
|
+
the default when this option is omitted. The choice applies to enrollment,
|
|
26
|
+
unlock, and transaction approval. Each action keeps its chosen model throughout
|
|
27
|
+
preparation and recording.
|
|
28
|
+
|
|
29
|
+
| Speech model | Uncompressed | Gzip |
|
|
30
|
+
| --- | ---: | ---: |
|
|
31
|
+
| Citrinet INT8 | 10.48 MB | 8.84 MB |
|
|
32
|
+
| Aurora INT8 | 1.34 MB | 1.02 MB |
|
|
33
|
+
|
|
34
|
+
Both models ship with this package. The browser downloads only the selected
|
|
35
|
+
speech model, plus the shared speaker model, speech detector, and inference
|
|
36
|
+
engine. Each model has its own integrity-checked cache. Changing the speech
|
|
37
|
+
model preserves saved speaker samples and verification thresholds.
|
|
38
|
+
|
|
24
39
|
The root entry contains only the descriptor. Importing it or enabling it does not
|
|
25
40
|
load capture code, ONNX Runtime, or models. The selected VoiceID action starts
|
|
26
41
|
loading in the trusted Wallet iframe. Passkey and Email OTP flows remain independent.
|
|
@@ -97,7 +112,26 @@ One cumulative indicator covers the engine WASM and three models. It then shows
|
|
|
97
112
|
**Preparing VoiceID…** until inference is ready. Downloaded assets are checked by
|
|
98
113
|
length and SHA-256 before use. Browser cache retention is best effort.
|
|
99
114
|
|
|
100
|
-
|
|
115
|
+
Interrupted downloads receive one automatic retry. A stalled download times out
|
|
116
|
+
after 30 seconds without progress. Further failures show **Retry loading** in the
|
|
117
|
+
same card. Retry keeps verified assets and voice enrollment. Close the card to
|
|
118
|
+
choose a passkey instead. A missing or incompatible host package requires an
|
|
119
|
+
operator fix; other module failures include connection and reload instructions.
|
|
120
|
+
|
|
121
|
+
Transaction reviews prepare VoiceID before enabling **Confirm with VoiceID**.
|
|
122
|
+
The voice attempt timer starts after that click. The transaction's expiry remains
|
|
123
|
+
in force while loading or retrying, so an expired transaction needs a fresh review.
|
|
124
|
+
|
|
125
|
+
VoiceID remembers the microphone used for usable audio in this browser. Enrollment,
|
|
126
|
+
unlock, and signing request that input even when the system default changes.
|
|
127
|
+
If it is unavailable, VoiceID can use the current default. Reconnecting the saved
|
|
128
|
+
microphone restores it. Interrupted recordings require a new attempt. Voice
|
|
129
|
+
enrollment and verification thresholds stay unchanged.
|
|
130
|
+
Choose **Use system microphone** on the retry prompt to switch inputs. The next
|
|
131
|
+
Record click uses the system default and remembers it after usable audio.
|
|
132
|
+
|
|
133
|
+
The cold payload before transfer compression is roughly 27 MB with Aurora or
|
|
134
|
+
36 MB with Citrinet.
|
|
101
135
|
Splitting it removes that payload from Wallet-only installations. It does not
|
|
102
136
|
reduce the bytes needed for the first VoiceID operation.
|
|
103
137
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IndexedDBManager } from "@seams/wallet/voiceid-host";
|
|
2
|
+
//#region src/browser/microphoneInput.ts
|
|
3
|
+
const PREFERENCE_KEY = "voiceid-microphone-v1";
|
|
4
|
+
async function useSystemVoiceMicrophone() {
|
|
5
|
+
await savePreference({ kind: "system_default" });
|
|
6
|
+
}
|
|
7
|
+
async function savePreference(selected) {
|
|
8
|
+
try {
|
|
9
|
+
await IndexedDBManager.setAppState(PREFERENCE_KEY, selected);
|
|
10
|
+
} catch {}
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useSystemVoiceMicrophone };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VoiceVisual } from "./visual.js";
|
|
2
|
+
import { useSystemVoiceMicrophone } from "../browser/microphoneInput.js";
|
|
2
3
|
import { createCspStylesheetManager, getDefaultCspNonce } from "@seams/wallet/voiceid-host";
|
|
3
4
|
//#region src/capture/prompt.ts
|
|
4
5
|
const CSS = `
|
|
@@ -11,7 +12,7 @@ const CSS = `
|
|
|
11
12
|
margin: 0 auto;
|
|
12
13
|
padding: 3.5rem 1.5rem 1.5rem;
|
|
13
14
|
display: grid;
|
|
14
|
-
grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) 5rem;
|
|
15
|
+
grid-template-rows: auto minmax(6rem, auto) 5rem minmax(3.375rem, auto) minmax(5rem, auto);
|
|
15
16
|
border: 1px solid var(--seams-colors-borderPrimary, #303b41);
|
|
16
17
|
border-radius: var(--seams-shape-card, 16px);
|
|
17
18
|
background: var(--seams-colors-colorBackground, #192024);
|
|
@@ -285,6 +286,14 @@ const CSS = `
|
|
|
285
286
|
opacity: 0.5;
|
|
286
287
|
cursor: wait;
|
|
287
288
|
}
|
|
289
|
+
.seams-voiceid-prompt .seams-voiceid-microphone {
|
|
290
|
+
margin-top: 0.5rem;
|
|
291
|
+
padding: 0.25rem;
|
|
292
|
+
border: 0;
|
|
293
|
+
background: transparent;
|
|
294
|
+
color: var(--seams-colors-textSecondary, #9cabb3);
|
|
295
|
+
font-size: 0.75rem;
|
|
296
|
+
}
|
|
288
297
|
.seams-voiceid-prompt button[hidden],
|
|
289
298
|
.seams-voiceid-prompt [hidden] {
|
|
290
299
|
display: none !important;
|
|
@@ -323,6 +332,8 @@ var VoicePrompt = class {
|
|
|
323
332
|
record;
|
|
324
333
|
cancel;
|
|
325
334
|
progress;
|
|
335
|
+
microphone;
|
|
336
|
+
microphoneRequested = false;
|
|
326
337
|
visual;
|
|
327
338
|
disposed = false;
|
|
328
339
|
constructor(document, label, phrase, checking = "ring") {
|
|
@@ -375,7 +386,13 @@ var VoicePrompt = class {
|
|
|
375
386
|
this.progress.className = "seams-voiceid-progress-slot";
|
|
376
387
|
const slot = document.createElement("div");
|
|
377
388
|
slot.className = "seams-voiceid-record-slot";
|
|
378
|
-
|
|
389
|
+
this.microphone = document.createElement("button");
|
|
390
|
+
this.microphone.type = "button";
|
|
391
|
+
this.microphone.className = "seams-voiceid-microphone";
|
|
392
|
+
this.microphone.textContent = "Use system microphone";
|
|
393
|
+
this.microphone.hidden = true;
|
|
394
|
+
this.microphone.addEventListener("click", this.changeMicrophone);
|
|
395
|
+
slot.append(this.record, this.microphone);
|
|
379
396
|
this.element.append(this.visual.glow, this.cancel, this.title, this.phrase, this.visual.element, this.status, slot, this.progress);
|
|
380
397
|
}
|
|
381
398
|
setPhrase(phrase) {
|
|
@@ -386,7 +403,12 @@ var VoicePrompt = class {
|
|
|
386
403
|
capture = (event) => {
|
|
387
404
|
if (this.disposed) return;
|
|
388
405
|
switch (event.kind) {
|
|
406
|
+
case "opening":
|
|
407
|
+
this.microphoneRequested = true;
|
|
408
|
+
this.microphone.hidden = true;
|
|
409
|
+
return;
|
|
389
410
|
case "listening":
|
|
411
|
+
this.microphone.hidden = true;
|
|
390
412
|
delete this.status.dataset.voiceCaptureQuality;
|
|
391
413
|
this.element.dataset.capture = "listening";
|
|
392
414
|
this.record.hidden = true;
|
|
@@ -423,6 +445,7 @@ var VoicePrompt = class {
|
|
|
423
445
|
if (this.disposed) return;
|
|
424
446
|
this.element.dataset.capture = "succeeded";
|
|
425
447
|
this.record.hidden = true;
|
|
448
|
+
this.microphone.hidden = true;
|
|
426
449
|
await this.visual.succeed(this.beginSuccess.bind(this, headline, message, area));
|
|
427
450
|
}
|
|
428
451
|
ready(message) {
|
|
@@ -432,9 +455,25 @@ var VoicePrompt = class {
|
|
|
432
455
|
this.status.textContent = message;
|
|
433
456
|
this.record.hidden = false;
|
|
434
457
|
this.record.disabled = false;
|
|
458
|
+
this.microphone.hidden = !this.microphoneRequested;
|
|
459
|
+
}
|
|
460
|
+
changeMicrophone = () => {
|
|
461
|
+
this.useSystemMicrophone();
|
|
462
|
+
};
|
|
463
|
+
async useSystemMicrophone() {
|
|
464
|
+
this.record.disabled = true;
|
|
465
|
+
this.microphone.disabled = true;
|
|
466
|
+
await useSystemVoiceMicrophone();
|
|
467
|
+
if (this.disposed) return;
|
|
468
|
+
this.status.textContent = "The next recording will use your system microphone.";
|
|
469
|
+
this.record.disabled = false;
|
|
470
|
+
this.microphone.disabled = false;
|
|
471
|
+
this.microphone.hidden = true;
|
|
472
|
+
this.record.focus();
|
|
435
473
|
}
|
|
436
474
|
dispose() {
|
|
437
475
|
this.disposed = true;
|
|
476
|
+
this.microphone.removeEventListener("click", this.changeMicrophone);
|
|
438
477
|
this.visual.stop();
|
|
439
478
|
}
|
|
440
479
|
/** The ribbon turns into the ring and the copy may change, so the card's rows hold their size. */
|
package/dist/esm/descriptor.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
//#region src/descriptor.ts
|
|
2
2
|
/** A small opt-in descriptor with no capture, model, or host implementation. */
|
|
3
|
-
function voiceIdAuthMethod() {
|
|
4
|
-
return {
|
|
3
|
+
function voiceIdAuthMethod(options = {}) {
|
|
4
|
+
return {
|
|
5
|
+
kind: "voiceid",
|
|
6
|
+
transcriptionModel: options.transcriptionModel ?? "citrinet"
|
|
7
|
+
};
|
|
5
8
|
}
|
|
6
9
|
//#endregion
|
|
7
10
|
export { voiceIdAuthMethod };
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
Attribution 4.0 International
|
|
2
|
+
|
|
3
|
+
=======================================================================
|
|
4
|
+
|
|
5
|
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
|
6
|
+
does not provide legal services or legal advice. Distribution of
|
|
7
|
+
Creative Commons public licenses does not create a lawyer-client or
|
|
8
|
+
other relationship. Creative Commons makes its licenses and related
|
|
9
|
+
information available on an "as-is" basis. Creative Commons gives no
|
|
10
|
+
warranties regarding its licenses, any material licensed under their
|
|
11
|
+
terms and conditions, or any related information. Creative Commons
|
|
12
|
+
disclaims all liability for damages resulting from their use to the
|
|
13
|
+
fullest extent possible.
|
|
14
|
+
|
|
15
|
+
Using Creative Commons Public Licenses
|
|
16
|
+
|
|
17
|
+
Creative Commons public licenses provide a standard set of terms and
|
|
18
|
+
conditions that creators and other rights holders may use to share
|
|
19
|
+
original works of authorship and other material subject to copyright
|
|
20
|
+
and certain other rights specified in the public license below. The
|
|
21
|
+
following considerations are for informational purposes only, are not
|
|
22
|
+
exhaustive, and do not form part of our licenses.
|
|
23
|
+
|
|
24
|
+
Considerations for licensors: Our public licenses are
|
|
25
|
+
intended for use by those authorized to give the public
|
|
26
|
+
permission to use material in ways otherwise restricted by
|
|
27
|
+
copyright and certain other rights. Our licenses are
|
|
28
|
+
irrevocable. Licensors should read and understand the terms
|
|
29
|
+
and conditions of the license they choose before applying it.
|
|
30
|
+
Licensors should also secure all rights necessary before
|
|
31
|
+
applying our licenses so that the public can reuse the
|
|
32
|
+
material as expected. Licensors should clearly mark any
|
|
33
|
+
material not subject to the license. This includes other CC-
|
|
34
|
+
licensed material, or material used under an exception or
|
|
35
|
+
limitation to copyright. More considerations for licensors:
|
|
36
|
+
wiki.creativecommons.org/Considerations_for_licensors
|
|
37
|
+
|
|
38
|
+
Considerations for the public: By using one of our public
|
|
39
|
+
licenses, a licensor grants the public permission to use the
|
|
40
|
+
licensed material under specified terms and conditions. If
|
|
41
|
+
the licensor's permission is not necessary for any reason--for
|
|
42
|
+
example, because of any applicable exception or limitation to
|
|
43
|
+
copyright--then that use is not regulated by the license. Our
|
|
44
|
+
licenses grant only permissions under copyright and certain
|
|
45
|
+
other rights that a licensor has authority to grant. Use of
|
|
46
|
+
the licensed material may still be restricted for other
|
|
47
|
+
reasons, including because others have copyright or other
|
|
48
|
+
rights in the material. A licensor may make special requests,
|
|
49
|
+
such as asking that all changes be marked or described.
|
|
50
|
+
Although not required by our licenses, you are encouraged to
|
|
51
|
+
respect those requests where reasonable. More considerations
|
|
52
|
+
for the public:
|
|
53
|
+
wiki.creativecommons.org/Considerations_for_licensees
|
|
54
|
+
|
|
55
|
+
=======================================================================
|
|
56
|
+
|
|
57
|
+
Creative Commons Attribution 4.0 International Public License
|
|
58
|
+
|
|
59
|
+
By exercising the Licensed Rights (defined below), You accept and agree
|
|
60
|
+
to be bound by the terms and conditions of this Creative Commons
|
|
61
|
+
Attribution 4.0 International Public License ("Public License"). To the
|
|
62
|
+
extent this Public License may be interpreted as a contract, You are
|
|
63
|
+
granted the Licensed Rights in consideration of Your acceptance of
|
|
64
|
+
these terms and conditions, and the Licensor grants You such rights in
|
|
65
|
+
consideration of benefits the Licensor receives from making the
|
|
66
|
+
Licensed Material available under these terms and conditions.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Section 1 -- Definitions.
|
|
70
|
+
|
|
71
|
+
a. Adapted Material means material subject to Copyright and Similar
|
|
72
|
+
Rights that is derived from or based upon the Licensed Material
|
|
73
|
+
and in which the Licensed Material is translated, altered,
|
|
74
|
+
arranged, transformed, or otherwise modified in a manner requiring
|
|
75
|
+
permission under the Copyright and Similar Rights held by the
|
|
76
|
+
Licensor. For purposes of this Public License, where the Licensed
|
|
77
|
+
Material is a musical work, performance, or sound recording,
|
|
78
|
+
Adapted Material is always produced where the Licensed Material is
|
|
79
|
+
synched in timed relation with a moving image.
|
|
80
|
+
|
|
81
|
+
b. Adapter's License means the license You apply to Your Copyright
|
|
82
|
+
and Similar Rights in Your contributions to Adapted Material in
|
|
83
|
+
accordance with the terms and conditions of this Public License.
|
|
84
|
+
|
|
85
|
+
c. Copyright and Similar Rights means copyright and/or similar rights
|
|
86
|
+
closely related to copyright including, without limitation,
|
|
87
|
+
performance, broadcast, sound recording, and Sui Generis Database
|
|
88
|
+
Rights, without regard to how the rights are labeled or
|
|
89
|
+
categorized. For purposes of this Public License, the rights
|
|
90
|
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
|
91
|
+
Rights.
|
|
92
|
+
|
|
93
|
+
d. Effective Technological Measures means those measures that, in the
|
|
94
|
+
absence of proper authority, may not be circumvented under laws
|
|
95
|
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
|
96
|
+
Treaty adopted on December 20, 1996, and/or similar international
|
|
97
|
+
agreements.
|
|
98
|
+
|
|
99
|
+
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
|
100
|
+
any other exception or limitation to Copyright and Similar Rights
|
|
101
|
+
that applies to Your use of the Licensed Material.
|
|
102
|
+
|
|
103
|
+
f. Licensed Material means the artistic or literary work, database,
|
|
104
|
+
or other material to which the Licensor applied this Public
|
|
105
|
+
License.
|
|
106
|
+
|
|
107
|
+
g. Licensed Rights means the rights granted to You subject to the
|
|
108
|
+
terms and conditions of this Public License, which are limited to
|
|
109
|
+
all Copyright and Similar Rights that apply to Your use of the
|
|
110
|
+
Licensed Material and that the Licensor has authority to license.
|
|
111
|
+
|
|
112
|
+
h. Licensor means the individual(s) or entity(ies) granting rights
|
|
113
|
+
under this Public License.
|
|
114
|
+
|
|
115
|
+
i. Share means to provide material to the public by any means or
|
|
116
|
+
process that requires permission under the Licensed Rights, such
|
|
117
|
+
as reproduction, public display, public performance, distribution,
|
|
118
|
+
dissemination, communication, or importation, and to make material
|
|
119
|
+
available to the public including in ways that members of the
|
|
120
|
+
public may access the material from a place and at a time
|
|
121
|
+
individually chosen by them.
|
|
122
|
+
|
|
123
|
+
j. Sui Generis Database Rights means rights other than copyright
|
|
124
|
+
resulting from Directive 96/9/EC of the European Parliament and of
|
|
125
|
+
the Council of 11 March 1996 on the legal protection of databases,
|
|
126
|
+
as amended and/or succeeded, as well as other essentially
|
|
127
|
+
equivalent rights anywhere in the world.
|
|
128
|
+
|
|
129
|
+
k. You means the individual or entity exercising the Licensed Rights
|
|
130
|
+
under this Public License. Your has a corresponding meaning.
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
Section 2 -- Scope.
|
|
134
|
+
|
|
135
|
+
a. License grant.
|
|
136
|
+
|
|
137
|
+
1. Subject to the terms and conditions of this Public License,
|
|
138
|
+
the Licensor hereby grants You a worldwide, royalty-free,
|
|
139
|
+
non-sublicensable, non-exclusive, irrevocable license to
|
|
140
|
+
exercise the Licensed Rights in the Licensed Material to:
|
|
141
|
+
|
|
142
|
+
a. reproduce and Share the Licensed Material, in whole or
|
|
143
|
+
in part; and
|
|
144
|
+
|
|
145
|
+
b. produce, reproduce, and Share Adapted Material.
|
|
146
|
+
|
|
147
|
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
|
148
|
+
Exceptions and Limitations apply to Your use, this Public
|
|
149
|
+
License does not apply, and You do not need to comply with
|
|
150
|
+
its terms and conditions.
|
|
151
|
+
|
|
152
|
+
3. Term. The term of this Public License is specified in Section
|
|
153
|
+
6(a).
|
|
154
|
+
|
|
155
|
+
4. Media and formats; technical modifications allowed. The
|
|
156
|
+
Licensor authorizes You to exercise the Licensed Rights in
|
|
157
|
+
all media and formats whether now known or hereafter created,
|
|
158
|
+
and to make technical modifications necessary to do so. The
|
|
159
|
+
Licensor waives and/or agrees not to assert any right or
|
|
160
|
+
authority to forbid You from making technical modifications
|
|
161
|
+
necessary to exercise the Licensed Rights, including
|
|
162
|
+
technical modifications necessary to circumvent Effective
|
|
163
|
+
Technological Measures. For purposes of this Public License,
|
|
164
|
+
simply making modifications authorized by this Section 2(a)
|
|
165
|
+
(4) never produces Adapted Material.
|
|
166
|
+
|
|
167
|
+
5. Downstream recipients.
|
|
168
|
+
|
|
169
|
+
a. Offer from the Licensor -- Licensed Material. Every
|
|
170
|
+
recipient of the Licensed Material automatically
|
|
171
|
+
receives an offer from the Licensor to exercise the
|
|
172
|
+
Licensed Rights under the terms and conditions of this
|
|
173
|
+
Public License.
|
|
174
|
+
|
|
175
|
+
b. No downstream restrictions. You may not offer or impose
|
|
176
|
+
any additional or different terms or conditions on, or
|
|
177
|
+
apply any Effective Technological Measures to, the
|
|
178
|
+
Licensed Material if doing so restricts exercise of the
|
|
179
|
+
Licensed Rights by any recipient of the Licensed
|
|
180
|
+
Material.
|
|
181
|
+
|
|
182
|
+
6. No endorsement. Nothing in this Public License constitutes or
|
|
183
|
+
may be construed as permission to assert or imply that You
|
|
184
|
+
are, or that Your use of the Licensed Material is, connected
|
|
185
|
+
with, or sponsored, endorsed, or granted official status by,
|
|
186
|
+
the Licensor or others designated to receive attribution as
|
|
187
|
+
provided in Section 3(a)(1)(A)(i).
|
|
188
|
+
|
|
189
|
+
b. Other rights.
|
|
190
|
+
|
|
191
|
+
1. Moral rights, such as the right of integrity, are not
|
|
192
|
+
licensed under this Public License, nor are publicity,
|
|
193
|
+
privacy, and/or other similar personality rights; however, to
|
|
194
|
+
the extent possible, the Licensor waives and/or agrees not to
|
|
195
|
+
assert any such rights held by the Licensor to the limited
|
|
196
|
+
extent necessary to allow You to exercise the Licensed
|
|
197
|
+
Rights, but not otherwise.
|
|
198
|
+
|
|
199
|
+
2. Patent and trademark rights are not licensed under this
|
|
200
|
+
Public License.
|
|
201
|
+
|
|
202
|
+
3. To the extent possible, the Licensor waives any right to
|
|
203
|
+
collect royalties from You for the exercise of the Licensed
|
|
204
|
+
Rights, whether directly or through a collecting society
|
|
205
|
+
under any voluntary or waivable statutory or compulsory
|
|
206
|
+
licensing scheme. In all other cases the Licensor expressly
|
|
207
|
+
reserves any right to collect such royalties.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
Section 3 -- License Conditions.
|
|
211
|
+
|
|
212
|
+
Your exercise of the Licensed Rights is expressly made subject to the
|
|
213
|
+
following conditions.
|
|
214
|
+
|
|
215
|
+
a. Attribution.
|
|
216
|
+
|
|
217
|
+
1. If You Share the Licensed Material (including in modified
|
|
218
|
+
form), You must:
|
|
219
|
+
|
|
220
|
+
a. retain the following if it is supplied by the Licensor
|
|
221
|
+
with the Licensed Material:
|
|
222
|
+
|
|
223
|
+
i. identification of the creator(s) of the Licensed
|
|
224
|
+
Material and any others designated to receive
|
|
225
|
+
attribution, in any reasonable manner requested by
|
|
226
|
+
the Licensor (including by pseudonym if
|
|
227
|
+
designated);
|
|
228
|
+
|
|
229
|
+
ii. a copyright notice;
|
|
230
|
+
|
|
231
|
+
iii. a notice that refers to this Public License;
|
|
232
|
+
|
|
233
|
+
iv. a notice that refers to the disclaimer of
|
|
234
|
+
warranties;
|
|
235
|
+
|
|
236
|
+
v. a URI or hyperlink to the Licensed Material to the
|
|
237
|
+
extent reasonably practicable;
|
|
238
|
+
|
|
239
|
+
b. indicate if You modified the Licensed Material and
|
|
240
|
+
retain an indication of any previous modifications; and
|
|
241
|
+
|
|
242
|
+
c. indicate the Licensed Material is licensed under this
|
|
243
|
+
Public License, and include the text of, or the URI or
|
|
244
|
+
hyperlink to, this Public License.
|
|
245
|
+
|
|
246
|
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
|
247
|
+
reasonable manner based on the medium, means, and context in
|
|
248
|
+
which You Share the Licensed Material. For example, it may be
|
|
249
|
+
reasonable to satisfy the conditions by providing a URI or
|
|
250
|
+
hyperlink to a resource that includes the required
|
|
251
|
+
information.
|
|
252
|
+
|
|
253
|
+
3. If requested by the Licensor, You must remove any of the
|
|
254
|
+
information required by Section 3(a)(1)(A) to the extent
|
|
255
|
+
reasonably practicable.
|
|
256
|
+
|
|
257
|
+
4. If You Share Adapted Material You produce, the Adapter's
|
|
258
|
+
License You apply must not prevent recipients of the Adapted
|
|
259
|
+
Material from complying with this Public License.
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
Section 4 -- Sui Generis Database Rights.
|
|
263
|
+
|
|
264
|
+
Where the Licensed Rights include Sui Generis Database Rights that
|
|
265
|
+
apply to Your use of the Licensed Material:
|
|
266
|
+
|
|
267
|
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
|
268
|
+
to extract, reuse, reproduce, and Share all or a substantial
|
|
269
|
+
portion of the contents of the database;
|
|
270
|
+
|
|
271
|
+
b. if You include all or a substantial portion of the database
|
|
272
|
+
contents in a database in which You have Sui Generis Database
|
|
273
|
+
Rights, then the database in which You have Sui Generis Database
|
|
274
|
+
Rights (but not its individual contents) is Adapted Material; and
|
|
275
|
+
|
|
276
|
+
c. You must comply with the conditions in Section 3(a) if You Share
|
|
277
|
+
all or a substantial portion of the contents of the database.
|
|
278
|
+
|
|
279
|
+
For the avoidance of doubt, this Section 4 supplements and does not
|
|
280
|
+
replace Your obligations under this Public License where the Licensed
|
|
281
|
+
Rights include other Copyright and Similar Rights.
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
|
285
|
+
|
|
286
|
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
|
287
|
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
|
288
|
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
|
289
|
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
|
290
|
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
|
291
|
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
292
|
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
|
293
|
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
|
294
|
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
|
295
|
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
|
296
|
+
|
|
297
|
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
|
298
|
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
|
299
|
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
|
300
|
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
|
301
|
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
|
302
|
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
|
303
|
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
|
304
|
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
|
305
|
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
|
306
|
+
|
|
307
|
+
c. The disclaimer of warranties and limitation of liability provided
|
|
308
|
+
above shall be interpreted in a manner that, to the extent
|
|
309
|
+
possible, most closely approximates an absolute disclaimer and
|
|
310
|
+
waiver of all liability.
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
Section 6 -- Term and Termination.
|
|
314
|
+
|
|
315
|
+
a. This Public License applies for the term of the Copyright and
|
|
316
|
+
Similar Rights licensed here. However, if You fail to comply with
|
|
317
|
+
this Public License, then Your rights under this Public License
|
|
318
|
+
terminate automatically.
|
|
319
|
+
|
|
320
|
+
b. Where Your right to use the Licensed Material has terminated under
|
|
321
|
+
Section 6(a), it reinstates:
|
|
322
|
+
|
|
323
|
+
1. automatically as of the date the violation is cured, provided
|
|
324
|
+
it is cured within 30 days of Your discovery of the
|
|
325
|
+
violation; or
|
|
326
|
+
|
|
327
|
+
2. upon express reinstatement by the Licensor.
|
|
328
|
+
|
|
329
|
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
|
330
|
+
right the Licensor may have to seek remedies for Your violations
|
|
331
|
+
of this Public License.
|
|
332
|
+
|
|
333
|
+
c. For the avoidance of doubt, the Licensor may also offer the
|
|
334
|
+
Licensed Material under separate terms or conditions or stop
|
|
335
|
+
distributing the Licensed Material at any time; however, doing so
|
|
336
|
+
will not terminate this Public License.
|
|
337
|
+
|
|
338
|
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
|
339
|
+
License.
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
Section 7 -- Other Terms and Conditions.
|
|
343
|
+
|
|
344
|
+
a. The Licensor shall not be bound by any additional or different
|
|
345
|
+
terms or conditions communicated by You unless expressly agreed.
|
|
346
|
+
|
|
347
|
+
b. Any arrangements, understandings, or agreements regarding the
|
|
348
|
+
Licensed Material not stated herein are separate from and
|
|
349
|
+
independent of the terms and conditions of this Public License.
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
Section 8 -- Interpretation.
|
|
353
|
+
|
|
354
|
+
a. For the avoidance of doubt, this Public License does not, and
|
|
355
|
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
|
356
|
+
conditions on any use of the Licensed Material that could lawfully
|
|
357
|
+
be made without permission under this Public License.
|
|
358
|
+
|
|
359
|
+
b. To the extent possible, if any provision of this Public License is
|
|
360
|
+
deemed unenforceable, it shall be automatically reformed to the
|
|
361
|
+
minimum extent necessary to make it enforceable. If the provision
|
|
362
|
+
cannot be reformed, it shall be severed from this Public License
|
|
363
|
+
without affecting the enforceability of the remaining terms and
|
|
364
|
+
conditions.
|
|
365
|
+
|
|
366
|
+
c. No term or condition of this Public License will be waived and no
|
|
367
|
+
failure to comply consented to unless expressly agreed to by the
|
|
368
|
+
Licensor.
|
|
369
|
+
|
|
370
|
+
d. Nothing in this Public License constitutes or may be interpreted
|
|
371
|
+
as a limitation upon, or waiver of, any privileges and immunities
|
|
372
|
+
that apply to the Licensor or You, including from the legal
|
|
373
|
+
processes of any jurisdiction or authority.
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
=======================================================================
|
|
377
|
+
|
|
378
|
+
Creative Commons is not a party to its public
|
|
379
|
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
|
380
|
+
its public licenses to material it publishes and in those instances
|
|
381
|
+
will be considered the “Licensor.” The text of the Creative Commons
|
|
382
|
+
public licenses is dedicated to the public domain under the CC0 Public
|
|
383
|
+
Domain Dedication. Except for the limited purpose of indicating that
|
|
384
|
+
material is shared under a Creative Commons public license or as
|
|
385
|
+
otherwise permitted by the Creative Commons policies published at
|
|
386
|
+
creativecommons.org/policies, Creative Commons does not authorize the
|
|
387
|
+
use of the trademark "Creative Commons" or any other trademark or logo
|
|
388
|
+
of Creative Commons without its prior written consent including,
|
|
389
|
+
without limitation, in connection with any unauthorized modifications
|
|
390
|
+
to any of its public licenses or any other arrangements,
|
|
391
|
+
understandings, or agreements concerning use of licensed material. For
|
|
392
|
+
the avoidance of doubt, this paragraph does not form part of the
|
|
393
|
+
public licenses.
|
|
394
|
+
|
|
395
|
+
Creative Commons may be contacted at creativecommons.org.
|
|
@@ -46,8 +46,25 @@ Changes: exported the publisher's INT8-weight checkpoint to ONNX, with
|
|
|
46
46
|
full-waveform log-mel preprocessing. The complex STFT is represented by ONNX
|
|
47
47
|
STFT and power reduction. Constant folding is disabled to retain INT8 weights
|
|
48
48
|
in the downloaded file. Execution dequantizes weights to floating point.
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Decoder pieces come from the publisher's SentencePiece tokenizer.
|
|
50
|
+
No retraining or user recordings are included.
|
|
51
|
+
|
|
52
|
+
NVIDIA Citrinet-256 LS spoken phrase model
|
|
53
|
+
|
|
54
|
+
Source: https://huggingface.co/nvidia/stt_en_citrinet_256_ls
|
|
55
|
+
Revision: c7cdacff0262bbb2a17771d20ec9f9f3b5cff6ed
|
|
56
|
+
Publisher: NVIDIA
|
|
57
|
+
License: Creative Commons Attribution 4.0 International; see CITRINET_LICENSE.txt.
|
|
58
|
+
License URL: https://creativecommons.org/licenses/by/4.0/
|
|
59
|
+
Checkpoint SHA-256: a00c8fb75a2bcc37271275293bce950863e4e069d43f6cf193d42fcf605aa21c
|
|
60
|
+
ONNX SHA-256: 875f58df0e2a593017ac9550c8fab68c4343cd1fbb2a042290450aa125441ed5
|
|
61
|
+
|
|
62
|
+
Changes: exported to ONNX with full 16 kHz mono waveform preprocessing,
|
|
63
|
+
folded batch normalization, and per-channel INT8 weight storage.
|
|
64
|
+
Execution dequantizes weights to FP32. The publisher's WordPiece decoder
|
|
65
|
+
vocabulary is embedded in code. No retraining or user recordings are included.
|
|
66
|
+
The exporter adapts Thomas Lackner's MIT-licensed BabyTalk architecture.
|
|
67
|
+
See tests/scripts/voiceid-citrinet/NOTICE.md in the source repository.
|
|
51
68
|
|
|
52
69
|
Silero VAD v5.1.2 (MIT), snakers4/silero-vad, revision 6478567951ae5c9979ad7b234185b5515f4be7a1.
|
|
53
70
|
Model SHA-256: 2623a2953f6ff3d2c1e61740c6cdb7168133479b267dfef114a4a3cc5bdd788f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./prompt-vztg41jG.js";import{a as e,i as t,r as n,t as r}from"./deviceBridge-DQLPNdC8.js";import{a as i,d as a,i as o,o as s,s as c,t as l}from"./enrollment-DPOYb36Z.js";import{IndexedDBManager as u,WorkerDeferred as d,allocateWalletAuthMethodId as f,alphabetizeStringify as p,base64UrlDecode as m,buildMethodBoundEnvelopeOwnership as h,buildPasskeyCustodyEnvelopeRecord as g,buildVoiceIdEnvelopeFactor as _,buildWalletCustodySeedBinding as v,custodyEnvelopeBindingJsonV1 as y,fetchWithWalletHomeDiscovery as b,isVoiceIdSeedEnvelope as x,parseDigestB64u as S,parseEnvelopeRevision as C,parsePasskeyCustodyEnvelopeRecord as w,parsePasskeyEnvelopeId as T,parseResealedEnvelopeResult as E,parseVoiceIdDevicePublicKeyB64u as D,parseWalletAuthMethodId as O,parseWalletAuthMethodRecordV2 as k,parseWalletId as A,readUnlockedWalletEd25519ExportRootCapabilityV1 as j,rejectUnknownFields as M,requireRecord as N,secureRandomId as P,sha256DigestB64u as F,toError as I,walletCustodyCeremonyTransportFromWorkerContextV1 as L,walletSessionAuthorizations as R}from"../voiceid-host.js";async function z(e){let t=N(e,`pending VoiceID activation`);if(M(t,[`kind`,`walletId`,`walletAuthMethodId`,`devicePublicKeyB64u`,`deviceKeyId`,`custodyEnvelope`],`pending VoiceID activation`),t.kind!==`pending_voiceid_activation_v1`)throw Error(`Pending VoiceID activation kind is invalid.`);let n=A(t.walletId),r=O(t.walletAuthMethodId);if(!n.ok||!r.ok)throw Error(`Pending VoiceID activation identity is invalid.`);let i=D(t.devicePublicKeyB64u),a=S(t.deviceKeyId),o=w(t.custodyEnvelope);if(!x(o)||o.walletId!==n.value||o.ownership.walletAuthMethodId!==r.value||o.factor.deviceKeyId!==a||Number(o.envelopeRevision)!==1||await F(m(i))!==a)throw Error(`Pending VoiceID activation binding is invalid.`);return{kind:`pending_voiceid_activation_v1`,walletId:n.value,walletAuthMethodId:r.value,devicePublicKeyB64u:i,deviceKeyId:a,custodyEnvelope:o}}function B(e){throw Error(`Unhandled VoiceID activation plan: ${String(e)}`)}function V(e,t){let{capability:n}=e;if(n.walletId!==e.walletId||n.walletSessionId!==t.walletSessionId||n.expiresAtMs<=Date.now())throw Error(`VoiceID activation requires the unlocked owner seed and Wallet Session.`)}async function H(e,t){let n=_({deviceKeyId:t.deviceKeyId}),r=v(),i=h(e.walletAuthMethodId),a=C(1),o=y({walletId:e.walletId,envelopeId:e.envelopeId,factor:n,envelopeRevision:a,binding:r,ownership:i}),s=t.factorSecret32.slice(),c;try{c=E(await e.reseal({capability:e.capability,bindingJson:o,factorSecret:s.buffer}))}finally{s.byteLength>0&&s.fill(0)}if(await F(m(c.sealedCustodySecretB64u))!==c.ciphertextDigestB64u)throw Error(`VoiceID worker returned a mismatched ciphertext digest.`);let l=Date.now(),u=w(g({envelopeId:e.envelopeId,walletId:e.walletId,ownership:i,binding:r,factor:n,envelopeRevision:a,nonceB64u:c.nonceB64u,sealedCustodySecretB64u:c.sealedCustodySecretB64u,ciphertextDigestB64u:c.ciphertextDigestB64u,aadHashB64u:c.aadHashB64u,lifecycle:{state:`active`,activatedAtMs:l},createdAtMs:l,updatedAtMs:l}));if(!x(u))throw Error(`VoiceID worker produced an invalid seed envelope.`);return{kind:`pending_voiceid_activation_v1`,walletId:e.walletId,walletAuthMethodId:e.walletAuthMethodId,devicePublicKeyB64u:t.publicKeyB64u,deviceKeyId:t.deviceKeyId,custodyEnvelope:u}}async function U(e){let t=e.plan;switch(t.kind){case`new`:V(t,e.ownerCredential);break;case`resume`:break;default:return B(t)}let n=t.kind===`new`?t.walletId:t.pending.walletId,r=t.kind===`new`?t.walletAuthMethodId:t.pending.walletAuthMethodId,i=await e.capture({walletId:n,walletAuthMethodId:r,signal:e.signal,onCapture:e.onCapture,phrase:e.phrase}),a;try{switch(t.kind){case`new`:a=await H(t,i),await e.persistPending(a);break;case`resume`:if(t.pending.devicePublicKeyB64u!==i.publicKeyB64u||t.pending.deviceKeyId!==i.deviceKeyId)throw Error(`VoiceID activation retry found a different device key.`);a=t.pending;break;default:return B(t)}}finally{i.factorSecret32.fill(0)}if(e.signal.aborted)throw Error(`VoiceID activation was cancelled.`);let o=await e.http.activate({ownerCredential:e.ownerCredential,walletId:a.walletId,walletAuthMethodId:a.walletAuthMethodId,devicePublicKeyB64u:a.devicePublicKeyB64u,deviceKeyId:a.deviceKeyId,custodyEnvelope:a.custodyEnvelope,signal:e.signal});return await e.persistActive(o,a),{authMethod:o,pending:a}}const W=`voiceid-activation-v1:`;function G(e,t){return`${W}${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function K(e){return`${W}${encodeURIComponent(e)}:`}function q(e,t){return p(e)===p(t)}async function J(e){if(e==null)return null;let t=N(e,`stored VoiceID activation`);switch(t.kind){case`pending`:return M(t,[`kind`,`pending`],`stored VoiceID activation`),{kind:`pending`,pending:await z(t.pending)};case`active`:{M(t,[`kind`,`pending`,`authMethod`],`stored VoiceID activation`);let e=await z(t.pending),n=k(t.authMethod);if(!n||n.kind!==`voiceid`||n.status!==`active`||n.walletId!==e.walletId||n.walletAuthMethodId!==e.walletAuthMethodId||n.deviceKeyId!==e.deviceKeyId||n.devicePublicKeyB64u!==e.devicePublicKeyB64u)throw Error(`Stored VoiceID activation method is invalid.`);return{kind:`active`,pending:e,authMethod:n}}default:throw Error(`Stored VoiceID activation lifecycle is invalid.`)}}var Y=class{constructor(e){this.storage=e}async persistPending(e){let t=G(e.walletId,e.walletAuthMethodId),n=await J(await this.storage.getAppState(t));if(n){if(n.kind===`pending`&&q(n.pending,e))return;throw Error(`A different VoiceID activation already owns this method ID.`)}await this.storage.setAppState(t,{kind:`pending`,pending:e})}async persistActive(e,t){let n=G(t.walletId,t.walletAuthMethodId),r=await J(await this.storage.getAppState(n));if(!r||!q(r.pending,t))throw Error(`VoiceID activation has no matching pending record.`);if(e.walletId!==t.walletId||e.walletAuthMethodId!==t.walletAuthMethodId||e.deviceKeyId!==t.deviceKeyId||e.devicePublicKeyB64u!==t.devicePublicKeyB64u)throw Error(`VoiceID server method does not match pending activation.`);await this.storage.upsertWalletAuthMethodV2(e),await this.storage.setAppState(n,{kind:`active`,pending:t,authMethod:e})}async readPending(e,t){let n=await J(await this.storage.getAppState(G(e,t)));if(!n||n.kind===`active`)return null;if(n.pending.walletId!==e||n.pending.walletAuthMethodId!==t)throw Error(`Stored VoiceID activation key does not match its record.`);return n.pending}async listPending(e){let t=await this.storage.listAppStateEntriesByPrefix(K(e)),n=[];for(let r of t){let t=await J(r.value);if(t){if(t.pending.walletId!==e||G(e,t.pending.walletAuthMethodId)!==r.key)throw Error(`Stored VoiceID activation key does not match its record.`);t.kind===`pending`&&n.push(t.pending)}}return n}};const X=`http://www.w3.org/2000/svg`;async function Z(e,t,n,r){let i=document.querySelector(`.seams-voiceid-activation-surface`);if(!(i instanceof HTMLElement))throw Error(`Open VoiceID management in the Wallet.`);let a=new Q(i,e,t,n,r);try{await a.result}finally{a.dispose()}}var Q=class{completion=new d;result=this.completion.promise;element=document.createElement(`div`);enrollment=document.createElement(`div`);enrollmentValue=document.createElement(`span`);startOver=document.createElement(`p`);status=document.createElement(`p`);actions;busy=!1;closed=!1;constructor(e,t,n,r,i){this.parent=e,this.context=t,this.scope=n,this.signal=r,this.model=i,this.element.className=`seams-voiceid-prompt seams-voiceid-management`;let a=document.createElement(`div`);a.className=`seams-voiceid-management-header`;let o=document.createElement(`button`);o.type=`button`,o.className=`seams-voiceid-management-back`,o.setAttribute(`aria-label`,`Back`),o.append($(`M15 6l-6 6 6 6`,20)),o.addEventListener(`click`,this.cancel);let s=document.createElement(`h2`);s.textContent=`Manage voice`,a.append(o,s);let c=document.createElement(`p`);c.className=`seams-voiceid-management-intro`,c.textContent=`Voice unlock on this device. Each change asks for your passkey.`,this.element.append(a,c,this.enrollmentRow()),this.actions={reset:this.resetAction(),improve:this.action(`improve`,`Improve recognition`,!0),import:this.action(`import`,`Use saved enrollment`,!1),replace:this.startOverAction()},this.status.setAttribute(`role`,`status`),this.element.append(this.status),this.enrollmentValue.textContent=`Checking…`,this.actions.import.button.hidden=!0,this.render(null,!1,!1),this.parent.replaceChildren(this.element),this.signal.addEventListener(`abort`,this.cancel,{once:!0}),this.refresh(),o.focus()}enrollmentRow(){this.enrollment.className=`seams-voiceid-management-enrollment`;let e=document.createElement(`span`);e.textContent=`Enrollment`,this.enrollmentValue.className=`seams-voiceid-management-value`;let t=document.createElement(`span`);return t.className=`seams-voiceid-management-summary`,t.append(this.enrollmentValue),this.enrollment.append(e,t),this.enrollment}resetAction(){let e=document.createElement(`button`);e.type=`button`,e.className=`seams-voiceid-management-reset`,e.textContent=`Reset`,e.setAttribute(`aria-label`,`Reset improvements`),e.addEventListener(`click`,this.begin.bind(this,`reset`));let t=document.createElement(`span`);return t.className=`seams-voiceid-management-enrollment-detail`,this.enrollment.querySelector(`.seams-voiceid-management-summary`)?.append(t),this.enrollment.append(e),{button:e,title:e,detail:t,frame:this.enrollment}}startOverAction(){return this.startOver.className=`seams-voiceid-management-section`,this.startOver.textContent=`Start over`,this.element.append(this.startOver),this.action(`replace`,`Record voice again`,!1)}action(e,t,n){let r=document.createElement(`button`);r.type=`button`,r.className=`seams-voiceid-management-action`;let i=document.createElement(`span`),a=document.createElement(`span`);a.className=`seams-voiceid-management-action-heading`;let o=document.createElement(`span`);o.id=`seams-voiceid-management-${e}-title`,o.textContent=t,a.append(o);let s=[];if(n){let t=document.createElement(`span`);t.id=`seams-voiceid-management-${e}-chip`,t.className=`seams-voiceid-management-chip`,t.textContent=`Experimental`,a.append(t),s.push(t.id)}let c=document.createElement(`span`);return c.id=`seams-voiceid-management-${e}-detail`,c.className=`seams-voiceid-management-action-detail`,s.push(c.id),i.append(a,c),r.append(i,$(`M9 6l6 6-6 6`,16)),r.setAttribute(`aria-labelledby`,o.id),r.setAttribute(`aria-describedby`,s.join(` `)),r.disabled=!0,r.addEventListener(`click`,this.begin.bind(this,e)),this.element.append(r),{button:r,title:o,detail:c,frame:r}}async refresh(){try{let e=await s(this.scope),t=e?null:await i();if(this.closed)return;this.render(e,t!==null,!0)}catch(e){this.completion.reject(I(e))}}render(e,t,n){let r=e?.adaptation??null,{improve:i,reset:a,import:o,replace:s}=this.actions;n&&(this.enrollment.dataset.enrollment=r?.kind??`missing`,this.enrollmentValue.textContent=r===null?`Not on this device`:r.kind===`adapted`?`Improved`:`Original`,i.button.hidden=e===null,o.button.hidden=!t),a.button.hidden=r?.kind!==`adapted`,a.detail.textContent=r?.kind===`adapted`?`Saved on this device`:``,i.title.textContent=r?.kind===`adapted`?`Improve again`:`Improve recognition`,i.detail.textContent=r?.kind===`adapted`?`Replace the added samples. Your original enrollment stays.`:`Add three samples. They stay until you replace or reset them.`,o.detail.textContent=`Import the voice enrollment saved in this browser.`,s.detail.textContent=r?.kind===`adapted`?`Replace your enrollment and remove improvements.`:`Replace your enrollment with three new samples.`,this.startOver.hidden=i.button.hidden&&o.button.hidden;for(let e of Object.values(this.actions))delete e.frame.dataset.state,e.button.disabled=!n;this.status.textContent=``,delete this.status.dataset.placement}show(e,t,n){let r=this.actions[e];if(this.status.textContent=n,r.button.hidden){this.status.dataset.placement=`dialog`;return}r.frame.dataset.state=t,r.detail.textContent=n}begin(e){if(!(this.busy||this.closed)){this.busy=!0;for(let e of Object.values(this.actions))e.button.disabled=!0;this.show(e,`pending`,`Confirm with your passkey to continue.`),this.perform(e)}}async perform(e){try{let r=await t(this.scope,`enrolled`),a=await s(this.scope),c=a?{kind:`present`,enrollment:a}:{kind:`missing`};if(e===`improve`&&c.kind===`missing`)throw Error(`Record or import your original voice first.`);let u=e===`import`?await i():null;if(e===`import`&&(!u||c.kind!==`missing`))throw Error(`The previous enrollment is unavailable.`);let d=await n.request(this.context,this.scope,r,c,e,this.signal);switch(this.signal.throwIfAborted(),e){case`improve`:if(c.kind!==`present`)throw Error(`Original voice enrollment is unavailable.`);await l({kind:`improve`,scope:this.scope,guard:r,snapshot:c,confirmation:d},this.signal,this.model);break;case`replace`:await l({kind:`replace`,scope:this.scope,guard:r,snapshot:c,confirmation:d},this.signal,this.model);break;case`reset`:await o(this.scope,r,c,{kind:`reset`,confirmation:d},this.signal);break;case`import`:if(!u)throw Error(`Previous voice enrollment is unavailable.`);await o(this.scope,r,c,{kind:`import`,baseline:u,confirmation:d},this.signal);break}this.closed||this.completion.resolve()}catch(t){if(this.closed)return;this.parent.replaceChildren(this.element),await this.refresh(),this.closed||this.show(e,`error`,t instanceof Error?t.message:`VoiceID could not be updated.`)}finally{this.busy=!1}}cancel=()=>{this.closed||(this.closed=!0,this.parent.dispatchEvent(new Event(`cancel`,{bubbles:!0})),this.completion.reject(Error(`VoiceID management was cancelled.`)))};dispose(){this.closed=!0,this.signal.removeEventListener(`abort`,this.cancel),this.element.remove()}};function $(e,t){let n=document.createElementNS(X,`svg`);n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`aria-hidden`,`true`);let r=document.createElementNS(X,`path`);return r.setAttribute(`d`,e),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,`1.75`),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),n.append(r),n}async function ee(e,t){return await e.requestOperation({kind:`walletCustodyCeremony`,request:{type:`resealWalletCustodyFromUnlockedCapability`,payload:{capability:t.capability,replacementEnvelopeBindingJson:t.bindingJson,replacementFactorSecret:t.factorSecret},transfer:[t.factorSecret]}})}async function te(t,n){let r=await u.resolveSelectedWalletAuthority(n);if(r.kind!==`resolved`||r.selection.lockState!==`unlocked`||r.selection.walletId!==n||r.authMethod.status!==`active`||r.authMethod.walletId!==n||r.authMethod.walletAuthorityId!==r.authority.authorityId||r.authority.state!==`active`||r.authority.walletId!==n)throw Error(`Unlock this wallet with a passkey or Email OTP before activating VoiceID.`);let i=await R.readExactWithOperationCredential({walletId:n,authorityId:r.authority.authorityId,authMethodId:r.authMethod.walletAuthMethodId});if(i.kind!==`found`||i.record.walletId!==n||i.record.authMethodId!==r.authMethod.walletAuthMethodId||i.record.authorityId!==r.authority.authorityId||i.record.expiresAtMs<=Date.now())throw Error(`VoiceID activation requires an active owner Wallet Session.`);let o=await u.listWalletAuthMethodsV2ForWallet(n);for(let e of o){if(e.kind!==`voiceid`||e.status!==`active`||e.walletAuthorityId!==r.authority.authorityId)continue;let i=await a(n,e.walletAuthMethodId);if(i&&i.deviceKeyId===e.deviceKeyId)return{kind:`enroll_existing`,walletId:n,walletAuthMethodId:e.walletAuthMethodId,context:t}}if(r.authMethod.kind===`voiceid`)throw Error(`An existing local VoiceID enrollment is required for management.`);let s=new Y(u),c=await s.listPending(n);if(c.length>1)throw Error(`More than one VoiceID activation is pending for this wallet.`);let l;if(c.length===1)l={kind:`resume`,pending:c[0]};else{let e=j(n);if(!e||e.walletSessionId!==i.operationCredential.walletSessionId)throw Error(`Unlock the wallet again to make its custody seed available for VoiceID.`);let r=T(P(`wallet-custody-envelope`,24));if(!r.ok)throw Error(`VoiceID envelope ID generation failed.`);let a=L(t.signingEngine.getSignerWorkerContext());l={kind:`new`,walletId:n,walletAuthMethodId:f(crypto.randomUUID()),envelopeId:r.value,capability:e,reseal:ee.bind(null,a)}}return{kind:`activate`,ownerCredential:i.operationCredential,plan:l,http:new e(t.configs.network.relayer.url,location.origin,b),store:s}}async function ne(e,t,n){t.throwIfAborted();let{context:r,walletId:i}=e,a=await te(r,i);return t.throwIfAborted(),a.kind===`enroll_existing`?{kind:`management`,action:re.bind(null,n,a)}:{kind:`recording`,action:ie.bind(null,n,a),expiresAtMs:null}}async function re(e,t,n){let r=await c(t.walletId,t.walletAuthMethodId);return await Z(t.context,r,n,e),n.throwIfAborted(),{kind:`activated`,walletId:t.walletId,walletAuthMethodId:t.walletAuthMethodId}}async function ie(e,t,n,i,a){let o=await U({plan:t.plan,ownerCredential:t.ownerCredential,http:t.http,signal:n,onCapture:i,phrase:a,capture:r.bind(null,e),persistPending:t.store.persistPending.bind(t.store),persistActive:t.store.persistActive.bind(t.store)});return{kind:`activated`,walletId:o.authMethod.walletId,walletAuthMethodId:o.authMethod.walletAuthMethodId}}export{ne as prepareActivationSurface};
|