Enigma - @mvdlei/kwy
Explore the utility functions and classes provided by Mvdlei.
Installation
Usage
Enigma
Class
The Enigma
class is used to create an instance of the Enigma cipher, allowing you to encrypt and decrypt messages.
Example
API
Enigma.init(options: EnigmaOptions): Enigma
The init
method is a static method of the Enigma
class used to initialize a new Enigma
instance with the provided options.
EnigmaOptions
type
The EnigmaOptions
type is used to define the options for the Enigma
class.
privateKey
property
The privateKey
property is used to define the private key for the Enigma
instance.
This property is required and must be a string.
This property is kept private and is not exposed in the Enigma
instance.
salt
property
The salt
property is used to define the salt for the Enigma
instance.
This property is required and must be a string.
This property is kept private and is not exposed in the Enigma
instance.
prefix
property
The prefix
property is used to define the prefix for the Enigma
instance.
This property is required with a length of 4 characters, including a trailing underscore. The default value is key_
.
Enigma.encrypt(message: string): string
The encrypt
method is used to encrypt a message.
Enigma.decrypt(message: string): {decrypted: string, fingerprint: string}
The decrypt
method is used to decrypt a message.
Enigma.verify(key: string): boolean
The verify
method is used to verify a key.
Enigma.create(): string
The create
method is used to create a key.
Each key is unique and can be used in your application, for example, as an API key for a user.