Never Pummel Muskoxen

    @worldcerts/wo-encryption
    TypeScript icon, indicating that this package has built-in type declarations

    1.2.0 • Public • Published

    OpenCerts Encryption Library

    This library is used for encrypting OpenCerts files in transit

    API

    Table of Contents

    ENCRYPTION_PARAMETERS

    Default options from responses here https://crypto.stackexchange.com/questions/26783/ciphertext-and-tag-size-and-iv-transmission-with-aes-in-gcm-mode/26787

    algorithm

    keyLength

    ivLength

    tagLength

    version

    generateEncryptionKey

    Generates a random key represented as a hexadecimal string

    Parameters

    • keyLengthInBits number Key length (optional, default ENCRYPTION_PARAMETERS.keyLength)

    encodeDocument

    Parameters

    decodeDocument

    Parameters

    IEncryptionResults

    encryptString

    Encrypts a given string with symmetric AES

    Parameters

    Returns IEncryptionResults cipherText cipher text in base64

    Returns any iv iv in base64

    Returns any tag authenticated encryption tag in base64

    Returns any key encryption key in hexadecimal

    Returns any type The encryption algorithm identifier

    decryptString

    Decrypts a given ciphertext along with its associated variables

    Parameters

    • $0 IEncryptionResults
      • $0.cipherText
      • $0.tag
      • $0.iv
      • $0.key
      • $0.type
    • cipherText string cipher text base64 encoded
    • tag string aes authentication tag base64 encoded
    • iv string iv base64 encoded
    • key string decryption key hexademical encoded
    • type string encryption algorithm identifier

    Returns string

    Install

    npm i @worldcerts/wo-encryption

    DownloadsWeekly Downloads

    2

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    28.1 kB

    Total Files

    13

    Last publish

    Collaborators

    • samarth_30