@invonetwork/web-sdk 3.10.0 → 3.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - `linkDevice()` takes no arguments. The server mints the link id, so requiring one was wrong: callers had to invent a placeholder. The parameter stays optional and any value passed is still sent and ignored by the server, so code written against 3.10 keeps working unchanged. The README now also states that a tenant whose players enrol a passkey on the tenant's own domain MUST offer `linkDevice()`, because that credential can only be asserted on that tenant's origin, and that recovery is never the answer to `ENROLLMENT_REQUIRES_PROOF`.
8
+
3
9
  ## 3.10.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -1376,7 +1376,7 @@ await client.enrollPasskey();
1376
1376
  // Interchangeable methods (optional): prove an already-enrolled method (e.g. the INVO app
1377
1377
  // device key) to authorize adding THIS passkey, then enroll. Without this, enrolling a second
1378
1378
  // method is blocked with ENROLLMENT_REQUIRES_PROOF.
1379
- await client.linkDevice(linkId); // → { status: "authorized" }
1379
+ await client.linkDevice(); // → { status: "authorized" } (the server mints the link id)
1380
1380
  await client.enrollPasskey();
1381
1381
  ```
1382
1382
 
@@ -1394,7 +1394,7 @@ try {
1394
1394
  await client.enrollmentVerify(codeFromUser); // 6-digit OTP
1395
1395
  await client.enrollPasskey(); // retry — grant auto-consumed
1396
1396
  } else if (e instanceof InvoError && e.isEnrollmentProofRequired) {
1397
- await client.linkDevice(linkId); // a different method already exists
1397
+ await client.linkDevice(); // a different method already exists
1398
1398
  await client.enrollPasskey();
1399
1399
  } else throw e;
1400
1400
  }
@@ -1412,7 +1412,9 @@ try {
1412
1412
  await client.enrollPasskey();
1413
1413
  } catch (e) {
1414
1414
  if (e instanceof InvoError && e.isEnrollmentProofRequired) {
1415
- // Player still HAS the other method → linkDevice (above). Lost/deleted it → recover:
1415
+ // Player still HAS the other method → linkDevice (above). Lost/deleted it → recover.
1416
+ // READ `e.next` FIRST: "link" means the method still exists, so linkDevice, never recovery.
1417
+ // Recovery deactivates the working credential and starts a 24h money-out cooldown.
1416
1418
  await client.recoveryBegin(); // → { status:"sent", channels:["email"] } — email first; { channel: "sms" } to text instead
1417
1419
  await client.recoveryComplete(codeFromUser); // → { status:"recovered", deactivatedCount }
1418
1420
  await client.enrollPasskey(); // same call — now succeeds
@@ -1785,6 +1787,16 @@ const done = await server.completeDeviceApproval({
1785
1787
  the page refuses to enrol beside it with `409 ENROLLMENT_REQUIRES_PROOF` and tells the
1786
1788
  player to add this phone from where that method lives (`linkDevice`), then scan again. An
1787
1789
  identity with no method enrols freely.
1790
+ > **Partner-passkey tenants must implement `linkDevice`, or this is a dead end.** A passkey
1791
+ > is bound to the site that created it, so a credential on your domain cannot be asserted on
1792
+ > INVO's hosted page: only YOUR site can prove it. If your players enrol a passkey on your
1793
+ > domain (the usual web flow) and then use the hosted approval page, they WILL hit
1794
+ > `ENROLLMENT_REQUIRES_PROOF`, and the only way forward is your site calling `linkDevice()`.
1795
+ > Offer it as a plain "Link this phone" action on the same screen. Branch on the server's
1796
+ > verdict, not on guesswork: `ENROLLMENT_REQUIRES_PROOF` (`next: "link"`) means the player
1797
+ > still holds a working method, so link it. Recovery is for `PASSKEY_ALREADY_ENROLLED` or a
1798
+ > player who says the credential is gone, and it deactivates that credential and imposes a
1799
+ > 24 hour hold on moving money out, so never run it automatically.
1788
1800
  - **The code box on the page is the RFC 8628 `user_code`,** there for a TV with no camera.
1789
1801
  When the QR pre-fills it, the box isn't shown. It is not an SMS field.
1790
1802
  - **Currency purchases on a console go through that console's store**, as the platform
@@ -2030,7 +2042,7 @@ Every method also accepts an optional final `{ signal }` (`AbortSignal`) for can
2030
2042
  | `recoveryBegin()` / `recoveryComplete(code)` | passkey recovery for `ENROLLMENT_REQUIRES_PROOF` when the passkey was lost/deleted (then retry `enrollPasskey`) — recovered keys can't move money OUT for 24h (`PASSKEY_RECOVERY_COOLDOWN`) |
2031
2043
  | `approveSend(txnId)` / `approveTransfer(txnId)` | `{ status, next, transactionId, claimCode?, claimCodeExpiresAt?, holdReason?, risk?, guardianApproval?, pollEndpoint?, raw }` |
2032
2044
  | `confirmReceiptSend(txnId)` / `confirmReceiptTransfer(txnId)` | `{ status, holdReason?, raw }` |
2033
- | `linkDevice(linkId)` | `{ status, raw }` |
2045
+ | `linkDevice()` | `{ status, raw }` — call with no arguments; the server mints the link id (a value passed by 3.10-era code is still accepted and ignored) |
2034
2046
  | `getPendingCollect()` | `{ pending, raw }` — the player's own pending-to-collect list (player-token) |
2035
2047
  | `getDestinations({ direction? })` | `{ availableGames, sourceGameName, transferMode, … }` — where the player can send/transfer, metadata inline |
2036
2048
  | `getBalance()` | `{ gameId, gameName, balances, totalValue, currencyCount, hasFunds, raw }` — the player's balances for this game |
package/dist/index.cjs CHANGED
@@ -1911,15 +1911,22 @@ var InvoClient = class {
1911
1911
  * blocked with ENROLLMENT_REQUIRES_PROOF.
1912
1912
  *
1913
1913
  * begin -> navigator.credentials.get() -> complete with { link_id, webauthn_assertion }.
1914
+ *
1915
+ * Call it with no arguments: `await invo.linkDevice()`. THE SERVER MINTS THE
1916
+ * LINK ID, so there is nothing for the caller to supply. The parameter is kept
1917
+ * (optional, and sent but ignored by the server) so that code written against
1918
+ * 3.10 and earlier, which had to pass a placeholder, keeps compiling and
1919
+ * working unchanged.
1914
1920
  */
1915
1921
  async linkDevice(linkId, opts) {
1916
- if (!linkId) throw new Error("linkDevice requires a `linkId`.");
1917
1922
  this.assertWebAuthn();
1918
1923
  const signal = opts?.signal;
1919
1924
  return this.withTokenRetry(async () => {
1920
1925
  const begin = await this.post(
1921
1926
  "/api/sdk/device/link/webauthn/begin",
1922
- { link_id: linkId },
1927
+ // The server ignores the body and mints its own id; `linkId` travels only
1928
+ // for callers who still pass one.
1929
+ linkId ? { link_id: linkId } : {},
1923
1930
  signal
1924
1931
  );
1925
1932
  const cred = await navigator.credentials.get({
package/dist/index.d.cts CHANGED
@@ -206,8 +206,14 @@ declare class InvoClient {
206
206
  * blocked with ENROLLMENT_REQUIRES_PROOF.
207
207
  *
208
208
  * begin -> navigator.credentials.get() -> complete with { link_id, webauthn_assertion }.
209
+ *
210
+ * Call it with no arguments: `await invo.linkDevice()`. THE SERVER MINTS THE
211
+ * LINK ID, so there is nothing for the caller to supply. The parameter is kept
212
+ * (optional, and sent but ignored by the server) so that code written against
213
+ * 3.10 and earlier, which had to pass a placeholder, keeps compiling and
214
+ * working unchanged.
209
215
  */
210
- linkDevice(linkId: string, opts?: CallOptions): Promise<LinkDeviceResult>;
216
+ linkDevice(linkId?: string, opts?: CallOptions): Promise<LinkDeviceResult>;
211
217
  /**
212
218
  * List the player's own pending items to collect (browser, player-token). Each row's
213
219
  * `kind` tells you which action to call: `"identity_gate"` → `approve*` (you initiated);
package/dist/index.d.ts CHANGED
@@ -206,8 +206,14 @@ declare class InvoClient {
206
206
  * blocked with ENROLLMENT_REQUIRES_PROOF.
207
207
  *
208
208
  * begin -> navigator.credentials.get() -> complete with { link_id, webauthn_assertion }.
209
+ *
210
+ * Call it with no arguments: `await invo.linkDevice()`. THE SERVER MINTS THE
211
+ * LINK ID, so there is nothing for the caller to supply. The parameter is kept
212
+ * (optional, and sent but ignored by the server) so that code written against
213
+ * 3.10 and earlier, which had to pass a placeholder, keeps compiling and
214
+ * working unchanged.
209
215
  */
210
- linkDevice(linkId: string, opts?: CallOptions): Promise<LinkDeviceResult>;
216
+ linkDevice(linkId?: string, opts?: CallOptions): Promise<LinkDeviceResult>;
211
217
  /**
212
218
  * List the player's own pending items to collect (browser, player-token). Each row's
213
219
  * `kind` tells you which action to call: `"identity_gate"` → `approve*` (you initiated);
package/dist/index.js CHANGED
@@ -961,15 +961,22 @@ var InvoClient = class {
961
961
  * blocked with ENROLLMENT_REQUIRES_PROOF.
962
962
  *
963
963
  * begin -> navigator.credentials.get() -> complete with { link_id, webauthn_assertion }.
964
+ *
965
+ * Call it with no arguments: `await invo.linkDevice()`. THE SERVER MINTS THE
966
+ * LINK ID, so there is nothing for the caller to supply. The parameter is kept
967
+ * (optional, and sent but ignored by the server) so that code written against
968
+ * 3.10 and earlier, which had to pass a placeholder, keeps compiling and
969
+ * working unchanged.
964
970
  */
965
971
  async linkDevice(linkId, opts) {
966
- if (!linkId) throw new Error("linkDevice requires a `linkId`.");
967
972
  this.assertWebAuthn();
968
973
  const signal = opts?.signal;
969
974
  return this.withTokenRetry(async () => {
970
975
  const begin = await this.post(
971
976
  "/api/sdk/device/link/webauthn/begin",
972
- { link_id: linkId },
977
+ // The server ignores the body and mints its own id; `linkId` travels only
978
+ // for callers who still pass one.
979
+ linkId ? { link_id: linkId } : {},
973
980
  signal
974
981
  );
975
982
  const cred = await navigator.credentials.get({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invonetwork/web-sdk",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "description": "INVO Web SDK — currency purchase + passkey (WebAuthn) verification for partner web platforms.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "private": false,