Last updated
Last updated
• Docs
/ / EncryptionUtils
Utility class for encryption-related operations.
Returns
static
encrypt(message
,publicKeys
):Promise
<string
>
This function encrypts a message using the specified public keys.
Parameters
• message: string
Message to encrypt.
• publicKeys: string
[]
Returns
Promise
<string
>
Message encrypted.
Code example
Source
static
generateKeyPair(name
,passphrase
):Promise
<IKeyPair
>
This function generates a key pair for encryption and decryption.
Parameters
• name: string
Name for the key pair.
• email: string
Email for the key pair.
• passphrase: string
= ''
Passphrase to encrypt the private key. Optional.
Returns
Promise
<IKeyPair
>
Key pair generated.
Code example
Source
static
getSignedData(message
):Promise
<string
>
This function gets signed data from a signed message.
Parameters
• message: string
Message.
Returns
Promise
<string
>
Signed data.
Code example
Source
static
isEncrypted(message
):boolean
Verifies if a message appears to be encrypted with OpenPGP.
Parameters
• message: string
Message to verify.
Returns
boolean
true
if the message appears to be encrypted, false
if not.
Code example:
Source
static
verify(message
,publicKey
):Promise
<boolean
>
This function verifies the signature of a signed message using the public key.
Parameters
• message: string
Message to verify.
• publicKey: string
Public key to verify that the message was sign by a specific source.
Returns
Promise
<boolean
>
True if verified. False if not verified.
Code example
Source
new EncryptionUtils():