From 77cfbf5109f8f4d5ddfea7c18460c96d1a98f074 Mon Sep 17 00:00:00 2001 From: Vinyarion <38413862+VinyarionHyarmendacil@users.noreply.github.com> Date: Mon, 12 May 2025 22:43:57 -0500 Subject: [PATCH 1/3] Authentication and User Update properties Addresses #427 --- .../codeSamples/authentication.yaml | 7 +++++++ openapi/components/paths.yaml | 2 ++ openapi/components/paths/authentication.yaml | 16 +++++++++++++++ openapi/components/paths/instances.yaml | 2 +- openapi/components/paths/users.yaml | 2 ++ .../requests/UpdateUserRequest.yaml | 18 +++++++++++++++++ .../Get2FARecoveryCodesResponse.yaml | 5 +++++ .../users/CurrentPasswordRequiredError.yaml | 5 +++++ openapi/components/schemas/CurrentUser.yaml | 5 +++++ .../schemas/TwoFactorRecoveryCodes.yaml | 20 +++++++++++++++++++ 10 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 openapi/components/responses/authentication/Get2FARecoveryCodesResponse.yaml create mode 100644 openapi/components/responses/users/CurrentPasswordRequiredError.yaml create mode 100644 openapi/components/schemas/TwoFactorRecoveryCodes.yaml diff --git a/openapi/components/codeSamples/authentication.yaml b/openapi/components/codeSamples/authentication.yaml index 9b226acb..9ce2c11f 100644 --- a/openapi/components/codeSamples/authentication.yaml +++ b/openapi/components/codeSamples/authentication.yaml @@ -29,6 +29,13 @@ -H "Content-Type: application/json" \ -b "auth={authCookie}" \ --data '{"code": "string"}' +/auth/twofactorauth/otp: + get: + - lang: cURL + source: >- + curl -X GET "https://api.vrchat.cloud/api/1/auth/twofactorauth/otp" \ + -H "Content-Type: application/json" \ + -b "auth={authCookie}" /auth/twofactorauth/otp/verify: post: - lang: cURL diff --git a/openapi/components/paths.yaml b/openapi/components/paths.yaml index a33ea607..d7abfd7a 100644 --- a/openapi/components/paths.yaml +++ b/openapi/components/paths.yaml @@ -10,6 +10,8 @@ $ref: "./paths/authentication.yaml#/paths/~1auth~1user" "/auth/twofactorauth/totp/verify": $ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1totp~1verify" +"/auth/twofactorauth/otp": + $ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1otp" "/auth/twofactorauth/otp/verify": $ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1otp~1verify" "/auth/twofactorauth/emailotp/verify": diff --git a/openapi/components/paths/authentication.yaml b/openapi/components/paths/authentication.yaml index ecfbf1f0..b07e56c0 100644 --- a/openapi/components/paths/authentication.yaml +++ b/openapi/components/paths/authentication.yaml @@ -112,6 +112,22 @@ paths: security: - authCookie: [] parameters: [] + /auth/twofactorauth/otp: + get: + summary: Get 2FA Recovery codes + operationId: getRecoveryCodes + x-codeSamples: + $ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth~1otp/get" + responses: + '200': + $ref: ../responses/authentication/Get2FARecoveryCodesResponse.yaml + '401': + $ref: ../responses/MissingCredentialsError.yaml + description: Gets the OTP (One Time Password) recovery codes for accounts with 2FA-protection enabled. + tags: + - authentication + security: + - authCookie: [] /auth/twofactorauth/otp/verify: post: summary: Verify 2FA code with Recovery code diff --git a/openapi/components/paths/instances.yaml b/openapi/components/paths/instances.yaml index c73e3489..975c0fc7 100644 --- a/openapi/components/paths/instances.yaml +++ b/openapi/components/paths/instances.yaml @@ -71,7 +71,7 @@ paths: description: |- Close an instance or update the closedAt time when it will be closed. - You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-moderate` permission. + You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-manage` permission. responses: '200': $ref: ../responses/instances/InstanceResponse.yaml diff --git a/openapi/components/paths/users.yaml b/openapi/components/paths/users.yaml index d64073ac..ab873dd2 100644 --- a/openapi/components/paths/users.yaml +++ b/openapi/components/paths/users.yaml @@ -90,6 +90,8 @@ paths: responses: '200': $ref: ../responses/users/CurrentUserResponse.yaml + '400': + $ref: ../responses/users/CurrentPasswordRequiredError.yaml '401': $ref: ../responses/MissingCredentialsError.yaml description: Update a users information such as the email and birthday. diff --git a/openapi/components/requests/UpdateUserRequest.yaml b/openapi/components/requests/UpdateUserRequest.yaml index 6e1eb5c2..9dd0c88f 100644 --- a/openapi/components/requests/UpdateUserRequest.yaml +++ b/openapi/components/requests/UpdateUserRequest.yaml @@ -3,6 +3,8 @@ type: object properties: email: type: string + unsubscribe: + type: boolean birthday: type: string format: date @@ -35,3 +37,19 @@ properties: description: MUST be a valid VRChat /file/ url. example: 'https://api.vrchat.cloud/api/1/file/file_76dc2964-0ce8-41df-b2e7-8edf994fee31/1' minLength: 0 + contentFilters: + description: These tags begin with `content_` and control content gating + type: array + items: + $ref: ./Tag.yaml + displayName: + description: MUST specify currentPassword as well to change display name + type: string + revertDisplayName: + description: MUST specify currentPassword as well to revert display name + type: boolean + password: + description: MUST specify currentPassword as well to change password + type: string + currentPassword: + type: string diff --git a/openapi/components/responses/authentication/Get2FARecoveryCodesResponse.yaml b/openapi/components/responses/authentication/Get2FARecoveryCodesResponse.yaml new file mode 100644 index 00000000..7a4a0a62 --- /dev/null +++ b/openapi/components/responses/authentication/Get2FARecoveryCodesResponse.yaml @@ -0,0 +1,5 @@ +description: Returns the two factor recovery codes +content: + application/json: + schema: + $ref: ../../schemas/TwoFactorRecoveryCodes.yaml diff --git a/openapi/components/responses/users/CurrentPasswordRequiredError.yaml b/openapi/components/responses/users/CurrentPasswordRequiredError.yaml new file mode 100644 index 00000000..165e35c7 --- /dev/null +++ b/openapi/components/responses/users/CurrentPasswordRequiredError.yaml @@ -0,0 +1,5 @@ +description: Error response when a user attempts to change a property without supplying their current password. +content: + application/json: + schema: + $ref: ../../schemas/Error.yaml diff --git a/openapi/components/schemas/CurrentUser.yaml b/openapi/components/schemas/CurrentUser.yaml index f18d3c0c..99665fd5 100644 --- a/openapi/components/schemas/CurrentUser.yaml +++ b/openapi/components/schemas/CurrentUser.yaml @@ -42,6 +42,11 @@ properties: type: array items: type: string + contentFilters: + description: These tags begin with `content_` and control content gating + type: array + items: + $ref: ./Tag.yaml currentAvatar: $ref: ./AvatarID.yaml currentAvatarImageUrl: diff --git a/openapi/components/schemas/TwoFactorRecoveryCodes.yaml b/openapi/components/schemas/TwoFactorRecoveryCodes.yaml new file mode 100644 index 00000000..acded5a4 --- /dev/null +++ b/openapi/components/schemas/TwoFactorRecoveryCodes.yaml @@ -0,0 +1,20 @@ +title: TwoFactorRecoveryCodes +type: object +properties: + requiresTwoFactorAuth: + type: array + items: + type: string + otp: + type: array + items: + type: object + required: + - code + - used + properties: + code: + type: string + used: + type: boolean + From 0999d5d518f475255c44806b898b2d51b29dc31c Mon Sep 17 00:00:00 2001 From: Vinyarion <38413862+VinyarionHyarmendacil@users.noreply.github.com> Date: Tue, 13 May 2025 07:39:18 -0500 Subject: [PATCH 2/3] Update UpdateUserRequest.yaml --- openapi/components/requests/UpdateUserRequest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi/components/requests/UpdateUserRequest.yaml b/openapi/components/requests/UpdateUserRequest.yaml index 9dd0c88f..7e929ce9 100644 --- a/openapi/components/requests/UpdateUserRequest.yaml +++ b/openapi/components/requests/UpdateUserRequest.yaml @@ -41,7 +41,7 @@ properties: description: These tags begin with `content_` and control content gating type: array items: - $ref: ./Tag.yaml + $ref: ../schemas/Tag.yaml displayName: description: MUST specify currentPassword as well to change display name type: string From 39f5137ab30ba8446b5f2d6c26c343043b8adaea Mon Sep 17 00:00:00 2001 From: jellejurre Date: Tue, 13 May 2025 23:27:49 +0200 Subject: [PATCH 3/3] Fix path --- openapi/components/codeSamples/authentication.yaml | 4 ++-- openapi/components/paths.yaml | 4 ++-- openapi/components/paths/authentication.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openapi/components/codeSamples/authentication.yaml b/openapi/components/codeSamples/authentication.yaml index 9ce2c11f..26a2c0c3 100644 --- a/openapi/components/codeSamples/authentication.yaml +++ b/openapi/components/codeSamples/authentication.yaml @@ -29,11 +29,11 @@ -H "Content-Type: application/json" \ -b "auth={authCookie}" \ --data '{"code": "string"}' -/auth/twofactorauth/otp: +/auth/user/twofactorauth/otp: get: - lang: cURL source: >- - curl -X GET "https://api.vrchat.cloud/api/1/auth/twofactorauth/otp" \ + curl -X GET "https://api.vrchat.cloud/api/1/auth/user/twofactorauth/otp" \ -H "Content-Type: application/json" \ -b "auth={authCookie}" /auth/twofactorauth/otp/verify: diff --git a/openapi/components/paths.yaml b/openapi/components/paths.yaml index d7abfd7a..83b8489f 100644 --- a/openapi/components/paths.yaml +++ b/openapi/components/paths.yaml @@ -10,8 +10,8 @@ $ref: "./paths/authentication.yaml#/paths/~1auth~1user" "/auth/twofactorauth/totp/verify": $ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1totp~1verify" -"/auth/twofactorauth/otp": - $ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1otp" +"/auth/user/twofactorauth/otp": + $ref: "./paths/authentication.yaml#/paths/~1auth~1user~1twofactorauth~1otp" "/auth/twofactorauth/otp/verify": $ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1otp~1verify" "/auth/twofactorauth/emailotp/verify": diff --git a/openapi/components/paths/authentication.yaml b/openapi/components/paths/authentication.yaml index b07e56c0..c8f93729 100644 --- a/openapi/components/paths/authentication.yaml +++ b/openapi/components/paths/authentication.yaml @@ -112,12 +112,12 @@ paths: security: - authCookie: [] parameters: [] - /auth/twofactorauth/otp: + /auth/user/twofactorauth/otp: get: summary: Get 2FA Recovery codes operationId: getRecoveryCodes x-codeSamples: - $ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth~1otp/get" + $ref: "../codeSamples/authentication.yaml#/~1auth~1user~1twofactorauth~1otp/get" responses: '200': $ref: ../responses/authentication/Get2FARecoveryCodesResponse.yaml