Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AbstractEThree

Hierarchy

  • AbstractEThree

Index

Properties

accessTokenProvider

accessTokenProvider: IAccessTokenProvider

Instance of IAccessTokenProvider implementation. Using [[getToken]] to receive JWT.

cardManager

cardManager: CardManager

Instance of CardManager. Used to create cards with user public keys.

identity

identity: string

Unique identifier of current user. Received from JWT token.

Protected inProcess

inProcess: boolean = false

keyEntryStorage

keyEntryStorage: IKeyEntryStorage

Instance of IKeyEntryStorage implementation. Used for storing private keys.

Protected keyLoader

keyLoader: PrivateKeyLoader

Optional keyPairType

keyPairType: any

virgilCrypto

virgilCrypto: ICrypto

Instance of implementation of ICrypto interface.

Methods

authDecrypt

  • authDecrypt(message: Data): Promise<NodeBuffer | string>
  • authDecrypt(message: Data, publicKey: IPublicKey): Promise<NodeBuffer | string>
  • authDecrypt(message: Data, card: ICard, encryptedAt?: Date): Promise<NodeBuffer | string>

authEncrypt

backupPrivateKey

  • backupPrivateKey(pwd: string, keyName?: string): Promise<void>
  • Uploads current user private key to Virgil Keyknox Storage.

    Parameters

    • pwd: string

      User password for access to Virgil Keyknox Storage

    • Optional keyName: string

      Is a name that would be used to store backup in the cloud.

    Returns Promise<void>

changePassword

  • changePassword(oldPwd: string, newPwd: string, keyName?: string): Promise<void>
  • Changes password for access to current user private key backup.

    Parameters

    • oldPwd: string

      users old password

    • newPwd: string

      users new password

    • Optional keyName: string

    Returns Promise<void>

cleanup

  • cleanup(): Promise<void>

createGroup

decrypt

  • decrypt(message: Data): Promise<NodeBuffer | string>
  • decrypt(message: Data, senderCard: ICard): Promise<NodeBuffer | string>
  • decrypt(message: Data, senderCard: ICard, encryptedAt: Date): Promise<NodeBuffer | string>
  • decrypt(message: Data, senderPublicKey: IPublicKey): Promise<NodeBuffer | string>
  • Decrypts and verifies the data encrypted by the current user for the current user.

    Parameters

    • message: Data

      Message to decrypt

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

  • Decrypts and verifies the data encrypted by the user identified by senderCard for the current user.

    Parameters

    • message: Data

      Message to decrypt

    • senderCard: ICard

      Virgil Card of the user who encrypted and signed the message.

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

  • Decrypts and verifies the data encrypted by the user identified by senderCard for the current user. If the sender had ever rotated their keys (e.g. by using the {@link EThree.rotatePrivateKey} method), then the encryptedAt date is used to find the public key that was current at the time of encryption.

    Parameters

    • message: Data

      Message to decrypt

    • senderCard: ICard

      Virgil Card of the user who encrypted and signed the message.

    • encryptedAt: Date

      The date the message was encrypted on.

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

  • Decrypts and verifies the data encrypted by the user identified by senderPublicKey for the current user.

    deprecated

    and will be removed in next major release.

    Use the overload that accepts Virgil Card object instead.

    Parameters

    • message: Data

      Message to decrypt

    • senderPublicKey: IPublicKey

      Public key of the user who encrypted and signed the message.

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

deleteGroup

  • deleteGroup(groupId: Data): Promise<void>

encrypt

  • Encrypts and signs the message for the current user.

    Parameters

    • message: Data

      Message to sign and encrypt.

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise

  • Encrypts and signs the message for the current user and a single recipient user.

    Parameters

    • message: Data

      Message to sign and encrypt.

    • card: ICard

      Virgil Card of the encrypted message recipient.

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

  • Encrypts and signs the message for the current user and multiple recipient users.

    Parameters

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

  • Encrypts and signs the message for the current user and a single recipient user.

    Use the overload that accepts ICard object instead.

    Parameters

    • message: Data

      Message to sign and encrypt.

    • publicKey: IPublicKey

      Public key of the encrypted message recipient.

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

  • Encrypts and signs the message for the current user and multiple recipient users.

    deprecated

    and will be removed in next major release.

    Use the overload that accepts FindUsersResult object instead.

    Parameters

    Returns Promise<NodeBuffer | string>

    Promise that is that resolves to a string if message was a string and Buffer otherwise.

findUsers

  • findUsers(identity: string): Promise<ICard>
  • findUsers(identities: string[]): Promise<FindUsersResult>
  • Finds Virgil Card for user identity registered on Virgil Cloud.

    throws

    {UsersNotFoundError} in case the Virgil Card wasn't found for the given identity.

    throws

    {UsersFoundWithMultipleCardsError} in case the given user has more than one Virgil Card, which is not allowed with E3kit.

    Parameters

    • identity: string

    Returns Promise<ICard>

    • Promise that resolves to the Virgil Card object.
  • Finds Virgil Cards for user identities registered on Virgil Cloud.

    throws

    {UsersNotFoundError} in case the Virgil Card wasn't found for any one of the given identities.

    throws

    {UsersFoundWithMultipleCardsError} in case any one of the given users have more than one Virgil Card, which is not allowed with E3kit.

    Parameters

    • identities: string[]

    Returns Promise<FindUsersResult>

    • Promise that resolves to a hash with identities as keys and Virgil Card objects as values.

getGroup

hasLocalPrivateKey

  • hasLocalPrivateKey(): Promise<boolean>

loadGroup

  • loadGroup(groupId: Data, initiatorCard: ICard): Promise<Group>

lookupPublicKeys

  • lookupPublicKeys(identity: string): Promise<IPublicKey>
  • lookupPublicKeys(identities: string[]): Promise<LookupResult>
  • Finds public key for user identity registered on Virgil Cloud.

    deprecated

    and will be removed in next major release.

    Use the {@link EThree.findUsers} instead, which returns Virgil Cards instead of just the public keys. You can get a public key out of the Virgil Card object via the publicKey property.

    Parameters

    • identity: string

    Returns Promise<IPublicKey>

    • Promise that resolves to a public key object.
  • Finds public keys for user identities registered on Virgil Cloud.

    deprecated

    and will be removed in next major release.

    Use the {@link EThree.findUsers} instead, which returns Virgil Cards instead of just the public keys. You can get a public key out of the Virgil Card object via the publicKey property.

    Parameters

    • identities: string[]

    Returns Promise<LookupResult>

    • Promise that resolves to a hash with identities as keys and public key objects as values.

register

  • register(keyPair?: IKeyPair): Promise<void>

resetPrivateKeyBackup

  • resetPrivateKeyBackup(): Promise<void>
  • resetPrivateKeyBackup(pwd: string): Promise<void>
  • Delete private key saved in Virgil Keyknox Storage.

    Returns Promise<void>

    • Promise that is resolved if everything went fine.
  • Delete private key saved in Virgil Keyknox Storage.

    deprecated

    and will be removed in next major release.

    Parameters

    • pwd: string

      User password for access to Virgil Keyknox Storage.

    Returns Promise<void>

    • Promise that is resolved if everything went fine.

resetPrivateKeyBackupWithKeyName

  • resetPrivateKeyBackupWithKeyName(keyName: string): Promise<void>

restorePrivateKey

  • restorePrivateKey(pwd: string, keyName?: string): Promise<void>
  • Downloads private key from Virgil Cloud. Use backupPrivateKey to upload the key first.

    Parameters

    • pwd: string

      User password for access to Virgil Keyknox Storage.

    • Optional keyName: string

      Is a name for the key backup in the cloud.

    Returns Promise<void>

rotatePrivateKey

  • rotatePrivateKey(): Promise<void>

unregister

  • unregister(): Promise<void>
  • Unregister current user. Revokes public key in Virgil Cloud and deletes local private key.

    throws

    {RegisterRequiredError} If current user is not registered (i.e. there is no Virgil Card for this identity)

    throws

    {MultipleCardsError} If there is more than one Virgil Card for this identity

    Returns Promise<void>

Generated using TypeDoc