@oxy.so/contracts 7.2.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/age.js +126 -0
- package/dist/cjs/client/contentClaims.js +17 -1
- package/dist/cjs/client/index.js +17 -3
- package/dist/cjs/client/safety.js +10 -1
- package/dist/cjs/contentClaims.js +51 -3
- package/dist/cjs/index.js +26 -14
- package/dist/cjs/safety.js +14 -1
- package/dist/cjs/signIn.js +9 -0
- package/dist/cjs/userResponse.js +15 -31
- package/dist/esm/client/age.js +117 -0
- package/dist/esm/client/contentClaims.js +16 -0
- package/dist/esm/client/index.js +3 -2
- package/dist/esm/client/safety.js +9 -0
- package/dist/esm/contentClaims.js +50 -4
- package/dist/esm/index.js +1 -0
- package/dist/esm/safety.js +14 -1
- package/dist/esm/signIn.js +9 -0
- package/dist/esm/userResponse.js +15 -31
- package/dist/types/client/age.d.ts +94 -0
- package/dist/types/client/contentClaims.d.ts +17 -0
- package/dist/types/client/index.d.ts +4 -2
- package/dist/types/client/safety.d.ts +13 -0
- package/dist/types/contentClaims.d.ts +40 -7
- package/dist/types/externalIdentity.d.ts +5 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/inference/embeddings.d.ts +2 -2
- package/dist/types/inference/errors.d.ts +2 -2
- package/dist/types/inference/inbox.d.ts +1 -1
- package/dist/types/inference/realtime.d.ts +2 -2
- package/dist/types/inference/streamEvents.d.ts +2 -2
- package/dist/types/oxyRecordTypes.d.ts +1 -1
- package/dist/types/safety.d.ts +24 -0
- package/dist/types/signIn.d.ts +1 -0
- package/dist/types/userResponse.d.ts +21 -1
- package/package.json +2 -2
package/dist/cjs/userResponse.js
CHANGED
|
@@ -35,6 +35,7 @@ const stringChecks_1 = require("./stringChecks");
|
|
|
35
35
|
* `require()`).
|
|
36
36
|
*/
|
|
37
37
|
const zod_1 = require("zod");
|
|
38
|
+
const age_1 = require("./client/age");
|
|
38
39
|
const userResponse_1 = require("./client/userResponse");
|
|
39
40
|
const identity_1 = require("./identity");
|
|
40
41
|
const accountGraph_1 = require("./accountGraph");
|
|
@@ -55,25 +56,6 @@ exports.themePreferenceSchema = zod_1.z.object({
|
|
|
55
56
|
mode: zod_1.z.enum(['light', 'dark', 'system']),
|
|
56
57
|
colorPreset: zod_1.z.string(),
|
|
57
58
|
});
|
|
58
|
-
/**
|
|
59
|
-
* The earliest calendar year `dateOfBirthSchema` accepts.
|
|
60
|
-
*
|
|
61
|
-
* Not a real biological bound — it exists to catch an obviously-transposed
|
|
62
|
-
* year (`1027` for `2027`, a stray OCR/typo digit) with a clear message
|
|
63
|
-
* instead of the value quietly becoming a 150-year-old account. 1900 is
|
|
64
|
-
* generous enough that no living person's real birthdate is rejected by it.
|
|
65
|
-
*/
|
|
66
|
-
const MIN_BIRTH_YEAR = 1900;
|
|
67
|
-
/**
|
|
68
|
-
* `true` when `year`/`month`/`day` name a date that actually exists on the
|
|
69
|
-
* Gregorian calendar — the check `z.string().regex(...)` alone cannot make,
|
|
70
|
-
* since the regex only constrains digit COUNT and would pass `2024-02-30`.
|
|
71
|
-
*/
|
|
72
|
-
function isRealCalendarDate(year, month, day) {
|
|
73
|
-
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
74
|
-
const daysInMonth = [31, isLeapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
75
|
-
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth[month - 1];
|
|
76
|
-
}
|
|
77
59
|
/**
|
|
78
60
|
* A date of birth, `YYYY-MM-DD`, the sole structured representation this
|
|
79
61
|
* platform stores going forward (`users.date_of_birth` — see
|
|
@@ -92,23 +74,16 @@ function isRealCalendarDate(year, month, day) {
|
|
|
92
74
|
* and not after today (comparing the zero-padded ISO strings directly is
|
|
93
75
|
* a valid, simpler stand-in for a numeric comparison here, since two
|
|
94
76
|
* `YYYY-MM-DD` strings of equal length sort exactly the way their dates
|
|
95
|
-
* do). "Today" is UTC — see `
|
|
77
|
+
* do). "Today" is UTC — see `ageInYears` in `client/age.ts` for why
|
|
96
78
|
* a date with no timezone of its own is evaluated in UTC rather than any
|
|
97
79
|
* particular caller's local zone.
|
|
98
80
|
*/
|
|
99
81
|
exports.dateOfBirthSchema = zod_1.z
|
|
100
82
|
.string()
|
|
101
|
-
.regex(
|
|
102
|
-
.refine(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, { message: 'dateOfBirth is not a real calendar date' })
|
|
106
|
-
.refine((value) => Number(value.slice(0, 4)) >= MIN_BIRTH_YEAR, {
|
|
107
|
-
message: `dateOfBirth must not be before ${MIN_BIRTH_YEAR}`,
|
|
108
|
-
})
|
|
109
|
-
.refine((value) => value <= new Date().toISOString().slice(0, 10), {
|
|
110
|
-
message: 'dateOfBirth must not be in the future',
|
|
111
|
-
});
|
|
83
|
+
.regex(age_1.DATE_OF_BIRTH_PATTERN, age_1.DATE_OF_BIRTH_MESSAGES.format)
|
|
84
|
+
.refine(age_1.isRealCalendarDate, { message: age_1.DATE_OF_BIRTH_MESSAGES.calendar })
|
|
85
|
+
.refine(age_1.isBirthYearInRange, { message: age_1.DATE_OF_BIRTH_MESSAGES.tooEarly })
|
|
86
|
+
.refine((value) => (0, age_1.isNotAfterToday)(value), { message: age_1.DATE_OF_BIRTH_MESSAGES.future });
|
|
112
87
|
/**
|
|
113
88
|
* The canonical user object emitted by `formatUserResponse`.
|
|
114
89
|
*
|
|
@@ -158,6 +133,15 @@ exports.userResponseSchema = zod_1.z
|
|
|
158
133
|
* not decided here.
|
|
159
134
|
*/
|
|
160
135
|
isAdult: zod_1.z.boolean().optional(),
|
|
136
|
+
/**
|
|
137
|
+
* The account's age band (ADR 0067), derived from `dateOfBirth` on every
|
|
138
|
+
* read and never stored. Absent when there is no date of birth: "unknown"
|
|
139
|
+
* is neither an adult nor a minor. The owner reads it on their own
|
|
140
|
+
* profile, and an Oxy service reads it on the session it validates
|
|
141
|
+
* (`POST /safety/service/session`); it never rides a public profile, and
|
|
142
|
+
* the date itself never leaves the owner's view.
|
|
143
|
+
*/
|
|
144
|
+
ageBand: zod_1.z.enum(age_1.AGE_BANDS).optional(),
|
|
161
145
|
/** Avatar file id (string) or null. */
|
|
162
146
|
avatar: zod_1.z.string().nullable().optional(),
|
|
163
147
|
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Age bands (ADR 0067): the one answer every Oxy app gets to "how old is this
|
|
3
|
+
* person, as far as protection goes".
|
|
4
|
+
*
|
|
5
|
+
* A band is DERIVED from the account's date of birth on every read and never
|
|
6
|
+
* stored: it changes on a birthday without any write touching the row. An
|
|
7
|
+
* application never receives the date itself, only the band.
|
|
8
|
+
*
|
|
9
|
+
* - `under13`: below {@link MINIMUM_UNSUPERVISED_AGE_YEARS}. Such an account
|
|
10
|
+
* exists only under supervision (ADR 0041); sign-up creates it awaiting a
|
|
11
|
+
* guardian.
|
|
12
|
+
* - `teen`: old enough for an account of their own, not yet an adult. Apps
|
|
13
|
+
* apply their protective defaults.
|
|
14
|
+
* - `adult`: at least {@link ADULT_AGE_YEARS}.
|
|
15
|
+
*
|
|
16
|
+
* An account with no date of birth has NO band (`undefined`), which is distinct
|
|
17
|
+
* from every value here: "unknown" is never read as "adult" or as "minor".
|
|
18
|
+
*/
|
|
19
|
+
export const AGE_BANDS = ['under13', 'teen', 'adult'];
|
|
20
|
+
/**
|
|
21
|
+
* The earliest calendar year a date of birth may name.
|
|
22
|
+
*
|
|
23
|
+
* Not a biological bound: it catches an obviously transposed year (`1027` for
|
|
24
|
+
* `2027`) with a clear message instead of a 150-year-old account. No living
|
|
25
|
+
* person's real date is refused by it. The server's schema and every picker
|
|
26
|
+
* read this one value, so a picker cannot offer a date the API refuses.
|
|
27
|
+
*/
|
|
28
|
+
export const MIN_BIRTH_YEAR = 1900;
|
|
29
|
+
/** The wire format of a date of birth: `YYYY-MM-DD`, nothing looser. */
|
|
30
|
+
export const DATE_OF_BIRTH_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a `YYYY-MM-DD` string names a day that exists on the Gregorian
|
|
33
|
+
* calendar. The pattern only constrains digit count and would pass `2024-02-30`.
|
|
34
|
+
*/
|
|
35
|
+
export function isRealCalendarDate(value) {
|
|
36
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
37
|
+
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
38
|
+
const daysInMonth = [31, isLeapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
39
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth[month - 1];
|
|
40
|
+
}
|
|
41
|
+
/** Whether a `YYYY-MM-DD` string is not before {@link MIN_BIRTH_YEAR}. */
|
|
42
|
+
export function isBirthYearInRange(value) {
|
|
43
|
+
return Number(value.slice(0, 4)) >= MIN_BIRTH_YEAR;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether a `YYYY-MM-DD` string is today (UTC) or earlier. Two zero-padded ISO
|
|
47
|
+
* dates of equal length sort exactly as their dates do.
|
|
48
|
+
*/
|
|
49
|
+
export function isNotAfterToday(value, today = new Date()) {
|
|
50
|
+
return value <= today.toISOString().slice(0, 10);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* What each date-of-birth rule says when it fails. The server's schema and the
|
|
54
|
+
* client's check word a refusal identically because both read these.
|
|
55
|
+
*/
|
|
56
|
+
export const DATE_OF_BIRTH_MESSAGES = {
|
|
57
|
+
format: 'dateOfBirth must be an ISO 8601 calendar date (YYYY-MM-DD)',
|
|
58
|
+
calendar: 'dateOfBirth is not a real calendar date',
|
|
59
|
+
tooEarly: `dateOfBirth must not be before ${MIN_BIRTH_YEAR}`,
|
|
60
|
+
future: 'dateOfBirth must not be in the future',
|
|
61
|
+
};
|
|
62
|
+
/** Below this age an account exists only under supervision. */
|
|
63
|
+
export const MINIMUM_UNSUPERVISED_AGE_YEARS = 13;
|
|
64
|
+
/** From this age an account is an adult's. */
|
|
65
|
+
export const ADULT_AGE_YEARS = 18;
|
|
66
|
+
/**
|
|
67
|
+
* Whole years between an ISO calendar date (`YYYY-MM-DD`) and `today`, both
|
|
68
|
+
* read in UTC.
|
|
69
|
+
*
|
|
70
|
+
* UTC because a date of birth has no time of day and no zone of its own, so
|
|
71
|
+
* there is no authoritative zone to evaluate it in; UTC is the one every server
|
|
72
|
+
* and every client agrees on without configuration. The effect is a band that
|
|
73
|
+
* can change up to a day before or after the person's own local midnight.
|
|
74
|
+
*
|
|
75
|
+
* A birthday on 29 February counts on 1 March in a year that has none, which is
|
|
76
|
+
* what `Date.UTC` yields for the 29th of a 28-day February.
|
|
77
|
+
*/
|
|
78
|
+
export function ageInYears(dateOfBirth, today = new Date()) {
|
|
79
|
+
const [year, month, day] = dateOfBirth.split('-').map(Number);
|
|
80
|
+
const todayUtc = Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
|
|
81
|
+
let age = today.getUTCFullYear() - year;
|
|
82
|
+
if (Date.UTC(year + age, month - 1, day) > todayUtc)
|
|
83
|
+
age -= 1;
|
|
84
|
+
return age;
|
|
85
|
+
}
|
|
86
|
+
/** The band of a validated ISO calendar date of birth. */
|
|
87
|
+
export function ageBandOf(dateOfBirth, today = new Date()) {
|
|
88
|
+
const age = ageInYears(dateOfBirth, today);
|
|
89
|
+
if (age < MINIMUM_UNSUPERVISED_AGE_YEARS)
|
|
90
|
+
return 'under13';
|
|
91
|
+
return age < ADULT_AGE_YEARS ? 'teen' : 'adult';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Whether a person may move their own date of birth from one band to another.
|
|
95
|
+
*
|
|
96
|
+
* A first date (no band yet) is always theirs to give. After that the band may
|
|
97
|
+
* stay or get YOUNGER, never older: growing older on paper is how a protection
|
|
98
|
+
* would be removed, and that takes a reviewed correction, not a profile edit.
|
|
99
|
+
*/
|
|
100
|
+
export function isSelfServiceBandChange(from, to) {
|
|
101
|
+
if (from === undefined)
|
|
102
|
+
return true;
|
|
103
|
+
return AGE_BANDS.indexOf(to) <= AGE_BANDS.indexOf(from);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Why a profile edit to the date of birth was refused: the error's `code`,
|
|
107
|
+
* which a client maps to its own copy.
|
|
108
|
+
*
|
|
109
|
+
* - `locked`: the date is set and this edit would remove it or move the
|
|
110
|
+
* account to an older band.
|
|
111
|
+
* - `supervisionRequired`: the date would put an existing account below the
|
|
112
|
+
* minimum unsupervised age; that account enrols through supervision.
|
|
113
|
+
*/
|
|
114
|
+
export const DATE_OF_BIRTH_REFUSALS = {
|
|
115
|
+
locked: 'DATE_OF_BIRTH_LOCKED',
|
|
116
|
+
supervisionRequired: 'DATE_OF_BIRTH_SUPERVISION_REQUIRED',
|
|
117
|
+
};
|
|
@@ -20,6 +20,22 @@ export const CLAIMANT_RELATIONSHIPS = [
|
|
|
20
20
|
'affected_person',
|
|
21
21
|
'other',
|
|
22
22
|
];
|
|
23
|
+
/**
|
|
24
|
+
* Why an Oxy service refers content to the claim review (ADR 0043 D14).
|
|
25
|
+
*
|
|
26
|
+
* A referral is a claim with no claimant: the service that hosts the content
|
|
27
|
+
* hands it to Oxy's staff because it may be illegal, on a reason from this
|
|
28
|
+
* closed list. `child_safety` is material that may sexualise or exploit a
|
|
29
|
+
* minor: it never goes to a community jury, its owner is not sent the claim
|
|
30
|
+
* email and cannot answer it with a counter-notice.
|
|
31
|
+
*/
|
|
32
|
+
export const CONTENT_REFERRAL_REASONS = ['child_safety'];
|
|
33
|
+
/** The bounds of one referral. */
|
|
34
|
+
export const CONTENT_REFERRAL_LIMITS = {
|
|
35
|
+
maxFileIds: 50,
|
|
36
|
+
maxFileId: 64,
|
|
37
|
+
maxPageUrls: 20,
|
|
38
|
+
};
|
|
23
39
|
/** The bounds of a submission. The website fills its validation messages from these. */
|
|
24
40
|
export const CONTENT_CLAIM_LIMITS = {
|
|
25
41
|
minUrls: 1,
|
package/dist/esm/client/index.js
CHANGED
|
@@ -34,14 +34,15 @@ export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CL
|
|
|
34
34
|
export { cancelProductSubscriptionCheck, oxyAccountIdCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products.js';
|
|
35
35
|
export { recommendationRequestCheck } from './recommendations.js';
|
|
36
36
|
export { isFullReputationBalance } from './reputation.js';
|
|
37
|
-
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety.js';
|
|
37
|
+
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, dateOfBirthCorrectionInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety.js';
|
|
38
38
|
export { publicApplicationCheck } from './sessionStatus.js';
|
|
39
39
|
export { CONSOLE_TERMS_VERSION, CONSOLE_USE_CASES, } from './consoleOnboarding.js';
|
|
40
40
|
export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SECOND_FACTOR_CODE_MAX_LENGTH, SIGN_IN_IDENTIFIER_MAX_LENGTH, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn.js';
|
|
41
41
|
export { BOT_USERNAME_INVALID_MESSAGE, BOT_USERNAME_SUFFIX, NUMERIC_USERNAME_MESSAGE, RESERVED_USERNAMES, RESERVED_USERNAME_MESSAGE, USERNAME_INVALID_MESSAGE, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, applyBotUsernameSuffix, botUsernameCheck, stripDisallowedUsernameCharacters, usernameCheck, usernameCheckForAccountKind, } from './username.js';
|
|
42
42
|
export { userNameCheck, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './userResponse.js';
|
|
43
43
|
export { PRONOUNS } from './userResponse.js';
|
|
44
|
-
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims.js';
|
|
44
|
+
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, CONTENT_REFERRAL_LIMITS, CONTENT_REFERRAL_REASONS, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims.js';
|
|
45
|
+
export { ADULT_AGE_YEARS, AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_REFUSALS, MINIMUM_UNSUPERVISED_AGE_YEARS, MIN_BIRTH_YEAR, ageBandOf, ageInYears, isSelfServiceBandChange, } from './age.js';
|
|
45
46
|
export { APP_ASSERTION_CHALLENGE_PURPOSES, APP_ASSERTION_ERROR_CODES, APP_ASSERTION_PLATFORMS, OXY_APP_ASSERTION_AUDIENCE, OXY_APP_ASSERTION_HEADER, OXY_APP_ASSERTION_TTL_SECONDS, OXY_APP_ASSERTION_TYPE, appAssertionChallengeResponseCheck, appAssertionResponseCheck, appAttestKeyResponseCheck, } from './appAssertions.js';
|
|
46
47
|
export { APP_TOKEN_DEVICE_ACCESS_DENIED, DEVICE_APP_TOKEN_ERROR_CODES, DEVICE_APP_TOKEN_TTL_SECONDS, OXYOS_DESKTOP_ENTRY_ID_PATTERN, PLATFORM_HOSTS, deviceAppTokenResponseCheck, } from './platformSession.js';
|
|
47
48
|
export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from '../profileColors.generated.js';
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { array, atLeast, atMost, boolean, datetime, exact, int, literal, maxItems, maxLength, minItems, minLength, nonnegative, nullable, number, oneOf, optional, pattern, refine, refineAt, strictObject, string, transform, trim, union, } from './check.js';
|
|
12
12
|
import { ORGANIZATION_TYPES } from './organizations.js';
|
|
13
|
+
import { DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, isBirthYearInRange, isNotAfterToday, isRealCalendarDate, } from './age.js';
|
|
13
14
|
import { reauthProofCheck } from './signIn.js';
|
|
14
15
|
/** Supervision is a personal-account safety policy, never a new login/account kind. */
|
|
15
16
|
export const SUPERVISED_ACTIONS = ['profile', 'messaging', 'content', 'purchases'];
|
|
@@ -92,6 +93,14 @@ export const supervisionReviewInputCheck = exact()(strictObject({
|
|
|
92
93
|
evidenceReference: string(trim, minLength(1), maxLength(2048)),
|
|
93
94
|
reauth: reauthProofCheck,
|
|
94
95
|
}));
|
|
96
|
+
/** `dateOfBirthSchema`, rule for rule and message for message. */
|
|
97
|
+
const dateOfBirthCheck = refine(refine(refine(string(pattern(DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_MESSAGES.format)), isRealCalendarDate, DATE_OF_BIRTH_MESSAGES.calendar), isBirthYearInRange, DATE_OF_BIRTH_MESSAGES.tooEarly), (value) => isNotAfterToday(value), DATE_OF_BIRTH_MESSAGES.future);
|
|
98
|
+
export const dateOfBirthCorrectionInputCheck = exact()(strictObject({
|
|
99
|
+
accountId,
|
|
100
|
+
dateOfBirth: dateOfBirthCheck,
|
|
101
|
+
evidenceReference: string(trim, minLength(1), maxLength(2048)),
|
|
102
|
+
reauth: reauthProofCheck,
|
|
103
|
+
}));
|
|
95
104
|
/* -------------------------------------------------------------------------- */
|
|
96
105
|
/* Minimal identities for the management screens */
|
|
97
106
|
/* -------------------------------------------------------------------------- */
|
|
@@ -14,8 +14,8 @@ import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
16
16
|
// it is re-exported here so the root entry carries the whole contract.
|
|
17
|
-
import { CLAIMANT_RELATIONSHIPS, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, } from './client/contentClaims.js';
|
|
18
|
-
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './client/contentClaims.js';
|
|
17
|
+
import { CLAIMANT_RELATIONSHIPS, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_REFERRAL_LIMITS, CONTENT_REFERRAL_REASONS, } from './client/contentClaims.js';
|
|
18
|
+
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, CONTENT_REFERRAL_LIMITS, CONTENT_REFERRAL_REASONS, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './client/contentClaims.js';
|
|
19
19
|
/** Every key a submission's validation can produce, under `contentClaim.errors.*`. */
|
|
20
20
|
export const CONTENT_CLAIM_VALIDATION_KEYS = [
|
|
21
21
|
'contentClaim.errors.kind',
|
|
@@ -106,6 +106,47 @@ export const contentClaimSubmissionSchema = z
|
|
|
106
106
|
})
|
|
107
107
|
.strict();
|
|
108
108
|
// ---------------------------------------------------------------------------
|
|
109
|
+
// A service's referral (`POST /content-claims/referrals`)
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
const R = CONTENT_REFERRAL_LIMITS;
|
|
112
|
+
/**
|
|
113
|
+
* `POST /content-claims/referrals`: an Oxy service refers content it hosts to
|
|
114
|
+
* the claim review. It names the Oxy files (`fileIds`), the pages that show the
|
|
115
|
+
* content (`pageUrls`, for content with no file), or both; at least one.
|
|
116
|
+
* Strict, and with nothing about who reported it to the service: a referral
|
|
117
|
+
* carries no person.
|
|
118
|
+
*
|
|
119
|
+
* The same referral sent again answers with the same claim, so a retry never
|
|
120
|
+
* opens a second one.
|
|
121
|
+
*/
|
|
122
|
+
export const contentReferralSchema = z
|
|
123
|
+
.object({
|
|
124
|
+
reason: z.enum(CONTENT_REFERRAL_REASONS),
|
|
125
|
+
fileIds: z
|
|
126
|
+
.array(z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(R.maxFileId)))
|
|
127
|
+
.max(R.maxFileIds)
|
|
128
|
+
.default([]),
|
|
129
|
+
pageUrls: z
|
|
130
|
+
.array(z
|
|
131
|
+
.string()
|
|
132
|
+
.trim()
|
|
133
|
+
.check(utf16MaxLength(CONTENT_CLAIM_LIMITS.maxUrlLength))
|
|
134
|
+
.refine(isHttpsUrl, 'pageUrls must be https URLs'))
|
|
135
|
+
.max(R.maxPageUrls)
|
|
136
|
+
.default([]),
|
|
137
|
+
})
|
|
138
|
+
.strict()
|
|
139
|
+
.refine((referral) => referral.fileIds.length + referral.pageUrls.length > 0, {
|
|
140
|
+
message: 'A referral names at least one file or page',
|
|
141
|
+
});
|
|
142
|
+
/** `200` to a referral: the claim it opened, or the open one it already had. */
|
|
143
|
+
export const contentReferralResponseSchema = z
|
|
144
|
+
.object({
|
|
145
|
+
id: z.string(),
|
|
146
|
+
reference: z.string().regex(CONTENT_CLAIM_REFERENCE_PATTERN),
|
|
147
|
+
})
|
|
148
|
+
.strict();
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
109
150
|
// The staff review (`/content-claims` behind the `content:claims` capability)
|
|
110
151
|
// ---------------------------------------------------------------------------
|
|
111
152
|
/** How a target's URL was understood. */
|
|
@@ -115,11 +156,16 @@ export const CONTENT_CLAIM_TARGET_RESOLUTIONS = [
|
|
|
115
156
|
/** A page of an Oxy app or anything else: a person attaches the files it shows. */
|
|
116
157
|
'unresolved',
|
|
117
158
|
];
|
|
118
|
-
/**
|
|
119
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Who added a target: the claimant's URL, staff attaching a file by id, or the
|
|
161
|
+
* Oxy service that referred it (a file it uses, or the page that shows it).
|
|
162
|
+
*/
|
|
163
|
+
export const CONTENT_CLAIM_TARGET_SOURCES = ['claimant', 'staff', 'service'];
|
|
120
164
|
/** What the audit trail records. */
|
|
121
165
|
export const CONTENT_CLAIM_EVENT_ACTIONS = [
|
|
122
166
|
'submitted',
|
|
167
|
+
/** An Oxy service referred the content (`POST /content-claims/referrals`). */
|
|
168
|
+
'referred',
|
|
123
169
|
'review_started',
|
|
124
170
|
'targets_attached',
|
|
125
171
|
'targets_blocked',
|
package/dist/esm/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { AVATAR_EYE_SPACING, AVATAR_PICKABLE_SHAPES, avatarCharacterFor, avatarC
|
|
|
15
15
|
export { ACCOUNT_ACTOR_NATURES, ACCOUNT_SUBJECT_CONTRACT_VERSION, FINANCIAL_EFFECT_DIRECTIONS, KIND_INDEPENDENT_ACCOUNT_DIMENSIONS, accountActorChainFromSession, accountActorChainSchema, accountActorNatureSchema, accountKindActorNature, accountKindActsAsItself, attributeFinancialEffect, financialEffectAttributionSchema, } from './accountSubject.js';
|
|
16
16
|
export { usernameSchema, usernameSchemaForAccountKind, isValidUsername, stripDisallowedUsernameCharacters, applyBotUsernameSuffix, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_INVALID_MESSAGE, BOT_USERNAME_INVALID_MESSAGE, RESERVED_USERNAME_MESSAGE, NUMERIC_USERNAME_MESSAGE, } from './username.js';
|
|
17
17
|
export { PRONOUNS, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './client/userResponse.js';
|
|
18
|
+
export { ADULT_AGE_YEARS, AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_REFUSALS, MINIMUM_UNSUPERVISED_AGE_YEARS, MIN_BIRTH_YEAR, ageBandOf, ageInYears, isSelfServiceBandChange, } from './client/age.js';
|
|
18
19
|
export {
|
|
19
20
|
// Schemas
|
|
20
21
|
userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema,
|
package/dist/esm/safety.js
CHANGED
|
@@ -7,7 +7,7 @@ import { accountActorChainSchema } from './accountSubject.js';
|
|
|
7
7
|
import { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, } from './client/safety.js';
|
|
8
8
|
import { ORGANIZATION_TYPES } from './organizations.js';
|
|
9
9
|
import { reauthProofSchema } from './signIn.js';
|
|
10
|
-
import { userResponseSchema } from './userResponse.js';
|
|
10
|
+
import { dateOfBirthSchema, userResponseSchema } from './userResponse.js';
|
|
11
11
|
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, };
|
|
12
12
|
/** The requester is authenticated by the bearer; applications cannot submit viewer IDs. */
|
|
13
13
|
export const profileAccessInputSchema = z
|
|
@@ -416,6 +416,19 @@ export const supervisionReviewInputSchema = z
|
|
|
416
416
|
reauth: reauthProofSchema,
|
|
417
417
|
})
|
|
418
418
|
.strict();
|
|
419
|
+
/**
|
|
420
|
+
* `POST /safety/supervision/date-of-birth`: a staff member corrects an
|
|
421
|
+
* account's date of birth on reviewed evidence (ADR 0067). It is the only way
|
|
422
|
+
* a date moves to an OLDER age band; the person's own edits cannot.
|
|
423
|
+
*/
|
|
424
|
+
export const dateOfBirthCorrectionInputSchema = z
|
|
425
|
+
.object({
|
|
426
|
+
accountId,
|
|
427
|
+
dateOfBirth: dateOfBirthSchema,
|
|
428
|
+
evidenceReference: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(2048)),
|
|
429
|
+
reauth: reauthProofSchema,
|
|
430
|
+
})
|
|
431
|
+
.strict();
|
|
419
432
|
export const purchaseReviewInputSchema = z
|
|
420
433
|
.object({ decision: z.enum(['approved', 'rejected']), reauth: reauthProofSchema })
|
|
421
434
|
.strict();
|
package/dist/esm/signIn.js
CHANGED
|
@@ -2,6 +2,7 @@ import { isLanguageTag } from './client/language.js';
|
|
|
2
2
|
import { campaignAttributionSchema } from './campaignAttribution.js';
|
|
3
3
|
import { integerCheck } from './numberChecks.js';
|
|
4
4
|
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
5
|
+
import { dateOfBirthSchema } from './userResponse.js';
|
|
5
6
|
/**
|
|
6
7
|
* Signing in: an email code or link, an optional password,
|
|
7
8
|
* and an optional authenticator app (TOTP) as a second factor.
|
|
@@ -187,6 +188,14 @@ export const signUpRequestSchema = z
|
|
|
187
188
|
.max(10)
|
|
188
189
|
.optional(),
|
|
189
190
|
campaignAttribution: campaignAttributionSchema.optional(),
|
|
191
|
+
/**
|
|
192
|
+
* The person's date of birth (ADR 0067). The sign-up panel always asks for
|
|
193
|
+
* it; it is optional on the wire only while clients published before it
|
|
194
|
+
* are still in use, and an account created without one has no age band.
|
|
195
|
+
* A date below the minimum unsupervised age creates the account under
|
|
196
|
+
* supervision, awaiting a guardian.
|
|
197
|
+
*/
|
|
198
|
+
dateOfBirth: dateOfBirthSchema.optional(),
|
|
190
199
|
...sessionEnvelope,
|
|
191
200
|
})
|
|
192
201
|
.strict();
|
package/dist/esm/userResponse.js
CHANGED
|
@@ -30,6 +30,7 @@ import { isoDateTime } from './stringChecks.js';
|
|
|
30
30
|
* `require()`).
|
|
31
31
|
*/
|
|
32
32
|
import { z } from 'zod';
|
|
33
|
+
import { AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, isBirthYearInRange, isNotAfterToday, isRealCalendarDate, } from './client/age.js';
|
|
33
34
|
import { PRONOUNS, PROFILE_LINKS_MAX } from './client/userResponse.js';
|
|
34
35
|
import { verifiedDomainSchema } from './identity.js';
|
|
35
36
|
import { accountCategoriesSchema, accountKindSchema } from './accountGraph.js';
|
|
@@ -50,25 +51,6 @@ export const themePreferenceSchema = z.object({
|
|
|
50
51
|
mode: z.enum(['light', 'dark', 'system']),
|
|
51
52
|
colorPreset: z.string(),
|
|
52
53
|
});
|
|
53
|
-
/**
|
|
54
|
-
* The earliest calendar year `dateOfBirthSchema` accepts.
|
|
55
|
-
*
|
|
56
|
-
* Not a real biological bound — it exists to catch an obviously-transposed
|
|
57
|
-
* year (`1027` for `2027`, a stray OCR/typo digit) with a clear message
|
|
58
|
-
* instead of the value quietly becoming a 150-year-old account. 1900 is
|
|
59
|
-
* generous enough that no living person's real birthdate is rejected by it.
|
|
60
|
-
*/
|
|
61
|
-
const MIN_BIRTH_YEAR = 1900;
|
|
62
|
-
/**
|
|
63
|
-
* `true` when `year`/`month`/`day` name a date that actually exists on the
|
|
64
|
-
* Gregorian calendar — the check `z.string().regex(...)` alone cannot make,
|
|
65
|
-
* since the regex only constrains digit COUNT and would pass `2024-02-30`.
|
|
66
|
-
*/
|
|
67
|
-
function isRealCalendarDate(year, month, day) {
|
|
68
|
-
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
69
|
-
const daysInMonth = [31, isLeapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
70
|
-
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth[month - 1];
|
|
71
|
-
}
|
|
72
54
|
/**
|
|
73
55
|
* A date of birth, `YYYY-MM-DD`, the sole structured representation this
|
|
74
56
|
* platform stores going forward (`users.date_of_birth` — see
|
|
@@ -87,23 +69,16 @@ function isRealCalendarDate(year, month, day) {
|
|
|
87
69
|
* and not after today (comparing the zero-padded ISO strings directly is
|
|
88
70
|
* a valid, simpler stand-in for a numeric comparison here, since two
|
|
89
71
|
* `YYYY-MM-DD` strings of equal length sort exactly the way their dates
|
|
90
|
-
* do). "Today" is UTC — see `
|
|
72
|
+
* do). "Today" is UTC — see `ageInYears` in `client/age.ts` for why
|
|
91
73
|
* a date with no timezone of its own is evaluated in UTC rather than any
|
|
92
74
|
* particular caller's local zone.
|
|
93
75
|
*/
|
|
94
76
|
export const dateOfBirthSchema = z
|
|
95
77
|
.string()
|
|
96
|
-
.regex(
|
|
97
|
-
.refine(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}, { message: 'dateOfBirth is not a real calendar date' })
|
|
101
|
-
.refine((value) => Number(value.slice(0, 4)) >= MIN_BIRTH_YEAR, {
|
|
102
|
-
message: `dateOfBirth must not be before ${MIN_BIRTH_YEAR}`,
|
|
103
|
-
})
|
|
104
|
-
.refine((value) => value <= new Date().toISOString().slice(0, 10), {
|
|
105
|
-
message: 'dateOfBirth must not be in the future',
|
|
106
|
-
});
|
|
78
|
+
.regex(DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_MESSAGES.format)
|
|
79
|
+
.refine(isRealCalendarDate, { message: DATE_OF_BIRTH_MESSAGES.calendar })
|
|
80
|
+
.refine(isBirthYearInRange, { message: DATE_OF_BIRTH_MESSAGES.tooEarly })
|
|
81
|
+
.refine((value) => isNotAfterToday(value), { message: DATE_OF_BIRTH_MESSAGES.future });
|
|
107
82
|
/**
|
|
108
83
|
* The canonical user object emitted by `formatUserResponse`.
|
|
109
84
|
*
|
|
@@ -153,6 +128,15 @@ export const userResponseSchema = z
|
|
|
153
128
|
* not decided here.
|
|
154
129
|
*/
|
|
155
130
|
isAdult: z.boolean().optional(),
|
|
131
|
+
/**
|
|
132
|
+
* The account's age band (ADR 0067), derived from `dateOfBirth` on every
|
|
133
|
+
* read and never stored. Absent when there is no date of birth: "unknown"
|
|
134
|
+
* is neither an adult nor a minor. The owner reads it on their own
|
|
135
|
+
* profile, and an Oxy service reads it on the session it validates
|
|
136
|
+
* (`POST /safety/service/session`); it never rides a public profile, and
|
|
137
|
+
* the date itself never leaves the owner's view.
|
|
138
|
+
*/
|
|
139
|
+
ageBand: z.enum(AGE_BANDS).optional(),
|
|
156
140
|
/** Avatar file id (string) or null. */
|
|
157
141
|
avatar: z.string().nullable().optional(),
|
|
158
142
|
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Age bands (ADR 0067): the one answer every Oxy app gets to "how old is this
|
|
3
|
+
* person, as far as protection goes".
|
|
4
|
+
*
|
|
5
|
+
* A band is DERIVED from the account's date of birth on every read and never
|
|
6
|
+
* stored: it changes on a birthday without any write touching the row. An
|
|
7
|
+
* application never receives the date itself, only the band.
|
|
8
|
+
*
|
|
9
|
+
* - `under13`: below {@link MINIMUM_UNSUPERVISED_AGE_YEARS}. Such an account
|
|
10
|
+
* exists only under supervision (ADR 0041); sign-up creates it awaiting a
|
|
11
|
+
* guardian.
|
|
12
|
+
* - `teen`: old enough for an account of their own, not yet an adult. Apps
|
|
13
|
+
* apply their protective defaults.
|
|
14
|
+
* - `adult`: at least {@link ADULT_AGE_YEARS}.
|
|
15
|
+
*
|
|
16
|
+
* An account with no date of birth has NO band (`undefined`), which is distinct
|
|
17
|
+
* from every value here: "unknown" is never read as "adult" or as "minor".
|
|
18
|
+
*/
|
|
19
|
+
export declare const AGE_BANDS: readonly ["under13", "teen", "adult"];
|
|
20
|
+
export type AgeBand = (typeof AGE_BANDS)[number];
|
|
21
|
+
/**
|
|
22
|
+
* The earliest calendar year a date of birth may name.
|
|
23
|
+
*
|
|
24
|
+
* Not a biological bound: it catches an obviously transposed year (`1027` for
|
|
25
|
+
* `2027`) with a clear message instead of a 150-year-old account. No living
|
|
26
|
+
* person's real date is refused by it. The server's schema and every picker
|
|
27
|
+
* read this one value, so a picker cannot offer a date the API refuses.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MIN_BIRTH_YEAR = 1900;
|
|
30
|
+
/** The wire format of a date of birth: `YYYY-MM-DD`, nothing looser. */
|
|
31
|
+
export declare const DATE_OF_BIRTH_PATTERN: RegExp;
|
|
32
|
+
/**
|
|
33
|
+
* Whether a `YYYY-MM-DD` string names a day that exists on the Gregorian
|
|
34
|
+
* calendar. The pattern only constrains digit count and would pass `2024-02-30`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isRealCalendarDate(value: string): boolean;
|
|
37
|
+
/** Whether a `YYYY-MM-DD` string is not before {@link MIN_BIRTH_YEAR}. */
|
|
38
|
+
export declare function isBirthYearInRange(value: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a `YYYY-MM-DD` string is today (UTC) or earlier. Two zero-padded ISO
|
|
41
|
+
* dates of equal length sort exactly as their dates do.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isNotAfterToday(value: string, today?: Date): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* What each date-of-birth rule says when it fails. The server's schema and the
|
|
46
|
+
* client's check word a refusal identically because both read these.
|
|
47
|
+
*/
|
|
48
|
+
export declare const DATE_OF_BIRTH_MESSAGES: {
|
|
49
|
+
readonly format: "dateOfBirth must be an ISO 8601 calendar date (YYYY-MM-DD)";
|
|
50
|
+
readonly calendar: "dateOfBirth is not a real calendar date";
|
|
51
|
+
readonly tooEarly: "dateOfBirth must not be before 1900";
|
|
52
|
+
readonly future: "dateOfBirth must not be in the future";
|
|
53
|
+
};
|
|
54
|
+
/** Below this age an account exists only under supervision. */
|
|
55
|
+
export declare const MINIMUM_UNSUPERVISED_AGE_YEARS = 13;
|
|
56
|
+
/** From this age an account is an adult's. */
|
|
57
|
+
export declare const ADULT_AGE_YEARS = 18;
|
|
58
|
+
/**
|
|
59
|
+
* Whole years between an ISO calendar date (`YYYY-MM-DD`) and `today`, both
|
|
60
|
+
* read in UTC.
|
|
61
|
+
*
|
|
62
|
+
* UTC because a date of birth has no time of day and no zone of its own, so
|
|
63
|
+
* there is no authoritative zone to evaluate it in; UTC is the one every server
|
|
64
|
+
* and every client agrees on without configuration. The effect is a band that
|
|
65
|
+
* can change up to a day before or after the person's own local midnight.
|
|
66
|
+
*
|
|
67
|
+
* A birthday on 29 February counts on 1 March in a year that has none, which is
|
|
68
|
+
* what `Date.UTC` yields for the 29th of a 28-day February.
|
|
69
|
+
*/
|
|
70
|
+
export declare function ageInYears(dateOfBirth: string, today?: Date): number;
|
|
71
|
+
/** The band of a validated ISO calendar date of birth. */
|
|
72
|
+
export declare function ageBandOf(dateOfBirth: string, today?: Date): AgeBand;
|
|
73
|
+
/**
|
|
74
|
+
* Whether a person may move their own date of birth from one band to another.
|
|
75
|
+
*
|
|
76
|
+
* A first date (no band yet) is always theirs to give. After that the band may
|
|
77
|
+
* stay or get YOUNGER, never older: growing older on paper is how a protection
|
|
78
|
+
* would be removed, and that takes a reviewed correction, not a profile edit.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isSelfServiceBandChange(from: AgeBand | undefined, to: AgeBand): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Why a profile edit to the date of birth was refused: the error's `code`,
|
|
83
|
+
* which a client maps to its own copy.
|
|
84
|
+
*
|
|
85
|
+
* - `locked`: the date is set and this edit would remove it or move the
|
|
86
|
+
* account to an older band.
|
|
87
|
+
* - `supervisionRequired`: the date would put an existing account below the
|
|
88
|
+
* minimum unsupervised age; that account enrols through supervision.
|
|
89
|
+
*/
|
|
90
|
+
export declare const DATE_OF_BIRTH_REFUSALS: {
|
|
91
|
+
readonly locked: "DATE_OF_BIRTH_LOCKED";
|
|
92
|
+
readonly supervisionRequired: "DATE_OF_BIRTH_SUPERVISION_REQUIRED";
|
|
93
|
+
};
|
|
94
|
+
export type DateOfBirthRefusal = (typeof DATE_OF_BIRTH_REFUSALS)[keyof typeof DATE_OF_BIRTH_REFUSALS];
|
|
@@ -11,6 +11,23 @@ export type ContentClaimKind = (typeof CONTENT_CLAIM_KINDS)[number];
|
|
|
11
11
|
/** Who the claimant is to the content. */
|
|
12
12
|
export declare const CLAIMANT_RELATIONSHIPS: readonly ["rights_holder", "authorized_agent", "affected_person", "other"];
|
|
13
13
|
export type ClaimantRelationship = (typeof CLAIMANT_RELATIONSHIPS)[number];
|
|
14
|
+
/**
|
|
15
|
+
* Why an Oxy service refers content to the claim review (ADR 0043 D14).
|
|
16
|
+
*
|
|
17
|
+
* A referral is a claim with no claimant: the service that hosts the content
|
|
18
|
+
* hands it to Oxy's staff because it may be illegal, on a reason from this
|
|
19
|
+
* closed list. `child_safety` is material that may sexualise or exploit a
|
|
20
|
+
* minor: it never goes to a community jury, its owner is not sent the claim
|
|
21
|
+
* email and cannot answer it with a counter-notice.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CONTENT_REFERRAL_REASONS: readonly ["child_safety"];
|
|
24
|
+
export type ContentReferralReason = (typeof CONTENT_REFERRAL_REASONS)[number];
|
|
25
|
+
/** The bounds of one referral. */
|
|
26
|
+
export declare const CONTENT_REFERRAL_LIMITS: {
|
|
27
|
+
readonly maxFileIds: 50;
|
|
28
|
+
readonly maxFileId: 64;
|
|
29
|
+
readonly maxPageUrls: 20;
|
|
30
|
+
};
|
|
14
31
|
/** The bounds of a submission. The website fills its validation messages from these. */
|
|
15
32
|
export declare const CONTENT_CLAIM_LIMITS: {
|
|
16
33
|
readonly minUrls: 1;
|
|
@@ -36,7 +36,7 @@ export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CL
|
|
|
36
36
|
export { cancelProductSubscriptionCheck, oxyAccountIdCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products';
|
|
37
37
|
export { recommendationRequestCheck } from './recommendations';
|
|
38
38
|
export { isFullReputationBalance } from './reputation';
|
|
39
|
-
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety';
|
|
39
|
+
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, dateOfBirthCorrectionInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety';
|
|
40
40
|
export { publicApplicationCheck } from './sessionStatus';
|
|
41
41
|
export { CONSOLE_TERMS_VERSION, CONSOLE_USE_CASES, type ConsoleUseCaseId, } from './consoleOnboarding';
|
|
42
42
|
export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SECOND_FACTOR_CODE_MAX_LENGTH, SIGN_IN_IDENTIFIER_MAX_LENGTH, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn';
|
|
@@ -44,7 +44,9 @@ export { BOT_USERNAME_INVALID_MESSAGE, BOT_USERNAME_SUFFIX, NUMERIC_USERNAME_MES
|
|
|
44
44
|
export { userNameCheck, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './userResponse';
|
|
45
45
|
export { PRONOUNS } from './userResponse';
|
|
46
46
|
export type { Pronouns } from './userResponse';
|
|
47
|
-
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims';
|
|
47
|
+
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, CONTENT_REFERRAL_LIMITS, CONTENT_REFERRAL_REASONS, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims';
|
|
48
|
+
export { ADULT_AGE_YEARS, AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_REFUSALS, MINIMUM_UNSUPERVISED_AGE_YEARS, MIN_BIRTH_YEAR, ageBandOf, ageInYears, isSelfServiceBandChange, } from './age';
|
|
49
|
+
export type { AgeBand, DateOfBirthRefusal } from './age';
|
|
48
50
|
export { APP_ASSERTION_CHALLENGE_PURPOSES, APP_ASSERTION_ERROR_CODES, APP_ASSERTION_PLATFORMS, OXY_APP_ASSERTION_AUDIENCE, OXY_APP_ASSERTION_HEADER, OXY_APP_ASSERTION_TTL_SECONDS, OXY_APP_ASSERTION_TYPE, appAssertionChallengeResponseCheck, appAssertionResponseCheck, appAttestKeyResponseCheck, } from './appAssertions';
|
|
49
51
|
export { APP_TOKEN_DEVICE_ACCESS_DENIED, DEVICE_APP_TOKEN_ERROR_CODES, DEVICE_APP_TOKEN_TTL_SECONDS, OXYOS_DESKTOP_ENTRY_ID_PATTERN, PLATFORM_HOSTS, deviceAppTokenResponseCheck, } from './platformSession';
|
|
50
52
|
export type { DeviceAppTokenErrorCode, DeviceAppTokenResponse, PlatformClient, PlatformHost, } from '../platformSession';
|