Namespace VpnHood.AppLib.Abstractions.Accounts
Classes
- AccessCodeInfo
THE one access code serving an account, whichever channel delivered it. The backend ranks everything the account holds — what is being paid for right now first, then the best of the rest — and recomputes the winner on every read, so the app is told a code and never a list. Nothing is stored as the selection, so nothing needs repairing when a code dies.
- Account
Represents the signed-in person's account, as the account backend gives it.
- AuthProviders
Well-known sign-in method ids. A sign-in method is a free-form STRING self-declared by the app's IAuthenticationExternalProvider — deliberately not an enum, so a third-party app built on these packages can introduce its own identity provider ("github", "samsung", …) without a change to this library. The id is a contract, lowercase by convention, consumed verbatim everywhere:
- the portal sends it as the wire discriminator and the backend keys its token verifiers on it (unknown ids are the backend's to reject — fail-closed);
- the UI derives its sign-in label key as SIGN_IN_WITH_<UPPERCASE-ID> and falls back to a generic "Sign in" when no such key exists. Changing an id is therefore a breaking change on the wire and in the UI label lookup.
- SignInOptions
Represents a sign-in: its method, with the credentials or the second step's code.
- SignInResult
What a SignIn call accomplished. See SignInState: anything but SignedIn means nothing is signed in yet and the caller must repeat SignIn with SignInOptions.TwoFactorCode.
- Subscription
The store subscription serving an account. Its very presence is the answer to "is this account subscribed" — the facts below are only meaningful together, so they live or go as one object rather than as eight independently-nullable fields on the account.
Interfaces
- IAccountProvider
Provides the app's account backend: the sign-in, the signed-in person's account and its premium code, the products the app may sell, and the account's deletion.
- IAuthenticationExternalProvider
Represents an identity provider's own sign-in on the device, as Google's or Apple's, which gives the ID token the account backend verifies.
- IAuthenticationProvider
Who is signed in, and the credential that proves it. Deliberately not a transport: it hands out a token and lets the caller own its own HttpClient, so nothing downstream inherits a client's base address, TLS policy or lifetime from here.
Disposable because it owns the external providers it was given, not because it owns any client.
- IRestoreCredentialProvider
The device side of zero-tap sign-in restoration (Android "Restore Credentials", a Play requirement for sign-in apps from April 2027): a platform-held key pair that follows the person through device-to-device transfer and cloud restore. The portal is the relying party and OWNS every options document — implementations pass the JSON through to the platform credential API verbatim and hand its response back verbatim, composing nothing themselves.
Each call takes the window, null where none is open; a platform API that needs one fails then.
Enums
- SignInState
What a SignIn call accomplished. Anything but SignedIn means NOTHING is signed in yet — the account uses a second factor, and the caller must repeat SignIn with SignInOptions.TwoFactorCode. One member per second-factor kind this app can actually answer: a kind the build does not know is refused by the provider rather than handed to a UI that could only show the wrong prompt.
- SubscriptionManagement
Where a subscription can be managed from here — cancel, change plan, change payment method. A reason rather than a yes/no, because the two ways of saying no need opposite things from the UI: one forbids naming a store, the other depends on naming ours.