vrchatapi / vrchatapi-javascript

🟡 VRChat API Library for JavaScript and TypeScript
https://www.npmjs.com/package/vrchat
MIT License
43 stars 17 forks source link

2FA/MFA type for AuthenticationApi.getCurrentUser #5

Open felixfong227 opened 1 year ago

felixfong227 commented 1 year ago

The current type of AuthenticationApi.getCurrentUser return type did not cater for TOTP flow.

Email OTP flow response:

{
  "acceptedTOSVersion": 7,
  "accountDeletionDate": "2023-03-16",
  "accountDeletionLog": [
    {
      "message": "Deletion requested",
      "deletionScheduled": "2023-03-16T08:10:07.859Z",
      "dateTime": "2023-03-16T08:10:07.859Z"
    }
  ],
  "activeFriends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "allowAvatarCopying": true,
  "bio": "string",
  "bioLinks": [
    "string"
  ],
  "currentAvatar": "avtr_912d66a4-4714-43b8-8407-7de2cafbf55b",
  "currentAvatarAssetUrl": "string",
  "currentAvatarImageUrl": "https://api.vrchat.cloud/api/1/file/file_ae46d521-7281-4b38-b365-804b32a1d6a7/1/file",
  "currentAvatarThumbnailImageUrl": "https://api.vrchat.cloud/api/1/image/file_aae83ed9-d42d-4d72-9f4b-9f1e41ed17e1/1/256",
  "date_joined": "2023-03-16",
  "developerType": "none",
  "displayName": "string",
  "emailVerified": true,
  "fallbackAvatar": "avtr_912d66a4-4714-43b8-8407-7de2cafbf55b",
  "friendKey": "string",
  "friends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "hasBirthday": true,
  "hasEmail": true,
  "hasLoggedInFromClient": true,
  "hasPendingEmail": true,
  "homeLocation": "wrld_ba913a96-fac4-4048-a062-9aa5db092812",
  "id": "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469",
  "isFriend": false,
  "last_login": "2023-03-16T08:10:07.859Z",
  "last_platform": "standalonewindows",
  "obfuscatedEmail": "string",
  "obfuscatedPendingEmail": "string",
  "oculusId": "string",
  "offlineFriends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "onlineFriends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "pastDisplayNames": [
    {
      "displayName": "string",
      "updated_at": "2023-03-16T08:10:07.859Z"
    }
  ],
  "profilePicOverride": "string",
  "state": "offline",
  "status": "offline",
  "statusDescription": "string",
  "statusFirstTime": true,
  "statusHistory": [
    "string"
  ],
  "steamDetails": {},
  "steamId": "string",
  "tags": [
    "string"
  ],
  "twoFactorAuthEnabled": true,
  "twoFactorAuthEnabledDate": "2023-03-16T08:10:07.859Z",
  "unsubscribe": true,
  "userIcon": "string",
+  "requiresTwoFactorAuth": ["emailOtp"]
}

TOTP flow:

{
  "acceptedTOSVersion": 7,
  "accountDeletionDate": "2023-03-16",
  "accountDeletionLog": [
    {
      "message": "Deletion requested",
      "deletionScheduled": "2023-03-16T08:10:07.859Z",
      "dateTime": "2023-03-16T08:10:07.859Z"
    }
  ],
  "activeFriends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "allowAvatarCopying": true,
  "bio": "string",
  "bioLinks": [
    "string"
  ],
  "currentAvatar": "avtr_912d66a4-4714-43b8-8407-7de2cafbf55b",
  "currentAvatarAssetUrl": "string",
  "currentAvatarImageUrl": "https://api.vrchat.cloud/api/1/file/file_ae46d521-7281-4b38-b365-804b32a1d6a7/1/file",
  "currentAvatarThumbnailImageUrl": "https://api.vrchat.cloud/api/1/image/file_aae83ed9-d42d-4d72-9f4b-9f1e41ed17e1/1/256",
  "date_joined": "2023-03-16",
  "developerType": "none",
  "displayName": "string",
  "emailVerified": true,
  "fallbackAvatar": "avtr_912d66a4-4714-43b8-8407-7de2cafbf55b",
  "friendKey": "string",
  "friends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "hasBirthday": true,
  "hasEmail": true,
  "hasLoggedInFromClient": true,
  "hasPendingEmail": true,
  "homeLocation": "wrld_ba913a96-fac4-4048-a062-9aa5db092812",
  "id": "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469",
  "isFriend": false,
  "last_login": "2023-03-16T08:10:07.859Z",
  "last_platform": "standalonewindows",
  "obfuscatedEmail": "string",
  "obfuscatedPendingEmail": "string",
  "oculusId": "string",
  "offlineFriends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "onlineFriends": [
    "usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469"
  ],
  "pastDisplayNames": [
    {
      "displayName": "string",
      "updated_at": "2023-03-16T08:10:07.859Z"
    }
  ],
  "profilePicOverride": "string",
  "state": "offline",
  "status": "offline",
  "statusDescription": "string",
  "statusFirstTime": true,
  "statusHistory": [
    "string"
  ],
  "steamDetails": {},
  "steamId": "string",
  "tags": [
    "string"
  ],
  "twoFactorAuthEnabled": true,
  "twoFactorAuthEnabledDate": "2023-03-16T08:10:07.859Z",
  "unsubscribe": true,
  "userIcon": "string",
+  "requiresTwoFactorAuth": ["otp", "totp"]
}

Maybe we need to update the OpenAPI spcs?