diff --git a/api/bsky/ageassurancebegin.go b/api/bsky/ageassurancebegin.go new file mode 100644 index 00000000..d6bb07f5 --- /dev/null +++ b/api/bsky/ageassurancebegin.go @@ -0,0 +1,33 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.begin + +package bsky + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// AgeassuranceBegin_Input is the input argument to a app.bsky.ageassurance.begin call. +type AgeassuranceBegin_Input struct { + // countryCode: An ISO 3166-1 alpha-2 code of the user's location. + CountryCode string `json:"countryCode" cborgen:"countryCode"` + // email: The user's email address to receive Age Assurance instructions. + Email string `json:"email" cborgen:"email"` + // language: The user's preferred language for communication during the Age Assurance process. + Language string `json:"language" cborgen:"language"` + // regionCode: An optional ISO 3166-2 code of the user's region or state within the country. + RegionCode *string `json:"regionCode,omitempty" cborgen:"regionCode,omitempty"` +} + +// AgeassuranceBegin calls the XRPC method "app.bsky.ageassurance.begin". +func AgeassuranceBegin(ctx context.Context, c lexutil.LexClient, input *AgeassuranceBegin_Input) (*AgeassuranceDefs_State, error) { + var out AgeassuranceDefs_State + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "app.bsky.ageassurance.begin", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/bsky/ageassurancedefs.go b/api/bsky/ageassurancedefs.go new file mode 100644 index 00000000..524088b9 --- /dev/null +++ b/api/bsky/ageassurancedefs.go @@ -0,0 +1,219 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.defs + +package bsky + +import ( + "encoding/json" + "fmt" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// AgeassuranceDefs_Config is a "config" in the app.bsky.ageassurance.defs schema. +type AgeassuranceDefs_Config struct { + // regions: The per-region Age Assurance configuration. + Regions []*AgeassuranceDefs_ConfigRegion `json:"regions" cborgen:"regions"` +} + +// AgeassuranceDefs_ConfigRegion is a "configRegion" in the app.bsky.ageassurance.defs schema. +// +// The Age Assurance configuration for a specific region. +type AgeassuranceDefs_ConfigRegion struct { + // countryCode: The ISO 3166-1 alpha-2 country code this configuration applies to. + CountryCode string `json:"countryCode" cborgen:"countryCode"` + // regionCode: The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country. + RegionCode *string `json:"regionCode,omitempty" cborgen:"regionCode,omitempty"` + // rules: The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item. + Rules []*AgeassuranceDefs_ConfigRegion_Rules_Elem `json:"rules" cborgen:"rules"` +} + +// AgeassuranceDefs_ConfigRegionRuleDefault is a "configRegionRuleDefault" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies by default. +type AgeassuranceDefs_ConfigRegionRuleDefault struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.ageassurance.defs#configRegionRuleDefault"` + Access *string `json:"access" cborgen:"access"` +} + +// AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan is a "configRegionRuleIfAccountNewerThan" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the account is equal-to or newer than a certain date. +type AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan"` + Access *string `json:"access" cborgen:"access"` + // date: The date threshold as a datetime string. + Date string `json:"date" cborgen:"date"` +} + +// AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan is a "configRegionRuleIfAccountOlderThan" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the account is older than a certain date. +type AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan"` + Access *string `json:"access" cborgen:"access"` + // date: The date threshold as a datetime string. + Date string `json:"date" cborgen:"date"` +} + +// AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge is a "configRegionRuleIfAssuredOverAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge"` + Access *string `json:"access" cborgen:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age" cborgen:"age"` +} + +// AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge is a "configRegionRuleIfAssuredUnderAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has been assured to be under a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge"` + Access *string `json:"access" cborgen:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age" cborgen:"age"` +} + +// AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge is a "configRegionRuleIfDeclaredOverAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge"` + Access *string `json:"access" cborgen:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age" cborgen:"age"` +} + +// AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge is a "configRegionRuleIfDeclaredUnderAge" in the app.bsky.ageassurance.defs schema. +// +// Age Assurance rule that applies if the user has declared themselves under a certain age. +type AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge"` + Access *string `json:"access" cborgen:"access"` + // age: The age threshold as a whole integer. + Age int64 `json:"age" cborgen:"age"` +} + +type AgeassuranceDefs_ConfigRegion_Rules_Elem struct { + AgeassuranceDefs_ConfigRegionRuleDefault *AgeassuranceDefs_ConfigRegionRuleDefault + AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge *AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge + AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge *AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge + AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge *AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge + AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge *AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge + AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan *AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan + AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan *AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan +} + +func (t *AgeassuranceDefs_ConfigRegion_Rules_Elem) MarshalJSON() ([]byte, error) { + if t.AgeassuranceDefs_ConfigRegionRuleDefault != nil { + t.AgeassuranceDefs_ConfigRegionRuleDefault.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleDefault" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleDefault) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) + } + if t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan != nil { + t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan.LexiconTypeID = "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan" + return json.Marshal(t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *AgeassuranceDefs_ConfigRegion_Rules_Elem) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "app.bsky.ageassurance.defs#configRegionRuleDefault": + t.AgeassuranceDefs_ConfigRegionRuleDefault = new(AgeassuranceDefs_ConfigRegionRuleDefault) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleDefault) + case "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredOverAge": + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge = new(AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredOverAge) + case "app.bsky.ageassurance.defs#configRegionRuleIfDeclaredUnderAge": + t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge = new(AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfDeclaredUnderAge) + case "app.bsky.ageassurance.defs#configRegionRuleIfAssuredOverAge": + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge = new(AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAssuredOverAge) + case "app.bsky.ageassurance.defs#configRegionRuleIfAssuredUnderAge": + t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge = new(AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAssuredUnderAge) + case "app.bsky.ageassurance.defs#configRegionRuleIfAccountNewerThan": + t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan = new(AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAccountNewerThan) + case "app.bsky.ageassurance.defs#configRegionRuleIfAccountOlderThan": + t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan = new(AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) + return json.Unmarshal(b, t.AgeassuranceDefs_ConfigRegionRuleIfAccountOlderThan) + default: + return nil + } +} + +// AgeassuranceDefs_Event is a "event" in the app.bsky.ageassurance.defs schema. +// +// Object used to store Age Assurance data in stash. +type AgeassuranceDefs_Event struct { + // access: The access level granted based on Age Assurance data we've processed. + Access string `json:"access" cborgen:"access"` + // attemptId: The unique identifier for this instance of the Age Assurance flow, in UUID format. + AttemptId string `json:"attemptId" cborgen:"attemptId"` + // completeIp: The IP address used when completing the Age Assurance flow. + CompleteIp *string `json:"completeIp,omitempty" cborgen:"completeIp,omitempty"` + // completeUa: The user agent used when completing the Age Assurance flow. + CompleteUa *string `json:"completeUa,omitempty" cborgen:"completeUa,omitempty"` + // countryCode: The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow. + CountryCode string `json:"countryCode" cborgen:"countryCode"` + // createdAt: The date and time of this write operation. + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // email: The email used for Age Assurance. + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + // initIp: The IP address used when initiating the Age Assurance flow. + InitIp *string `json:"initIp,omitempty" cborgen:"initIp,omitempty"` + // initUa: The user agent used when initiating the Age Assurance flow. + InitUa *string `json:"initUa,omitempty" cborgen:"initUa,omitempty"` + // regionCode: The ISO 3166-2 region code provided when beginning the Age Assurance flow. + RegionCode *string `json:"regionCode,omitempty" cborgen:"regionCode,omitempty"` + // status: The status of the Age Assurance process. + Status string `json:"status" cborgen:"status"` +} + +// AgeassuranceDefs_State is a "state" in the app.bsky.ageassurance.defs schema. +// +// The user's computed Age Assurance state. +type AgeassuranceDefs_State struct { + Access *string `json:"access" cborgen:"access"` + // lastInitiatedAt: The timestamp when this state was last updated. + LastInitiatedAt *string `json:"lastInitiatedAt,omitempty" cborgen:"lastInitiatedAt,omitempty"` + Status *string `json:"status" cborgen:"status"` +} + +// AgeassuranceDefs_StateMetadata is a "stateMetadata" in the app.bsky.ageassurance.defs schema. +// +// Additional metadata needed to compute Age Assurance state client-side. +type AgeassuranceDefs_StateMetadata struct { + // accountCreatedAt: The account creation timestamp. + AccountCreatedAt *string `json:"accountCreatedAt,omitempty" cborgen:"accountCreatedAt,omitempty"` +} diff --git a/api/bsky/ageassurancegetConfig.go b/api/bsky/ageassurancegetConfig.go new file mode 100644 index 00000000..77f50b02 --- /dev/null +++ b/api/bsky/ageassurancegetConfig.go @@ -0,0 +1,21 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.getConfig + +package bsky + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// AgeassuranceGetConfig calls the XRPC method "app.bsky.ageassurance.getConfig". +func AgeassuranceGetConfig(ctx context.Context, c lexutil.LexClient) (*AgeassuranceDefs_Config, error) { + var out AgeassuranceDefs_Config + if err := c.LexDo(ctx, lexutil.Query, "", "app.bsky.ageassurance.getConfig", nil, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/bsky/ageassurancegetState.go b/api/bsky/ageassurancegetState.go new file mode 100644 index 00000000..d6aac8f0 --- /dev/null +++ b/api/bsky/ageassurancegetState.go @@ -0,0 +1,33 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: app.bsky.ageassurance.getState + +package bsky + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// AgeassuranceGetState_Output is the output of a app.bsky.ageassurance.getState call. +type AgeassuranceGetState_Output struct { + Metadata *AgeassuranceDefs_StateMetadata `json:"metadata" cborgen:"metadata"` + State *AgeassuranceDefs_State `json:"state" cborgen:"state"` +} + +// AgeassuranceGetState calls the XRPC method "app.bsky.ageassurance.getState". +func AgeassuranceGetState(ctx context.Context, c lexutil.LexClient, countryCode string, regionCode string) (*AgeassuranceGetState_Output, error) { + var out AgeassuranceGetState_Output + + params := map[string]interface{}{} + params["countryCode"] = countryCode + if regionCode != "" { + params["regionCode"] = regionCode + } + if err := c.LexDo(ctx, lexutil.Query, "", "app.bsky.ageassurance.getState", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationdefs.go b/api/ozone/moderationdefs.go index 5b627bab..684e8354 100644 --- a/api/ozone/moderationdefs.go +++ b/api/ozone/moderationdefs.go @@ -70,20 +70,25 @@ type ModerationDefs_AccountStrike struct { // // Age assurance info coming directly from users. Only works on DID subjects. type ModerationDefs_AgeAssuranceEvent struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.moderation.defs#ageAssuranceEvent"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.moderation.defs#ageAssuranceEvent"` + Access *string `json:"access,omitempty" cborgen:"access,omitempty"` // attemptId: The unique identifier for this instance of the age assurance flow, in UUID format. AttemptId string `json:"attemptId" cborgen:"attemptId"` // completeIp: The IP address used when completing the AA flow. CompleteIp *string `json:"completeIp,omitempty" cborgen:"completeIp,omitempty"` // completeUa: The user agent used when completing the AA flow. CompleteUa *string `json:"completeUa,omitempty" cborgen:"completeUa,omitempty"` + // countryCode: The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow. + CountryCode *string `json:"countryCode,omitempty" cborgen:"countryCode,omitempty"` // createdAt: The date and time of this write operation. CreatedAt string `json:"createdAt" cborgen:"createdAt"` // initIp: The IP address used when initiating the AA flow. InitIp *string `json:"initIp,omitempty" cborgen:"initIp,omitempty"` // initUa: The user agent used when initiating the AA flow. InitUa *string `json:"initUa,omitempty" cborgen:"initUa,omitempty"` - // status: The status of the age assurance process. + // regionCode: The ISO 3166-2 region code provided when beginning the Age Assurance flow. + RegionCode *string `json:"regionCode,omitempty" cborgen:"regionCode,omitempty"` + // status: The status of the Age Assurance process. Status string `json:"status" cborgen:"status"` } @@ -91,7 +96,8 @@ type ModerationDefs_AgeAssuranceEvent struct { // // Age assurance status override by moderators. Only works on DID subjects. type ModerationDefs_AgeAssuranceOverrideEvent struct { - LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.moderation.defs#ageAssuranceOverrideEvent"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.moderation.defs#ageAssuranceOverrideEvent"` + Access *string `json:"access,omitempty" cborgen:"access,omitempty"` // comment: Comment describing the reason for the override. Comment string `json:"comment" cborgen:"comment"` // status: The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state. diff --git a/lexicons/app/bsky/ageassurance/begin.json b/lexicons/app/bsky/ageassurance/begin.json new file mode 100644 index 00000000..7c377449 --- /dev/null +++ b/lexicons/app/bsky/ageassurance/begin.json @@ -0,0 +1,48 @@ +{ + "lexicon": 1, + "id": "app.bsky.ageassurance.begin", + "defs": { + "main": { + "type": "procedure", + "description": "Initiate Age Assurance for an account.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["email", "language", "countryCode"], + "properties": { + "email": { + "type": "string", + "description": "The user's email address to receive Age Assurance instructions." + }, + "language": { + "type": "string", + "description": "The user's preferred language for communication during the Age Assurance process." + }, + "countryCode": { + "type": "string", + "description": "An ISO 3166-1 alpha-2 code of the user's location." + }, + "regionCode": { + "type": "string", + "description": "An optional ISO 3166-2 code of the user's region or state within the country." + } + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#state" + } + }, + "errors": [ + { "name": "InvalidEmail" }, + { "name": "DidTooLong" }, + { "name": "InvalidInitiation" }, + { "name": "RegionNotSupported" } + ] + } + } +} diff --git a/lexicons/app/bsky/ageassurance/defs.json b/lexicons/app/bsky/ageassurance/defs.json new file mode 100644 index 00000000..65f61509 --- /dev/null +++ b/lexicons/app/bsky/ageassurance/defs.json @@ -0,0 +1,251 @@ +{ + "lexicon": 1, + "id": "app.bsky.ageassurance.defs", + "defs": { + "access": { + "description": "The access level granted based on Age Assurance data we've processed.", + "type": "string", + "knownValues": ["unknown", "none", "safe", "full"] + }, + "status": { + "type": "string", + "description": "The status of the Age Assurance process.", + "knownValues": ["unknown", "pending", "assured", "blocked"] + }, + "state": { + "type": "object", + "description": "The user's computed Age Assurance state.", + "required": ["status", "access"], + "properties": { + "lastInitiatedAt": { + "type": "string", + "format": "datetime", + "description": "The timestamp when this state was last updated." + }, + "status": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#status" + }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "stateMetadata": { + "type": "object", + "description": "Additional metadata needed to compute Age Assurance state client-side.", + "required": [], + "properties": { + "accountCreatedAt": { + "type": "string", + "format": "datetime", + "description": "The account creation timestamp." + } + } + }, + "config": { + "type": "object", + "description": "", + "required": ["regions"], + "properties": { + "regions": { + "type": "array", + "description": "The per-region Age Assurance configuration.", + "items": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#configRegion" + } + } + } + }, + "configRegion": { + "type": "object", + "description": "The Age Assurance configuration for a specific region.", + "required": ["countryCode", "rules"], + "properties": { + "countryCode": { + "type": "string", + "description": "The ISO 3166-1 alpha-2 country code this configuration applies to." + }, + "regionCode": { + "type": "string", + "description": "The ISO 3166-2 region code this configuration applies to. If omitted, the configuration applies to the entire country." + }, + "rules": { + "type": "array", + "description": "The ordered list of Age Assurance rules that apply to this region. Rules should be applied in order, and the first matching rule determines the access level granted. The rules array should always include a default rule as the last item.", + "items": { + "type": "union", + "refs": [ + "#configRegionRuleDefault", + "#configRegionRuleIfDeclaredOverAge", + "#configRegionRuleIfDeclaredUnderAge", + "#configRegionRuleIfAssuredOverAge", + "#configRegionRuleIfAssuredUnderAge", + "#configRegionRuleIfAccountNewerThan", + "#configRegionRuleIfAccountOlderThan" + ] + } + } + } + }, + "configRegionRuleDefault": { + "type": "object", + "description": "Age Assurance rule that applies by default.", + "required": ["access"], + "properties": { + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "configRegionRuleIfDeclaredOverAge": { + "type": "object", + "description": "Age Assurance rule that applies if the user has declared themselves equal-to or over a certain age.", + "required": ["age", "access"], + "properties": { + "age": { + "type": "integer", + "description": "The age threshold as a whole integer." + }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "configRegionRuleIfDeclaredUnderAge": { + "type": "object", + "description": "Age Assurance rule that applies if the user has declared themselves under a certain age.", + "required": ["age", "access"], + "properties": { + "age": { + "type": "integer", + "description": "The age threshold as a whole integer." + }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "configRegionRuleIfAssuredOverAge": { + "type": "object", + "description": "Age Assurance rule that applies if the user has been assured to be equal-to or over a certain age.", + "required": ["age", "access"], + "properties": { + "age": { + "type": "integer", + "description": "The age threshold as a whole integer." + }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "configRegionRuleIfAssuredUnderAge": { + "type": "object", + "description": "Age Assurance rule that applies if the user has been assured to be under a certain age.", + "required": ["age", "access"], + "properties": { + "age": { + "type": "integer", + "description": "The age threshold as a whole integer." + }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "configRegionRuleIfAccountNewerThan": { + "type": "object", + "description": "Age Assurance rule that applies if the account is equal-to or newer than a certain date.", + "required": ["date", "access"], + "properties": { + "date": { + "type": "string", + "format": "datetime", + "description": "The date threshold as a datetime string." + }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "configRegionRuleIfAccountOlderThan": { + "type": "object", + "description": "Age Assurance rule that applies if the account is older than a certain date.", + "required": ["date", "access"], + "properties": { + "date": { + "type": "string", + "format": "datetime", + "description": "The date threshold as a datetime string." + }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + } + } + }, + "event": { + "type": "object", + "description": "Object used to store Age Assurance data in stash.", + "required": ["createdAt", "status", "access", "attemptId", "countryCode"], + "properties": { + "createdAt": { + "type": "string", + "format": "datetime", + "description": "The date and time of this write operation." + }, + "attemptId": { + "type": "string", + "description": "The unique identifier for this instance of the Age Assurance flow, in UUID format." + }, + "status": { + "type": "string", + "description": "The status of the Age Assurance process.", + "knownValues": ["unknown", "pending", "assured", "blocked"] + }, + "access": { + "description": "The access level granted based on Age Assurance data we've processed.", + "type": "string", + "knownValues": ["unknown", "none", "safe", "full"] + }, + "countryCode": { + "type": "string", + "description": "The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow." + }, + "regionCode": { + "type": "string", + "description": "The ISO 3166-2 region code provided when beginning the Age Assurance flow." + }, + "email": { + "type": "string", + "description": "The email used for Age Assurance." + }, + "initIp": { + "type": "string", + "description": "The IP address used when initiating the Age Assurance flow." + }, + "initUa": { + "type": "string", + "description": "The user agent used when initiating the Age Assurance flow." + }, + "completeIp": { + "type": "string", + "description": "The IP address used when completing the Age Assurance flow." + }, + "completeUa": { + "type": "string", + "description": "The user agent used when completing the Age Assurance flow." + } + } + } + } +} diff --git a/lexicons/app/bsky/ageassurance/getConfig.json b/lexicons/app/bsky/ageassurance/getConfig.json new file mode 100644 index 00000000..ca27af8d --- /dev/null +++ b/lexicons/app/bsky/ageassurance/getConfig.json @@ -0,0 +1,17 @@ +{ + "lexicon": 1, + "id": "app.bsky.ageassurance.getConfig", + "defs": { + "main": { + "type": "query", + "description": "Returns Age Assurance configuration for use on the client.", + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#config" + } + } + } + } +} diff --git a/lexicons/app/bsky/ageassurance/getState.json b/lexicons/app/bsky/ageassurance/getState.json new file mode 100644 index 00000000..a334969e --- /dev/null +++ b/lexicons/app/bsky/ageassurance/getState.json @@ -0,0 +1,35 @@ +{ + "lexicon": 1, + "id": "app.bsky.ageassurance.getState", + "defs": { + "main": { + "type": "query", + "description": "Returns server-computed Age Assurance state, if available, and any additional metadata needed to compute Age Assurance state client-side.", + "parameters": { + "type": "params", + "required": ["countryCode"], + "properties": { + "countryCode": { "type": "string" }, + "regionCode": { "type": "string" } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["state", "metadata"], + "properties": { + "state": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#state" + }, + "metadata": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#stateMetadata" + } + } + } + } + } + } +} diff --git a/lexicons/tools/ozone/moderation/defs.json b/lexicons/tools/ozone/moderation/defs.json index 22552a49..d5908562 100644 --- a/lexicons/tools/ozone/moderation/defs.json +++ b/lexicons/tools/ozone/moderation/defs.json @@ -527,14 +527,26 @@ "format": "datetime", "description": "The date and time of this write operation." }, + "attemptId": { + "type": "string", + "description": "The unique identifier for this instance of the age assurance flow, in UUID format." + }, "status": { "type": "string", - "description": "The status of the age assurance process.", + "description": "The status of the Age Assurance process.", "knownValues": ["unknown", "pending", "assured"] }, - "attemptId": { + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + }, + "countryCode": { "type": "string", - "description": "The unique identifier for this instance of the age assurance flow, in UUID format." + "description": "The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow." + }, + "regionCode": { + "type": "string", + "description": "The ISO 3166-2 region code provided when beginning the Age Assurance flow." }, "initIp": { "type": "string", @@ -564,6 +576,10 @@ "description": "The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state.", "knownValues": ["assured", "reset", "blocked"] }, + "access": { + "type": "ref", + "ref": "app.bsky.ageassurance.defs#access" + }, "comment": { "type": "string", "description": "Comment describing the reason for the override."