import { IPublicKey } from './types' ; /**
 * Custom error class for errors specific to Virgil E3kit.
 */ export class SdkError extends Error { constructor ( m , name = 'SdkError' , DerivedClass = SdkError ) { super ( m ) ; Object . setPrototypeOf ( this , DerivedClass . prototype ) ; this . name = name ; } } /**
 * Error thrown by  EThree . register when identity is already registered on Virgil Cloud.
 * To load private key use EThree.restorePrivateKey or EThree.rotatePrivateKey.
  export class IdentityAlreadyExistsError extends SdkError { constructor ( ) { super ( 'This identity is already registered on Virgil Cloud. To load private key use EThree.restorePrivateKey or EThree.rotatePrivateKey' , 'IdentityAlreadyExistsError' , IdentityAlreadyExistsError ) ; } } /**
 * Error thrown by   Ethree . unregister and  EThree . rotatePrivateKey * when current identity of E3kit instance is not registered (i.e. there is
 * no Virgil Card for the current identity in Virgil Cloud).
  export class RegisterRequiredError extends SdkError { constructor ( ) { super ( 'This identity is not registered' , 'RegisterRequiredError' , RegisterRequiredError ) ; } } /**
 * Error thrown by  EThree . backupPrivateKey ,   EThree . changePassword and
 *  EThree . resetPrivateKeyBackup when user enters wrong password.
  export class WrongKeyknoxPasswordError extends SdkError { constructor ( ) { super ( 'Password from remote private key storage is invalid' , 'WrongKeyknoxPasswordError' , WrongKeyknoxPasswordError ) ; } } /**
 * Error thrown by  EThree . rotatePrivateKey and  EThree . restorePrivateKey export class PrivateKeyAlreadyExistsError extends SdkError { constructor ( ) { super ( 'You already have a private key. Use EThree.cleanup() to delete it. If you delete the last copy of the private key, you will not be able to decrypt any information encrypted for this private key' , 'PrivateKeyAlreadyExistsError' , PrivateKeyAlreadyExistsError ) ; } } /**
 * Error thrown by  EThree . resetPrivateKeyBackup when backup copy of private key doesn't exist
  export class PrivateKeyNoBackupError extends SdkError { constructor ( ) { super ( "Backup copy of private key doesn't exist" , 'PrivateKeyNoBackupError' , PrivateKeyNoBackupError ) ; } } /**
 * Error thrown by  EThree . register ,  EThree . rotatePrivateKey and  EThree . lookupPublicKeys * when one user has more then one card.
  export class MultipleCardsError extends SdkError { constructor ( public identity ) { super ( `There are several public keys registered with ${ identity }, which is not supported.` , 'MultipleCardsError' , MultipleCardsError ) ; } } deprecated export type LookupResultWithErrors = { [ identity ] : IPublicKey | Error ; } ; /**
 * Error thrown by  EThree . lookupPublicKeys in case if some identity missing or has multiple cards.
 *
 *  deprecated export class LookupError extends SdkError { /**
     * Key Value object, where key is identity and value is IPublicKey or [[MultipleCardsError]] or [[LookupNotFoundError]]
     */ public lookupResult : LookupResultWithErrors ; constructor ( lookupResult ) { super ( 'Failed some public keys lookups. You can see the results by calling error.lookupResult property of this error instance' , 'LookupError' , LookupError ) ; this . lookupResult = lookupResult ; } } /**
 * Error thrown by  EThree . lookupPublicKeys in case if sought identity is not registered.
 *
 *  deprecated export class LookupNotFoundError extends SdkError { constructor ( public identity ) { super ( `${ identity } not found` , 'LookupNotFoundError' , LookupNotFoundError ) ; } } /**
 * Error thrown by  EThree . decryptFile in case if signature of the file is not valid.
  export class IntegrityCheckFailedError extends SdkError { constructor ( message ) { super ( message , 'IntegrityCheckFailedError' , IntegrityCheckFailedError ) ; } } /**
 * Error thrown by  EThree . decryptFile or  EThree . encryptFile if user aborts an operation.
  export class AbortError extends SdkError { constructor ( ) { super ( 'Operation aborted by user' , 'AbortError' , AbortError ) ; } } /**
 * Error thrown by  EThree . findUsers when some of the users's Virgil Cards weren't found.
  export class UsersNotFoundError extends SdkError { constructor ( public identities ) { super ( "Virgil Cards of some of the users weren't found in Virgil Cloud.\n" + 'Check the "identities" property of this error to see their identites' , 'UsersNotFoundError' , UsersNotFoundError ) ; } } /**
 * Error thrown by  EThree . findUsers when some of the users found have more than one Virgil Card,
 * which is not allowed.
  export class UsersFoundWithMultipleCardsError extends SdkError { constructor ( public identities ) { super ( 'Some of the users have multiple Virgil Cards in Virgil Cloud, which is not allowed.' + 'Check the "identities" property of this error to see their identities' , 'UsersFoundWithMultipleCardsError' , UsersFoundWithMultipleCardsError ) ; } } export enum GroupErrorCode { LocalGroupNotFound = 1 , PermissionDenied = 2 , RemoteGroupNotFound = 3 , InvalidGroup = 4 , InvalidChangeParticipants = 5 , InvalidParticipantsCount = 6 , DataVerificationFailed = 7 , GroupIdTooShort = 8 , MessageNotFromThisGroup = 9 , GroupIsOutdated = 10 , NoAccess = 11 , ParticipantAlreadyAdded = 12 } export class GroupError extends SdkError { constructor ( public errorCode , message ) { super ( message , 'GroupError' , GroupError ) ; } } /**
 * Error thrown when an attempt is made to retrieve the private key from the
 * device's persistent storage, but no private key exists.
 *
 * Thrown by  EThree . encrypt ,  EThree . decrypt ,  EThree . backupPrivateKey ,
 *  EThree . createGroup ,  EThree . loadGroup ,  EThree . getGroup ,
 *  Group . encrypt ,  Group . decrypt ,  Group . update ,  Group . add ,
 *  Group . remove and  Group . reAdd .
  export class MissingPrivateKeyError extends SdkError { constructor ( ) { super ( 'No private key found on the device. You should call "register()" of "restorePrivateKey()"' , 'MissingPrivateKeyError' , MissingPrivateKeyError ) ; } }