Documentation
¶
Overview ¶
Package account is api's AccountService of the contract novatrail.api.v1: the account and its invite code, and, task by task, its PIN, profiles and deletion (R04, R34, R35, R36). Its methods run after the checks of architecture 3.1, which give them the caller (rpc.CallerFrom); a method it has no handler for yet answers unimplemented.
Index ¶
- Constants
- type Option
- type OwnKeys
- type Rights
- type Service
- func (s *Service) CancelChildConsent(ctx context.Context, req *v1.CancelChildConsentRequest) (*v1.CancelChildConsentResponse, error)
- func (s *Service) ChangePin(ctx context.Context, req *v1.ChangePinRequest) (*v1.ChangePinResponse, error)
- func (s *Service) CheckOwnKey(ctx context.Context, req *v1.CheckOwnKeyRequest) (*v1.CheckOwnKeyResponse, error)
- func (s *Service) CreateAccount(ctx context.Context, req *v1.CreateAccountRequest) (*v1.CreateAccountResponse, error)
- func (s *Service) CreateChildProfile(ctx context.Context, req *v1.CreateChildProfileRequest) (*v1.CreateChildProfileResponse, error)
- func (s *Service) CreateOwnerProfile(ctx context.Context, req *v1.CreateOwnerProfileRequest) (*v1.CreateOwnerProfileResponse, error)
- func (s *Service) DeleteAccount(ctx context.Context, _ *v1.DeleteAccountRequest) (*v1.DeleteAccountResponse, error)
- func (s *Service) DeleteProfile(ctx context.Context, req *v1.DeleteProfileRequest) (*v1.DeleteProfileResponse, error)
- func (s *Service) ExportAccount(ctx context.Context, _ *v1.ExportAccountRequest) (*v1.ExportAccountResponse, error)
- func (s *Service) ExportProfile(ctx context.Context, req *v1.ExportProfileRequest) (*v1.ExportProfileResponse, error)
- func (s *Service) GetAccount(ctx context.Context, _ *v1.GetAccountRequest) (*v1.GetAccountResponse, error)
- func (s *Service) GetQuota(ctx context.Context, req *v1.GetQuotaRequest) (*v1.GetQuotaResponse, error)
- func (s *Service) GiveOwnConsent(ctx context.Context, req *v1.GiveOwnConsentRequest) (*v1.GiveOwnConsentResponse, error)
- func (s *Service) ListOwnKeyProviders(ctx context.Context, req *v1.ListOwnKeyProvidersRequest) (*v1.ListOwnKeyProvidersResponse, error)
- func (s *Service) RequestChildConsent(ctx context.Context, req *v1.RequestChildConsentRequest) (*v1.RequestChildConsentResponse, error)
- func (s *Service) ResetPin(ctx context.Context, req *v1.ResetPinRequest) (*v1.ResetPinResponse, error)
- func (s *Service) RestateAge(ctx context.Context, req *v1.RestateAgeRequest) (*v1.RestateAgeResponse, error)
- func (s *Service) SendConsentForm(ctx context.Context, req *v1.SendConsentFormRequest) (*v1.SendConsentFormResponse, error)
- func (s *Service) SetPin(ctx context.Context, req *v1.SetPinRequest) (*v1.SetPinResponse, error)
- func (s *Service) SetVoicing(ctx context.Context, req *v1.SetVoicingRequest) (*v1.SetVoicingResponse, error)
- func (s *Service) SetWorkStorage(ctx context.Context, req *v1.SetWorkStorageRequest) (*v1.SetWorkStorageResponse, error)
- func (s *Service) UpdateProfile(ctx context.Context, req *v1.UpdateProfileRequest) (*v1.UpdateProfileResponse, error)
- func (s *Service) VerifyPin(ctx context.Context, req *v1.VerifyPinRequest) (*v1.VerifyPinResponse, error)
- func (s *Service) WithdrawOwnConsent(ctx context.Context, req *v1.WithdrawOwnConsentRequest) (*v1.WithdrawOwnConsentResponse, error)
Constants ¶
const ( MaxKeyChecks = 10 KeyCheckWindow = time.Hour )
The limit of the checks of a key (R78): no more than MaxKeyChecks on the account in any KeyCheckWindow, across the edge of a window too, so that CheckOwnKey is no way to try keys one after another.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.1.6
type Option func(*Service)
Option is a choice of New's that a test makes.
func WithClock ¶ added in v0.1.6
WithClock is the clock the handlers go by — the PIN's count, the family day of the quota —, the system's by default.
func WithExport ¶ added in v0.1.21
WithExport is the exporter of the profiles and the account; with none, the export is refused unimplemented.
func WithForms ¶ added in v0.1.21
WithForms is the store of the scans of the forms of a parent's consent; with none, SendConsentForm is refused unavailable.
func WithOwnKeys ¶ added in v0.1.41
WithOwnKeys is the gate the own key's requests ask; with none, they are refused unimplemented.
func WithTexts ¶ added in v0.1.21
WithTexts is the legal texts the requests of a consent name, those of the tag by default (legal.Spec): a self-hosted copy's folder.
func WithoutKeyCheckLimit ¶ added in v0.1.47
func WithoutKeyCheckLimit() Option
WithoutKeyCheckLimit lifts the limit of the checks of a key, for the dev mode's stub of tutor: it calls no provider, so no key is tried there, and the runs of app in Playwright check keys again and again (R78).
type OwnKeys ¶ added in v0.1.41
type OwnKeys interface {
OwnKeyProviders(category formatv0.AgeCategory) []admission.Provider
CheckKey(ctx context.Context, category formatv0.AgeCategory, provider, key string) (tutor.KeyCheck, error)
}
OwnKeys is what tells the providers open to an own key at an age category, and checks a key: admission.Gate, which asks tutor's choice and tutor's check (R72, R73).
type Rights ¶ added in v0.1.8
type Rights interface {
WriteOwner(ctx context.Context, accountID, profileID string) error
Can(ctx context.Context, accountID string, right authz.Right, profileID string) (bool, error)
deletion.Rights
}
Rights is what writes the tuple of a profile it makes, and deletes the tuples of what it deletes: authz.Rights.
type Service ¶
type Service struct {
apiv1connect.UnimplementedAccountServiceHandler
// contains filtered or unexported fields
}
Service is the AccountService on the database api.
func New ¶
New is the AccountService on db, with the tuples of the profiles in rights and the users at signin.
func (*Service) CancelChildConsent ¶ added in v0.1.21
func (s *Service) CancelChildConsent(ctx context.Context, req *v1.CancelChildConsentRequest) (*v1.CancelChildConsentResponse, error)
CancelChildConsent takes back a consent for a child that has no profile: one that waits is erased with its form — the daily job erases the scan —, one confirmed leaves its minimal record and its form for their term (R117 spec). A consent not there is CAUSE_NOT_FOUND, which is the answer to a repeat too.
func (*Service) ChangePin ¶ added in v0.1.6
func (s *Service) ChangePin(ctx context.Context, req *v1.ChangePinRequest) (*v1.ChangePinResponse, error)
ChangePin changes the PIN by the PIN before it, which counts as VerifyPin counts it; a wrong one changes nothing.
func (*Service) CheckOwnKey ¶ added in v0.1.42
func (s *Service) CheckOwnKey(ctx context.Context, req *v1.CheckOwnKeyRequest) (*v1.CheckOwnKeyResponse, error)
CheckOwnKey checks the owner's own key at its provider through tutor, by a request with nothing of a learner's, when the key is connected (R73; R84 spec, R96 tutor). A key with no provider or no key is invalid_argument, as on the requests of an attempt, and a profile not of the category adult is CAUSE_KEY_NOT_FOR_PROFILE, both with no call; a provider closed to the key at the profile is PROVIDER_CLOSED with no call, as ListOwnKeyProviders leaves it out. A check beyond the account's limit is resource_exhausted with no call (R78). A provider that gave no answer is no refusal: the check is OWN_KEY_CHECK_UNSPECIFIED with the outcome CAUSE_AI_FAILURE. The key lives in the request's memory alone: the log line names how the check ended.
func (*Service) CreateAccount ¶
func (s *Service) CreateAccount(ctx context.Context, req *v1.CreateAccountRequest) (*v1.CreateAccountResponse, error)
CreateAccount creates the caller's account by an invite code, the owner's statement that they are 18 or older and the current versions of privacy-policy and terms-of-use, which it records (R130, R136 spec): a text in force left out, or a version not current, is CAUSE_TEXT_NOT_CURRENT. A caller with an account already gets CAUSE_ALREADY_EXISTS before the statement and the code are looked at, so that a repeat after a lost answer gets that rather than a code redeemed (contract, CreateAccount).
func (*Service) CreateChildProfile ¶ added in v0.1.7
func (s *Service) CreateChildProfile(ctx context.Context, req *v1.CreateChildProfileRequest) (*v1.CreateChildProfileResponse, error)
CreateChildProfile creates a child's profile by its consent, of its category and country, and its tuple before the COMMIT: a parent's consent once it is confirmed; the learner's own at once, and the profile waits for it (contract, CreateChildProfile). A consent with its profile already is CAUSE_ALREADY_EXISTS before its state is looked at, so that a repeat is told the profile is there.
func (*Service) CreateOwnerProfile ¶ added in v0.1.7
func (s *Service) CreateOwnerProfile(ctx context.Context, req *v1.CreateOwnerProfileRequest) (*v1.CreateOwnerProfileResponse, error)
CreateOwnerProfile creates the owner's profile, of the category adult by the owner's statement, with its consent, and its tuple before the COMMIT (R04, R36; architecture 3.1). A profile of the owner there already comes before the country, so that a repeat is told it is there.
func (*Service) DeleteAccount ¶ added in v0.1.8
func (s *Service) DeleteAccount(ctx context.Context, _ *v1.DeleteAccountRequest) (*v1.DeleteAccountResponse, error)
DeleteAccount deletes the account, all of it and its user at the sign-in service, by a fresh sign-in, which the checks held (R20, R21). Once its data is gone from the database the answer is "deleted", and what does not finish the daily job does; a repeat gets "the account is gone" from the checks.
func (*Service) DeleteProfile ¶ added in v0.1.8
func (s *Service) DeleteProfile(ctx context.Context, req *v1.DeleteProfileRequest) (*v1.DeleteProfileResponse, error)
DeleteProfile deletes the profile and all of it, by can_manage and a fresh sign-in, which the checks held (R20, R21). The owner's profile goes the same way, and the last profile leaves the account without profiles. A tuple left after the database is done is still "deleted": its line names the failure, and the profile's row is gone, so the tuple gives a right to nothing; its repeat deletes it (architecture 3.10).
func (*Service) ExportAccount ¶ added in v0.1.21
func (s *Service) ExportAccount(ctx context.Context, _ *v1.ExportAccountRequest) (*v1.ExportAccountResponse, error)
ExportAccount gives api's part of the export of the account and every profile of it, api.zip by spec's part export/ (R52; R135 spec).
func (*Service) ExportProfile ¶ added in v0.1.21
func (s *Service) ExportProfile(ctx context.Context, req *v1.ExportProfileRequest) (*v1.ExportProfileResponse, error)
ExportProfile gives api's part of the export of a profile, api.zip by spec's part export/ (R52; R135 spec): an adult's action with can_manage — the action unspecified is one —, or, at a profile whose learner consents themselves, the learner's own with can_learn, which neither a consent that waits nor an age to give again refuses; at any other profile the learner's is CAUSE_ADULT_NEEDED (R132 spec).
func (*Service) GetAccount ¶
func (s *Service) GetAccount(ctx context.Context, _ *v1.GetAccountRequest) (*v1.GetAccountResponse, error)
GetAccount gives the account of the caller: whether its PIN is set, its profiles and its consents for a child with no profile. Open attempts and lesson runs come with epic E3, which keeps them.
func (*Service) GetQuota ¶ added in v0.1.34
func (s *Service) GetQuota(ctx context.Context, req *v1.GetQuotaRequest) (*v1.GetQuotaResponse, error)
GetQuota is the share of the family day's quota of platform AI that the profile has spent, and beside an adult's action the account's too, never a sum in dollars (the amendment of 2026-11-12 to R11; Д229 spec). A learning action holds can_learn, which the checks asked, and the profile's consent and age, as every learning request; an adult's, can_view, which the handler asks — the checks before it hold can_learn alone, as for the skill map. The share is of the spending settled, without the reserves of calls still going, on the day the account keeps: the request carries no offset, and writes nothing.
func (*Service) GiveOwnConsent ¶ added in v0.1.21
func (s *Service) GiveOwnConsent(ctx context.Context, req *v1.GiveOwnConsentRequest) (*v1.GiveOwnConsentResponse, error)
GiveOwnConsent gives the learner's own consent at their profile, to the current version of teen-consent: a profile below the age of digital consent, whose consent an adult gives, is CAUSE_ADULT_NEEDED. A consent given already is the answer, as a repeat's.
func (*Service) ListOwnKeyProviders ¶ added in v0.1.41
func (s *Service) ListOwnKeyProviders(ctx context.Context, req *v1.ListOwnKeyProvidersRequest) (*v1.ListOwnKeyProvidersResponse, error)
ListOwnKeyProviders names the providers of the admission table, in its order, whose own key tutor admits at the profile's category for one kind of call api makes at least, by code and name as the table writes them (R72; R84, R96 spec): none at a category not adult, with no refusal. The checks have held can_manage; a profile gone since is CAUSE_NO_PROFILE.
func (*Service) RequestChildConsent ¶ added in v0.1.7
func (s *Service) RequestChildConsent(ctx context.Context, req *v1.RequestChildConsentRequest) (*v1.RequestChildConsentResponse, error)
RequestChildConsent records a consent for a child that waits, with the category worked out of the age and the country by the table of the age of digital consent; the age in years lives in this request's memory alone (privacy 3.3 spec; R134 spec). Below the age of the country the consent is a parent's, by a code of its request; from it, the learner's own. The request names the current version of parent-consent whoever gives it, on the day of its time in UTC. A repeat under its key is the same consent, at the limit and past the day of a new version too, since the limit and the texts are checked after the key.
func (*Service) ResetPin ¶ added in v0.1.6
func (s *Service) ResetPin(ctx context.Context, req *v1.ResetPinRequest) (*v1.ResetPinResponse, error)
ResetPin changes a forgotten PIN by a fresh sign-in, which the checks have held last (R20): it sets the new PIN whether there was one or not, and opens the input.
func (*Service) RestateAge ¶ added in v0.1.21
func (s *Service) RestateAge(ctx context.Context, req *v1.RestateAgeRequest) (*v1.RestateAgeResponse, error)
RestateAge gives the age of a profile again — after CAUSE_AGE_NEEDED, at the yearly check, or with a new country — and works out its category anew by the table, keeping the age nowhere (privacy 3.3 spec; R134 spec). A category whose consent another gives leaves the profile waiting for it: the learner's own, or a parent's by a new code; the consent before is kept as its minimal record. The owner's profile gives its country alone. A repeat under its key is the same profile; the fingerprint is slow, as the request carries the age.
func (*Service) SendConsentForm ¶ added in v0.1.21
func (s *Service) SendConsentForm(ctx context.Context, req *v1.SendConsentFormRequest) (*v1.SendConsentFormResponse, error)
SendConsentForm keeps the scan of the signed form of a parent's consent that waits — the account's own, or one a profile waits for — in the operator's store, apart from the database, where the operator checks it against the code and confirms the consent (R116 spec). A new scan takes the place of the one before. With no store configured, the request is refused unavailable. A repeat under its key gives the same consent, with the form it sent; the key's fingerprint is fast, as the scan carries no PIN and no age.
func (*Service) SetPin ¶ added in v0.1.6
func (s *Service) SetPin(ctx context.Context, req *v1.SetPinRequest) (*v1.SetPinResponse, error)
SetPin sets the PIN of the section for adults, while the account has none.
func (*Service) SetVoicing ¶ added in v0.1.7
func (s *Service) SetVoicing(ctx context.Context, req *v1.SetVoicingRequest) (*v1.SetVoicingResponse, error)
SetVoicing sets the voicing alone, from the screen of a task: the checks have held the right can_learn, which the learner has as well as the adult.
func (*Service) SetWorkStorage ¶ added in v0.1.21
func (s *Service) SetWorkStorage(ctx context.Context, req *v1.SetWorkStorageRequest) (*v1.SetWorkStorageResponse, error)
SetWorkStorage switches the storage of the learner's works on the server on or off (R113, R127 spec): an adult with can_manage, as the action ADULT, or, at a profile whose learner consents themselves, the learner alone, as the action LEARNING — the other is CAUSE_LEARNER_DECIDES or CAUSE_ADULT_NEEDED. Switching on names the current version of storage-consent and needs the profile's consent; switching off records when, even while it waits. A learner who switches on what an adult did gives their own consent in its place (R141 spec). A state that holds already is the answer, as a repeat's.
func (*Service) UpdateProfile ¶ added in v0.1.7
func (s *Service) UpdateProfile(ctx context.Context, req *v1.UpdateProfileRequest) (*v1.UpdateProfileResponse, error)
UpdateProfile changes the settings sent, and leaves the others (contract, ProfileSettings). The checks have held the right can_manage.
func (*Service) VerifyPin ¶ added in v0.1.6
func (s *Service) VerifyPin(ctx context.Context, req *v1.VerifyPinRequest) (*v1.VerifyPinResponse, error)
VerifyPin checks a PIN: a wrong one counts toward closing the input.
func (*Service) WithdrawOwnConsent ¶ added in v0.1.21
func (s *Service) WithdrawOwnConsent(ctx context.Context, req *v1.WithdrawOwnConsentRequest) (*v1.WithdrawOwnConsentResponse, error)
WithdrawOwnConsent withdraws the learner's own consent — given, or asked of a learner who reached the age while a parent's stood (R141 spec) — and deletes their profile and all of it, as DeleteProfile does, leaving the consent's minimal record and the problem reports (R117, R132 spec). A consent an adult gives is CAUSE_ADULT_NEEDED; a profile gone, a repeat's, CAUSE_NO_PROFILE.