This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createCipheriv, createDecipheriv, randomBytes } from "crypto"; | |
| const ENCRYPTION_KEY: string = process.env.ENCRYPTION_KEY || ""; // Must be 256 bits (32 characters) | |
| const IV_LENGTH: number = 16; // For AES, this is always 16 | |
| /** | |
| * Will generate valid encryption keys for use | |
| * Not used in the code below, but generate one and store it in ENV for your own purposes | |
| */ | |
| export function keyGen() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ******************************************* | |
| // LICENSE INFORMATION | |
| // The code, "Detecting Smartphones Using PHP" | |
| // by Anthony Hand, is licensed under a Creative Commons | |
| // Attribution 3.0 United States License. | |
| // | |
| // Updated 01 March 2010 by Bryan J Swift | |
| // - Remove un-needed if statements instead just returning the boolean | |
| // inside the if clause | |
| // |