account

package
v0.1.37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

This section is empty.

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

func WithClock(now func() time.Time) Option

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

func WithExport(x *export.Exporter) Option

WithExport is the exporter of the profiles and the account; with none, the export is refused unimplemented.

func WithForms added in v0.1.21

func WithForms(store forms.Store) Option

WithForms is the store of the scans of the forms of a parent's consent; with none, SendConsentForm is refused unavailable.

func WithTexts added in v0.1.21

func WithTexts(texts *legal.Texts) Option

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.

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

func New(db rpc.DB, rights Rights, signin deletion.Signin, options ...Option) *Service

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

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) 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

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

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

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

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

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) RequestChildConsent added in v0.1.7

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. A repeat under its key is the same consent, at the limit too, since the limit is 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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL