Padloc Logo Docs & Resources

Class: Client

client.Client

Client-side interface for Client-Server communication. Manages serialization, authentication and some state like current session and account.

Hierarchy

  • API

    Client

Constructors

constructor

new Client(state, sender, hook?)

Parameters

Name Type
state ClientState
sender Sender
hook? (req: Request, res: null | Response, err: null | Err) => void

Overrides

API.constructor

Defined in

core/src/client.ts:28

Properties

handlerDefinitions

handlerDefinitions: HandlerDefinition[]

Inherited from

API.handlerDefinitions

Defined in

core/src/api.ts:428


online

online: boolean = true

Defined in

core/src/client.ts:26


state

state: ClientState

Accessors

session

get session(): null | Session

The current session

Returns

null | Session

Defined in

core/src/client.ts:58

Methods

acceptInvite

acceptInvite(_invite): PromiseWithProgress<void>

Accept an Invite

authentication_required

Requires the authenticated account to be the recipient of the invite.

Parameters

Name Type
_invite Invite

Returns

PromiseWithProgress<void>

Inherited from

API.acceptInvite

Defined in

core/src/api.ts:658


call

call(method, params?, progress?): Promise<Response>

Generic method for making an RPC call

Parameters

Name Type
method string
params? any[]
progress? RequestProgress

Returns

Promise<Response>

Defined in

core/src/client.ts:63


completeAuthRequest

completeAuthRequest(_params): PromiseWithProgress<CompleteAuthRequestResponse>

Parameters

Name Type
_params CompleteAuthRequestParams

Returns

PromiseWithProgress<CompleteAuthRequestResponse>

Inherited from

API.completeAuthRequest

Defined in

core/src/api.ts:455


completeCreateSession

completeCreateSession(_params): PromiseWithProgress<Session>

Create new Session which can be used to authenticate future request

Parameters

Name Type
_params CompleteCreateSessionParams

Returns

PromiseWithProgress<Session>

Inherited from

API.completeCreateSession

Defined in

core/src/api.ts:481


completeRegisterAuthenticator

completeRegisterAuthenticator(_params): PromiseWithProgress<CompleteRegisterMFAuthenticatorResponse>

Parameters

Name Type
_params CompleteRegisterMFAuthenticatorParams

Returns

PromiseWithProgress<CompleteRegisterMFAuthenticatorResponse>

Inherited from

API.completeRegisterAuthenticator

Defined in

core/src/api.ts:438


createAccount

createAccount(_params): PromiseWithProgress<Account>

Create a new Account

Parameters

Name Type
_params CreateAccountParams

Returns

PromiseWithProgress<Account>

Inherited from

API.createAccount

Defined in

core/src/api.ts:497


createAttachment

createAttachment(_attachment): PromiseWithProgress<string>

Parameters

Name Type
_attachment Attachment

Returns

PromiseWithProgress<string>

Inherited from

API.createAttachment

Defined in

core/src/api.ts:663


createKeyStoreEntry

createKeyStoreEntry(_params): PromiseWithProgress<KeyStoreEntry>

Parameters

Name Type
_params CreateKeyStoreEntryParams

Returns

PromiseWithProgress<KeyStoreEntry>

Inherited from

API.createKeyStoreEntry

Defined in

core/src/api.ts:688


createOrg

createOrg(_params): PromiseWithProgress<Org>

Create a new Org

authentication_required

Parameters

Name Type
_params Org

Returns

PromiseWithProgress<Org>

Inherited from

API.createOrg

Defined in

core/src/api.ts:549


createVault

createVault(_vault): PromiseWithProgress<Vault>

Create a new vault

authentication_required

Requires the OrgRole.Admin role on the associated organization

Parameters

Name Type
_vault Vault

Returns

PromiseWithProgress<Vault>

Inherited from

API.createVault

Defined in

core/src/api.ts:591


deleteAccount

deleteAccount(): PromiseWithProgress<void>

Delete current account

Returns

PromiseWithProgress<void>

Inherited from

API.deleteAccount

Defined in

core/src/api.ts:539


deleteAttachment

deleteAttachment(_attachment): PromiseWithProgress<void>

Parameters

Name Type
_attachment DeleteAttachmentParams

Returns

PromiseWithProgress<void>

Inherited from

API.deleteAttachment

Defined in

core/src/api.ts:673


deleteAuthenticator

deleteAuthenticator(_id): PromiseWithProgress<void>

Parameters

Name Type
_id string

Returns

PromiseWithProgress<void>

Inherited from

API.deleteAuthenticator

Defined in

core/src/api.ts:445


deleteKeyStoreEntry

deleteKeyStoreEntry(_params): Promise<void>

Parameters

Name Type
_params string

Returns

Promise<void>

Inherited from

API.deleteKeyStoreEntry

Defined in

core/src/api.ts:698


deleteLegacyAccount

deleteLegacyAccount(): PromiseWithProgress<void>

Returns

PromiseWithProgress<void>

Inherited from

API.deleteLegacyAccount

Defined in

core/src/api.ts:683


deleteOrg

deleteOrg(_id): PromiseWithProgress<void>

Parameters

Name Type
_id string

Returns

PromiseWithProgress<void>

Inherited from

API.deleteOrg

Defined in

core/src/api.ts:579


deleteVault

deleteVault(_id): PromiseWithProgress<void>

Delete the Vault with the given id

authentication_required

Requires at least the OrgRole.Admin role on the organization the vault belongs to. Private vaults cannot be deleted.

Parameters

Name Type
_id string

Returns

PromiseWithProgress<void>

Inherited from

API.deleteVault

Defined in

core/src/api.ts:633


getAccount

getAccount(): PromiseWithProgress<Account>

Get the Account associated with the current session

authentication_required

Returns

PromiseWithProgress<Account>

Inherited from

API.getAccount

Defined in

core/src/api.ts:507


getAttachment

getAttachment(_attachment): PromiseWithProgress<Attachment>

Parameters

Name Type
_attachment GetAttachmentParams

Returns

PromiseWithProgress<Attachment>

Inherited from

API.getAttachment

Defined in

core/src/api.ts:668


getAuthInfo

getAuthInfo(): Promise<AuthInfo>

Get the AuthInfo for the current account

Returns

Promise<AuthInfo>

Inherited from

API.getAuthInfo

Defined in

core/src/api.ts:513


getInvite

getInvite(_params): PromiseWithProgress<Invite>

Get an Invite.

authentication_required

Requires the authenticated account to either be an OrgRole.Owner of the associated organization or the recipient of the invite.

Parameters

Name Type
_params GetInviteParams

Returns

PromiseWithProgress<Invite>

Inherited from

API.getInvite

Defined in

core/src/api.ts:646


getKeyStoreEntry

getKeyStoreEntry(_params): Promise<KeyStoreEntry>

Parameters

Name Type
_params GetKeyStoreEntryParams

Returns

Promise<KeyStoreEntry>

Inherited from

API.getKeyStoreEntry

Defined in

core/src/api.ts:693


getLegacyData

getLegacyData(_params): PromiseWithProgress<PBES2Container>

Parameters

Name Type
_params GetLegacyDataParams

Returns

PromiseWithProgress<PBES2Container>

Inherited from

API.getLegacyData

Defined in

core/src/api.ts:678


getOrg

getOrg(_id): PromiseWithProgress<Org>

Get the Org for a given id.

authentication_required

Requires the authenticated account to be a member of the given organization

Parameters

Name Type
_id string

Returns

PromiseWithProgress<Org>

Inherited from

API.getOrg

Defined in

core/src/api.ts:561


getVault

getVault(_id): PromiseWithProgress<Vault>

Get the Vault with the given id

authentiation_required

If the vault belongs to an organization, the authenticated account needs to be assigned to the given vault either directly or through a Group. Otherwise, only access to the accounts private vault is allowed.

Parameters

Name Type
_id string

Returns

PromiseWithProgress<Vault>

Inherited from

API.getVault

Defined in

core/src/api.ts:605


recoverAccount

recoverAccount(_params): PromiseWithProgress<Account>

Initiate account recovery

Parameters

Name Type
_params RecoverAccountParams

Returns

PromiseWithProgress<Account>

Inherited from

API.recoverAccount

Defined in

core/src/api.ts:531


removeTrustedDevice

removeTrustedDevice(_id): PromiseWithProgress<void>

Parameters

Name Type
_id string

Returns

PromiseWithProgress<void>

Inherited from

API.removeTrustedDevice

Defined in

core/src/api.ts:708


revokeSession

revokeSession(_id): PromiseWithProgress<void>

Revoke a Session, effectively logging out any client authenticated with it

Parameters

Name Type
_id string

Returns

PromiseWithProgress<void>

Inherited from

API.revokeSession

Defined in

core/src/api.ts:489


startAuthRequest

startAuthRequest(_params): PromiseWithProgress<StartAuthRequestResponse>

Parameters

Name Type
_params StartAuthRequestParams

Returns

PromiseWithProgress<StartAuthRequestResponse>

Inherited from

API.startAuthRequest

Defined in

core/src/api.ts:450


startCreateSession

startCreateSession(_params): PromiseWithProgress<StartCreateSessionResponse>

Initiate the login procedure for a given account by requesting the authentication params which are required for proceeding with [[createSession]].

Parameters

Name Type
_params StartCreateSessionParams

Returns

PromiseWithProgress<StartCreateSessionResponse>

Inherited from

API.startCreateSession

Defined in

core/src/api.ts:464


startRegisterAuthenticator

startRegisterAuthenticator(_params): PromiseWithProgress<StartRegisterAuthenticatorResponse>

Parameters

Name Type
_params StartRegisterAuthenticatorParams

Returns

PromiseWithProgress<StartRegisterAuthenticatorResponse>

Inherited from

API.startRegisterAuthenticator

Defined in

core/src/api.ts:431


updateAccount

updateAccount(_account): PromiseWithProgress<Account>

Update the Account associated with the current session.

authentication_required

Parameters

Name Type
_account Account

Returns

PromiseWithProgress<Account>

Inherited from

API.updateAccount

Defined in

core/src/api.ts:523


updateAuth

updateAuth(_params): PromiseWithProgress<void>

Update the authentication params stored on the server. This is usually used in case a users master password has changed.

Parameters

Name Type
_params UpdateAuthParams

Returns

PromiseWithProgress<void>

Inherited from

API.updateAuth

Defined in

core/src/api.ts:473


updateOrg

updateOrg(_org): PromiseWithProgress<Org>

Updates a given Org

authentication_required

Updating members, organization name or pubic/private keys requires the OrgRole.Owner role, while any other changes require the OrgRole.Admin role.

Parameters

Name Type
_org Org

Returns

PromiseWithProgress<Org>

Inherited from

API.updateOrg

Defined in

core/src/api.ts:574


updateVault

updateVault(_vault): PromiseWithProgress<Vault>

Update the given Vault

authentiation_required

If vault belongs to an organization, the authenticated account needs to be be assigned to the given vault either directly or through a Group and have explicit write access. Otherwise, only access to the accounts private vault is allowed.

Parameters

Name Type
_vault Vault

Returns

PromiseWithProgress<Vault>

Inherited from

API.updateVault

Defined in

core/src/api.ts:620