Function I/O
| Name | In | Out | Side | Purpose |
|---|---|---|---|---|
| RegisterWithInvite | ctx, RegisterInput | NewUserID | ErrInvalidCode | ErrEmailTaken | tx | Validates code, hashes password, inserts user, consumes invite. |
| decideInviteValid | row, now | true | ErrInvalidCode | pure | Checks existence, expiry, consumption state. |
Variables
| Name | Type | Scope | Purpose |
|---|---|---|---|
| inviteRow | InviteCodeRow | tx | Row read with SELECT FOR UPDATE; gates the rest of the flow. |
| passwordHash | string | tx | bcrypt/argon2 hash of the submitted password; plaintext is discarded. |
Internal data flow
Errors
| Name | When | Means |
|---|---|---|
| ErrInvalidCode | Row missing, expired, or already consumed. | 422 response with `invite_code` reason. |
| ErrEmailTaken | Unique violation on users.email. | 422 response with `email` reason. |