feat(api): declare identity contract for registration, verification, and sessions
This commit is contained in:
1 parent
197661145e
commit
653f3775f8
86 files changed
+11826
-148
No files matched your search
@@ -138,3 +138,100 @@ NotImplemented:
|
||||
code: not_implemented
|
||||
detail: This operation is not available yet.
|
||||
trace_id: 0d1e2f3a-4b5c-4d6e-9f7a-8b9c0d1e2f3a
|
||||
VerificationTokenInvalid:
|
||||
summary: The verification token is unknown, used, or replaced
|
||||
value:
|
||||
type: urn:lincodex:problem:verification_token_invalid
|
||||
title: Verification link is not valid
|
||||
status: 400
|
||||
code: verification_token_invalid
|
||||
detail: Request a new verification link, or sign in if the address is already verified.
|
||||
trace_id: 3b4c5d6e-7f8a-4b9c-8d0e-1f2a3b4c5d6e
|
||||
VerificationTokenExpired:
|
||||
summary: The verification token is past its lifetime
|
||||
value:
|
||||
type: urn:lincodex:problem:verification_token_expired
|
||||
title: Verification link expired
|
||||
status: 400
|
||||
code: verification_token_expired
|
||||
detail: Request a new verification link.
|
||||
trace_id: 4c5d6e7f-8a9b-4c0d-9e1f-2a3b4c5d6e7f
|
||||
VerificationTokenMalformed:
|
||||
summary: The token from the link is malformed
|
||||
value:
|
||||
type: urn:lincodex:problem:validation_failed
|
||||
title: Request validation failed
|
||||
status: 400
|
||||
code: validation_failed
|
||||
detail: One or more request fields are invalid.
|
||||
trace_id: 5d6e7f8a-9b0c-4d1e-8f2a-3b4c5d6e7f8a
|
||||
errors:
|
||||
- in: body
|
||||
pointer: /token
|
||||
code: invalid
|
||||
message: The value does not match the contract.
|
||||
InvalidCredentials:
|
||||
summary: Unknown email or wrong password
|
||||
value:
|
||||
type: urn:lincodex:problem:invalid_credentials
|
||||
title: Invalid email or password
|
||||
status: 401
|
||||
code: invalid_credentials
|
||||
detail: Check the email and password and try again.
|
||||
trace_id: 6e7f8a9b-0c1d-4e2f-9a3b-4c5d6e7f8a9b
|
||||
EmailNotVerified:
|
||||
summary: Correct credentials for an unverified email
|
||||
value:
|
||||
type: urn:lincodex:problem:email_not_verified
|
||||
title: Email not verified
|
||||
status: 403
|
||||
code: email_not_verified
|
||||
detail: Confirm the email address with the link from the verification message.
|
||||
trace_id: 7f8a9b0c-1d2e-4f3a-8b4c-5d6e7f8a9b0c
|
||||
CsrfCheckFailed:
|
||||
summary: Missing or wrong CSRF token, or a disallowed Origin
|
||||
value:
|
||||
type: urn:lincodex:problem:csrf_check_failed
|
||||
title: Cross-site request check failed
|
||||
status: 403
|
||||
code: csrf_check_failed
|
||||
detail: Read the current session to get a new CSRF token and repeat the request.
|
||||
trace_id: 8a9b0c1d-2e3f-4a4b-9c5d-6e7f8a9b0c1d
|
||||
RegistrationValidationFailed:
|
||||
summary: The password is too short and the consent text is outdated
|
||||
value:
|
||||
type: urn:lincodex:problem:validation_failed
|
||||
title: Request validation failed
|
||||
status: 400
|
||||
code: validation_failed
|
||||
detail: One or more request fields are invalid.
|
||||
trace_id: 9b0c1d2e-3f4a-4b5c-8d6e-7f8a9b0c1d2e
|
||||
errors:
|
||||
- in: body
|
||||
pointer: /password
|
||||
code: invalid
|
||||
message: The value does not match the contract.
|
||||
- in: body
|
||||
pointer: /consent_c1/text_version
|
||||
code: invalid
|
||||
message: The value does not match the contract.
|
||||
CandidateAccount:
|
||||
summary: A verified candidate on the questionnaire step
|
||||
value:
|
||||
id: 0f8b6c2e-4d1a-4e7b-9c3f-5a2d8e6b1c47
|
||||
email: candidate@example.com
|
||||
email_verified: true
|
||||
scenario: candidate
|
||||
onboarding_step: candidate_questionnaire
|
||||
created_at: "2026-10-05T09:30:00Z"
|
||||
CandidateSession:
|
||||
summary: Session of a verified candidate
|
||||
value:
|
||||
account:
|
||||
id: 0f8b6c2e-4d1a-4e7b-9c3f-5a2d8e6b1c47
|
||||
email: candidate@example.com
|
||||
email_verified: true
|
||||
scenario: candidate
|
||||
onboarding_step: candidate_questionnaire
|
||||
created_at: "2026-10-05T09:30:00Z"
|
||||
csrf_token: Xk4pR9tV2mQ7wL1sN8bC5dF0gH3jZ6yA9eU2iO7rT4c
|
||||
@@ -17,3 +17,39 @@ RetryAfter:
|
||||
minimum: 0
|
||||
maximum: 86400
|
||||
example: 30
|
||||
SessionCookieSet:
|
||||
description: >-
|
||||
Sets the session cookie `__Host-lincodex_session` with an opaque random
|
||||
value and the attributes `Path=/; Secure; HttpOnly; SameSite=Strict` and
|
||||
no Domain. The `__Host-` prefix makes the browser reject the cookie
|
||||
without Secure and Path=/ or with a Domain. Max-Age equals the remaining
|
||||
absolute session lifetime. The value is never readable by scripts or present in a
|
||||
body.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 4096
|
||||
pattern: "^__Host-lincodex_session="
|
||||
example: __Host-lincodex_session=opaque-session-value; Path=/; Max-Age=604800; Secure; HttpOnly; SameSite=Strict
|
||||
SessionCookieCleared:
|
||||
description: >-
|
||||
Removes the session cookie with an empty value, `Max-Age=0`, and the
|
||||
same attributes it was set with.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 4096
|
||||
pattern: "^__Host-lincodex_session="
|
||||
example: __Host-lincodex_session=; Path=/; Max-Age=0; Secure; HttpOnly; SameSite=Strict
|
||||
CacheControlNoStore:
|
||||
description: >-
|
||||
`no-store`: the response carries account or session data that browsers
|
||||
and intermediaries must not keep.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- no-store
|
||||
example: no-store
|
||||
@@ -157,3 +157,59 @@ Problem:
|
||||
$ref: ./examples.yml#/Internal
|
||||
not_implemented:
|
||||
$ref: ./examples.yml#/NotImplemented
|
||||
RegistrationValidationFailed:
|
||||
description: >-
|
||||
The body does not match the contract or violates a registration rule:
|
||||
a password outside 15-128 characters or on the blocklist, or a consent
|
||||
text version that is not the current one; code validation_failed with
|
||||
body pointers. An email that already belongs to an account is never a
|
||||
validation error.
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: ./schemas.yml#/Problem
|
||||
examples:
|
||||
validation_failed:
|
||||
$ref: ./examples.yml#/RegistrationValidationFailed
|
||||
EmailVerificationFailed:
|
||||
description: >-
|
||||
The token cannot verify an email. Code verification_token_expired means
|
||||
the token is past its lifetime; verification_token_invalid means it is
|
||||
unknown, already used, or replaced by a newer link; validation_failed
|
||||
with the pointer `/token` means the token is malformed. Nothing was
|
||||
changed in any case.
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: ./schemas.yml#/Problem
|
||||
examples:
|
||||
verification_token_expired:
|
||||
$ref: ./examples.yml#/VerificationTokenExpired
|
||||
verification_token_invalid:
|
||||
$ref: ./examples.yml#/VerificationTokenInvalid
|
||||
validation_failed:
|
||||
$ref: ./examples.yml#/VerificationTokenMalformed
|
||||
InvalidCredentials:
|
||||
description: >-
|
||||
The email and password do not match an account; code
|
||||
invalid_credentials. An unknown email and a wrong password get the same
|
||||
response.
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: ./schemas.yml#/Problem
|
||||
examples:
|
||||
invalid_credentials:
|
||||
$ref: ./examples.yml#/InvalidCredentials
|
||||
CsrfCheckFailed:
|
||||
description: >-
|
||||
The request failed cross-site request protection: the X-CSRF-Token
|
||||
header is missing or does not belong to the session, or the Origin is
|
||||
not allowed; code csrf_check_failed. Nothing was changed.
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: ./schemas.yml#/Problem
|
||||
examples:
|
||||
csrf_check_failed:
|
||||
$ref: ./examples.yml#/CsrfCheckFailed
|
||||
@@ -33,6 +33,233 @@ HealthResponse:
|
||||
type: string
|
||||
enum:
|
||||
- ok
|
||||
EmailAddress:
|
||||
type: string
|
||||
format: email
|
||||
minLength: 3
|
||||
maxLength: 254
|
||||
description: Account email address. The server compares addresses without regard to letter case and never reveals in a response whether an address belongs to an account.
|
||||
examples:
|
||||
- candidate@example.com
|
||||
NewPassword:
|
||||
type: string
|
||||
minLength: 15
|
||||
maxLength: 128
|
||||
description: Password chosen at registration. The server normalizes it to Unicode NFKC, as NIST SP 800-63B-4 recommends, and then requires 15 to 128 Unicode code points; a value that the schema accepts can still fail this check after normalization. The 15-character minimum follows NIST SP 800-63B-4 for a password used as the only authentication factor; there are no composition rules. The upper bound limits the cost of password hashing. Generated client validators count UTF-16 code units, so a password with characters outside the Basic Multilingual Plane can pass the client check and fail on the server; a later client check should count code points. A password on the server blocklist of common or breached passwords answers 400 validation_failed with the pointer `/password`. The value is never returned, logged, or echoed in a problem.
|
||||
LoginPassword:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 128
|
||||
description: Password entered at login. The server applies the same NFKC normalization as at registration before it verifies the hash. Only the hashing bound applies, so a later change of the registration policy does not lock out existing accounts and a login error does not reveal the policy. The value is never returned, logged, or echoed in a problem.
|
||||
AccountScenario:
|
||||
type: string
|
||||
description: 'Scenario chosen at registration: `candidate` looks for an offer and passes the assessment, `employer` represents a company that searches for candidates. The scenario selects the onboarding steps.'
|
||||
enum:
|
||||
- candidate
|
||||
- employer
|
||||
OnboardingStep:
|
||||
type: string
|
||||
description: 'Saved onboarding step that the account returns to after login. The server stores it and advances it as each step completes; clients route by it and never set it directly.
|
||||
|
||||
|
||||
- candidate_consents: candidate consents beyond C1, which was given at registration.
|
||||
|
||||
- candidate_profile: candidate profile.
|
||||
|
||||
- candidate_questionnaire: candidate questionnaire.
|
||||
|
||||
- candidate_assessment: choice of the expected grade and the assessment.
|
||||
|
||||
- employer_company: company profile of the employer.
|
||||
|
||||
- completed: onboarding is finished; the client opens the scenario home.
|
||||
|
||||
|
||||
Candidate steps follow the order above and end with completed; the employer has employer_company and then completed. New steps may be added as onboarding grows; adding a value is a contract change.'
|
||||
enum:
|
||||
- candidate_consents
|
||||
- candidate_profile
|
||||
- candidate_questionnaire
|
||||
- candidate_assessment
|
||||
- employer_company
|
||||
- completed
|
||||
ConsentPurpose:
|
||||
type: string
|
||||
description: 'Consent whose text the client may read before an account exists. Only the consents given at registration are listed: `c1` is the consent to the processing of personal data.'
|
||||
enum:
|
||||
- c1
|
||||
ConsentText:
|
||||
type: object
|
||||
description: Currently published consent text. The server stores an acceptance with `text_version` and the hash of exactly this text.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- purpose
|
||||
- text_version
|
||||
- text
|
||||
- published_at
|
||||
properties:
|
||||
purpose:
|
||||
$ref: '#/ConsentPurpose'
|
||||
text_version:
|
||||
$ref: '#/ConsentTextVersion'
|
||||
text:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 100000
|
||||
description: Full consent text in plain UTF-8; paragraphs are separated by an empty line. The client shows it as text, never as HTML.
|
||||
published_at:
|
||||
$ref: '#/Timestamp'
|
||||
ConsentTextVersion:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 64
|
||||
pattern: ^[A-Za-z0-9._-]+$
|
||||
description: Identifier of the published consent text that the user saw and accepted. The server stores the acceptance with this version and the hash of its text; the client never sends or receives the hash.
|
||||
examples:
|
||||
- c1-2026-10-01
|
||||
PersonalDataConsentAcceptance:
|
||||
type: object
|
||||
description: Consent C1 to the processing of personal data, given at registration. The client reads the current text and its version with GetConsentText(c1) and sends that version here. A version that is not the currently published one answers 400 validation_failed with the pointer `/consent_c1/text_version`; the client then reads the text again and asks the user to accept the new version. Unknown fields are rejected, so registration cannot carry any other consent; in particular, C4 is never part of registration.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- text_version
|
||||
- accepted
|
||||
properties:
|
||||
text_version:
|
||||
$ref: '#/ConsentTextVersion'
|
||||
accepted:
|
||||
type: boolean
|
||||
enum:
|
||||
- true
|
||||
description: Explicit acceptance. Only true is valid.
|
||||
RegistrationRequest:
|
||||
type: object
|
||||
description: New account with its scenario and consent C1.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
- scenario
|
||||
- consent_c1
|
||||
properties:
|
||||
email:
|
||||
$ref: '#/EmailAddress'
|
||||
password:
|
||||
$ref: '#/NewPassword'
|
||||
scenario:
|
||||
$ref: '#/AccountScenario'
|
||||
consent_c1:
|
||||
$ref: '#/PersonalDataConsentAcceptance'
|
||||
EmailVerificationResendRequest:
|
||||
type: object
|
||||
description: Address that should receive a new verification link.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email
|
||||
properties:
|
||||
email:
|
||||
$ref: '#/EmailAddress'
|
||||
IdentityRequestAccepted:
|
||||
type: object
|
||||
description: Neutral acknowledgement. Its content is identical whether or not the address belongs to an account or is already verified, so the response does not enumerate accounts. The client tells the user to check the mailbox.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- accepted
|
||||
VerificationToken:
|
||||
type: string
|
||||
minLength: 32
|
||||
maxLength: 128
|
||||
pattern: ^[A-Za-z0-9_-]+$
|
||||
description: 'One-time raw token copied from the verification link. It is request input only: the server stores only its hash and never returns a token.'
|
||||
EmailVerificationRequest:
|
||||
type: object
|
||||
description: Token from the email verification link.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- token
|
||||
properties:
|
||||
token:
|
||||
$ref: '#/VerificationToken'
|
||||
EmailVerificationResult:
|
||||
type: object
|
||||
description: Result of a successful email verification. It does not start a session; the user signs in next and continues from `onboarding_step`.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email_verified
|
||||
- scenario
|
||||
- onboarding_step
|
||||
properties:
|
||||
email_verified:
|
||||
type: boolean
|
||||
enum:
|
||||
- true
|
||||
description: Always true in a successful response.
|
||||
scenario:
|
||||
$ref: '#/AccountScenario'
|
||||
onboarding_step:
|
||||
$ref: '#/OnboardingStep'
|
||||
LoginRequest:
|
||||
type: object
|
||||
description: Email and password of the account.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
properties:
|
||||
email:
|
||||
$ref: '#/EmailAddress'
|
||||
password:
|
||||
$ref: '#/LoginPassword'
|
||||
CsrfToken:
|
||||
type: string
|
||||
minLength: 32
|
||||
maxLength: 128
|
||||
pattern: ^[A-Za-z0-9_-]+$
|
||||
description: CSRF token bound to the current session. The client keeps it in memory only and sends it in the X-CSRF-Token header of every mutating request that requires a session. It changes when a new session starts.
|
||||
Account:
|
||||
type: object
|
||||
description: Current account view. It never contains password hashes, token hashes, session identifiers, or other storage secrets.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- email
|
||||
- email_verified
|
||||
- scenario
|
||||
- onboarding_step
|
||||
- created_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Account identifier.
|
||||
email:
|
||||
$ref: '#/EmailAddress'
|
||||
email_verified:
|
||||
type: boolean
|
||||
description: Whether the address is verified. A session exists only for a verified account, so this is true in every current response.
|
||||
scenario:
|
||||
$ref: '#/AccountScenario'
|
||||
onboarding_step:
|
||||
$ref: '#/OnboardingStep'
|
||||
created_at:
|
||||
$ref: '#/Timestamp'
|
||||
Session:
|
||||
type: object
|
||||
description: 'Current session as the client may see it: the account and the CSRF token. The session identifier itself travels only in the HttpOnly session cookie and never appears in a body.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- account
|
||||
- csrf_token
|
||||
properties:
|
||||
account:
|
||||
$ref: '#/Account'
|
||||
csrf_token:
|
||||
$ref: '#/CsrfToken'
|
||||
Problem:
|
||||
type: object
|
||||
description: Problem details (RFC 9457) returned with the application/problem+json media type for every error response. `code` is the stable, machine-readable reason; clients branch on it rather than on `title`, `detail`, or the HTTP status alone. The body never contains internal error text, stack traces, SQL, file paths, credentials, contact data, or echoed request values.
|
||||
@@ -89,10 +316,20 @@ ProblemCode:
|
||||
|
||||
- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.
|
||||
|
||||
- verification_token_invalid (400): the email verification token is unknown, already used, or replaced by a newer one; request a new link or sign in.
|
||||
|
||||
- verification_token_expired (400): the email verification token is past its lifetime; request a new link.
|
||||
|
||||
- unauthenticated (401): no valid session or credentials.
|
||||
|
||||
- invalid_credentials (401): the email and password do not match an account; an unknown email and a wrong password are not distinguished.
|
||||
|
||||
- forbidden (403): the caller is authenticated but not allowed.
|
||||
|
||||
- email_not_verified (403): the credentials are correct but the email is not verified yet.
|
||||
|
||||
- csrf_check_failed (403): the request failed cross-site request protection: a missing or wrong X-CSRF-Token or a disallowed Origin.
|
||||
|
||||
- not_found (404): the route or object does not exist or is not visible.
|
||||
|
||||
- method_not_allowed (405): the route does not support the method.
|
||||
@@ -118,8 +355,13 @@ ProblemCode:
|
||||
- not_implemented (501): the operation is in the contract but not implemented yet.'
|
||||
enum:
|
||||
- validation_failed
|
||||
- verification_token_invalid
|
||||
- verification_token_expired
|
||||
- unauthenticated
|
||||
- invalid_credentials
|
||||
- forbidden
|
||||
- email_not_verified
|
||||
- csrf_check_failed
|
||||
- not_found
|
||||
- method_not_allowed
|
||||
- idempotency_in_progress
|
||||
|
||||
@@ -0,0 +1,283 @@
|
||||
schemas:
|
||||
EmailAddress:
|
||||
type: string
|
||||
format: email
|
||||
minLength: 3
|
||||
maxLength: 254
|
||||
description: >-
|
||||
Account email address. The server compares addresses without regard to
|
||||
letter case and never reveals in a response whether an address belongs
|
||||
to an account.
|
||||
examples:
|
||||
- candidate@example.com
|
||||
NewPassword:
|
||||
type: string
|
||||
minLength: 15
|
||||
maxLength: 128
|
||||
description: >-
|
||||
Password chosen at registration. The server normalizes it to Unicode
|
||||
NFKC, as NIST SP 800-63B-4 recommends, and then requires 15 to 128 Unicode
|
||||
code points; a value that the schema accepts can still fail this check
|
||||
after normalization. The 15-character minimum follows NIST SP
|
||||
800-63B-4 for a password used as the only authentication factor; there
|
||||
are no composition rules. The upper bound limits the cost of password
|
||||
hashing. Generated client validators count UTF-16 code units, so a
|
||||
password with characters outside the Basic Multilingual Plane can pass
|
||||
the client check and fail on the server; a later client check should
|
||||
count code points. A password on the server blocklist of common or
|
||||
breached passwords answers 400 validation_failed with the pointer
|
||||
`/password`. The value is never returned, logged, or echoed in a
|
||||
problem.
|
||||
LoginPassword:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 128
|
||||
description: >-
|
||||
Password entered at login. The server applies the same NFKC
|
||||
normalization as at registration before it verifies the hash. Only the
|
||||
hashing bound applies, so a later change of the registration policy
|
||||
does not lock out existing accounts and a login error does not reveal
|
||||
the policy. The value is never returned, logged, or echoed in a
|
||||
problem.
|
||||
AccountScenario:
|
||||
type: string
|
||||
description: >-
|
||||
Scenario chosen at registration: `candidate` looks for an offer and
|
||||
passes the assessment, `employer` represents a company that searches
|
||||
for candidates. The scenario selects the onboarding steps.
|
||||
enum:
|
||||
- candidate
|
||||
- employer
|
||||
OnboardingStep:
|
||||
type: string
|
||||
description: |-
|
||||
Saved onboarding step that the account returns to after login. The server stores it and advances it as each step completes; clients route by it and never set it directly.
|
||||
|
||||
- candidate_consents: candidate consents beyond C1, which was given at registration.
|
||||
- candidate_profile: candidate profile.
|
||||
- candidate_questionnaire: candidate questionnaire.
|
||||
- candidate_assessment: choice of the expected grade and the assessment.
|
||||
- employer_company: company profile of the employer.
|
||||
- completed: onboarding is finished; the client opens the scenario home.
|
||||
|
||||
Candidate steps follow the order above and end with completed; the employer has employer_company and then completed. New steps may be added as onboarding grows; adding a value is a contract change.
|
||||
enum:
|
||||
- candidate_consents
|
||||
- candidate_profile
|
||||
- candidate_questionnaire
|
||||
- candidate_assessment
|
||||
- employer_company
|
||||
- completed
|
||||
ConsentPurpose:
|
||||
type: string
|
||||
description: >-
|
||||
Consent whose text the client may read before an account exists. Only
|
||||
the consents given at registration are listed: `c1` is the consent to
|
||||
the processing of personal data.
|
||||
enum:
|
||||
- c1
|
||||
ConsentText:
|
||||
type: object
|
||||
description: >-
|
||||
Currently published consent text. The server stores an acceptance with
|
||||
`text_version` and the hash of exactly this text.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- purpose
|
||||
- text_version
|
||||
- text
|
||||
- published_at
|
||||
properties:
|
||||
purpose:
|
||||
$ref: "#/schemas/ConsentPurpose"
|
||||
text_version:
|
||||
$ref: "#/schemas/ConsentTextVersion"
|
||||
text:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 100000
|
||||
description: >-
|
||||
Full consent text in plain UTF-8; paragraphs are separated by an
|
||||
empty line. The client shows it as text, never as HTML.
|
||||
published_at:
|
||||
$ref: "./common_schemas.yml#/schemas/Timestamp"
|
||||
ConsentTextVersion:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 64
|
||||
pattern: "^[A-Za-z0-9._-]+$"
|
||||
description: >-
|
||||
Identifier of the published consent text that the user saw and
|
||||
accepted. The server stores the acceptance with this version and the
|
||||
hash of its text; the client never sends or receives the hash.
|
||||
examples:
|
||||
- c1-2026-10-01
|
||||
PersonalDataConsentAcceptance:
|
||||
type: object
|
||||
description: >-
|
||||
Consent C1 to the processing of personal data, given at registration.
|
||||
The client reads the current text and its version with
|
||||
GetConsentText(c1) and sends that version here. A version that is not
|
||||
the currently published one answers 400 validation_failed with the
|
||||
pointer `/consent_c1/text_version`; the client then reads the text
|
||||
again and asks the user to accept the new version. Unknown fields are
|
||||
rejected, so registration cannot carry any other consent; in
|
||||
particular, C4 is never part of registration.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- text_version
|
||||
- accepted
|
||||
properties:
|
||||
text_version:
|
||||
$ref: "#/schemas/ConsentTextVersion"
|
||||
accepted:
|
||||
type: boolean
|
||||
enum:
|
||||
- true
|
||||
description: Explicit acceptance. Only true is valid.
|
||||
RegistrationRequest:
|
||||
type: object
|
||||
description: New account with its scenario and consent C1.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
- scenario
|
||||
- consent_c1
|
||||
properties:
|
||||
email:
|
||||
$ref: "#/schemas/EmailAddress"
|
||||
password:
|
||||
$ref: "#/schemas/NewPassword"
|
||||
scenario:
|
||||
$ref: "#/schemas/AccountScenario"
|
||||
consent_c1:
|
||||
$ref: "#/schemas/PersonalDataConsentAcceptance"
|
||||
EmailVerificationResendRequest:
|
||||
type: object
|
||||
description: Address that should receive a new verification link.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email
|
||||
properties:
|
||||
email:
|
||||
$ref: "#/schemas/EmailAddress"
|
||||
IdentityRequestAccepted:
|
||||
type: object
|
||||
description: >-
|
||||
Neutral acknowledgement. Its content is identical whether or not the
|
||||
address belongs to an account or is already verified, so the response
|
||||
does not enumerate accounts. The client tells the user to check the
|
||||
mailbox.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- accepted
|
||||
VerificationToken:
|
||||
type: string
|
||||
minLength: 32
|
||||
maxLength: 128
|
||||
pattern: "^[A-Za-z0-9_-]+$"
|
||||
description: >-
|
||||
One-time raw token copied from the verification link. It is request
|
||||
input only: the server stores only its hash and never returns a token.
|
||||
EmailVerificationRequest:
|
||||
type: object
|
||||
description: Token from the email verification link.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- token
|
||||
properties:
|
||||
token:
|
||||
$ref: "#/schemas/VerificationToken"
|
||||
EmailVerificationResult:
|
||||
type: object
|
||||
description: >-
|
||||
Result of a successful email verification. It does not start a
|
||||
session; the user signs in next and continues from `onboarding_step`.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email_verified
|
||||
- scenario
|
||||
- onboarding_step
|
||||
properties:
|
||||
email_verified:
|
||||
type: boolean
|
||||
enum:
|
||||
- true
|
||||
description: Always true in a successful response.
|
||||
scenario:
|
||||
$ref: "#/schemas/AccountScenario"
|
||||
onboarding_step:
|
||||
$ref: "#/schemas/OnboardingStep"
|
||||
LoginRequest:
|
||||
type: object
|
||||
description: Email and password of the account.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
properties:
|
||||
email:
|
||||
$ref: "#/schemas/EmailAddress"
|
||||
password:
|
||||
$ref: "#/schemas/LoginPassword"
|
||||
CsrfToken:
|
||||
type: string
|
||||
minLength: 32
|
||||
maxLength: 128
|
||||
pattern: "^[A-Za-z0-9_-]+$"
|
||||
description: >-
|
||||
CSRF token bound to the current session. The client keeps it in memory
|
||||
only and sends it in the X-CSRF-Token header of every mutating request
|
||||
that requires a session. It changes when a new session starts.
|
||||
Account:
|
||||
type: object
|
||||
description: >-
|
||||
Current account view. It never contains password hashes, token hashes,
|
||||
session identifiers, or other storage secrets.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- email
|
||||
- email_verified
|
||||
- scenario
|
||||
- onboarding_step
|
||||
- created_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Account identifier.
|
||||
email:
|
||||
$ref: "#/schemas/EmailAddress"
|
||||
email_verified:
|
||||
type: boolean
|
||||
description: >-
|
||||
Whether the address is verified. A session exists only for a
|
||||
verified account, so this is true in every current response.
|
||||
scenario:
|
||||
$ref: "#/schemas/AccountScenario"
|
||||
onboarding_step:
|
||||
$ref: "#/schemas/OnboardingStep"
|
||||
created_at:
|
||||
$ref: "./common_schemas.yml#/schemas/Timestamp"
|
||||
Session:
|
||||
type: object
|
||||
description: >-
|
||||
Current session as the client may see it: the account and the CSRF
|
||||
token. The session identifier itself travels only in the HttpOnly
|
||||
session cookie and never appears in a body.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- account
|
||||
- csrf_token
|
||||
properties:
|
||||
account:
|
||||
$ref: "#/schemas/Account"
|
||||
csrf_token:
|
||||
$ref: "#/schemas/CsrfToken"
|
||||
@@ -70,8 +70,13 @@ schemas:
|
||||
Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.
|
||||
|
||||
- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.
|
||||
- verification_token_invalid (400): the email verification token is unknown, already used, or replaced by a newer one; request a new link or sign in.
|
||||
- verification_token_expired (400): the email verification token is past its lifetime; request a new link.
|
||||
- unauthenticated (401): no valid session or credentials.
|
||||
- invalid_credentials (401): the email and password do not match an account; an unknown email and a wrong password are not distinguished.
|
||||
- forbidden (403): the caller is authenticated but not allowed.
|
||||
- email_not_verified (403): the credentials are correct but the email is not verified yet.
|
||||
- csrf_check_failed (403): the request failed cross-site request protection: a missing or wrong X-CSRF-Token or a disallowed Origin.
|
||||
- not_found (404): the route or object does not exist or is not visible.
|
||||
- method_not_allowed (405): the route does not support the method.
|
||||
- idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.
|
||||
@@ -86,8 +91,13 @@ schemas:
|
||||
- not_implemented (501): the operation is in the contract but not implemented yet.
|
||||
enum:
|
||||
- validation_failed
|
||||
- verification_token_invalid
|
||||
- verification_token_expired
|
||||
- unauthenticated
|
||||
- invalid_credentials
|
||||
- forbidden
|
||||
- email_not_verified
|
||||
- csrf_check_failed
|
||||
- not_found
|
||||
- method_not_allowed
|
||||
- idempotency_in_progress
|
||||
|
||||
Reference in new issue
Block a user