Index

public.moocfi_outbound_handoffs

Description

Single-use sign-in handoffs that send a student from courses to mooc.fi, minted when the student asks to go there and redeemed by mooc.fi’s backend server to server. A row rather than a signed token so that redeeming is single use across replicas. Pruned a day after expiry.

Columns

Name Type Default Nullable Children Parents Comment
client_ip_hash text false Keyed hash of the IP the student minted the handoff from. mooc.fi forwards the IP its page was used from, and a redeem from another IP is refused without spending the handoff, so a link sent to someone else signs no one in.
created_at timestamp with time zone now() false Timestamp when the record was created.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted.
destination moocfi_handoff_destination false Where on mooc.fi the student is going.
expires_at timestamp with time zone false When the handoff stops being redeemable, a minute after it was minted at most.
external_completion_id uuid false public.external_completions The student’s mooc.fi completion the handoff is for. mooc.fi learns the student and the course from it, never from the request that minted the handoff.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
redeemed_at timestamp with time zone true When mooc.fi redeemed the handoff. Set once: a second redeem is refused.
token_digest bytea false SHA-256 of the token handed to the browser. The token itself is never stored.
updated_at timestamp with time zone now() false Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.

Constraints

Name Type Definition
moocfi_outbound_handoffs_client_ip_hash_not_null n NOT NULL client_ip_hash
moocfi_outbound_handoffs_created_at_not_null n NOT NULL created_at
moocfi_outbound_handoffs_destination_not_null n NOT NULL destination
moocfi_outbound_handoffs_expires_at_not_null n NOT NULL expires_at
moocfi_outbound_handoffs_external_completion_id_fkey FOREIGN KEY FOREIGN KEY (external_completion_id) REFERENCES external_completions(id)
moocfi_outbound_handoffs_external_completion_id_not_null n NOT NULL external_completion_id
moocfi_outbound_handoffs_id_not_null n NOT NULL id
moocfi_outbound_handoffs_pkey PRIMARY KEY PRIMARY KEY (id)
moocfi_outbound_handoffs_token_digest_not_null n NOT NULL token_digest
moocfi_outbound_handoffs_updated_at_not_null n NOT NULL updated_at

Indexes

Name Definition
idx_moocfi_outbound_handoffs_expires_at CREATE INDEX idx_moocfi_outbound_handoffs_expires_at ON public.moocfi_outbound_handoffs USING btree (expires_at)
moocfi_outbound_handoffs_pkey CREATE UNIQUE INDEX moocfi_outbound_handoffs_pkey ON public.moocfi_outbound_handoffs USING btree (id)
uq_moocfi_outbound_handoffs_token_digest CREATE UNIQUE INDEX uq_moocfi_outbound_handoffs_token_digest ON public.moocfi_outbound_handoffs USING btree (token_digest)

Triggers

Name Definition
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.moocfi_outbound_handoffs FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls