Asper Header  1.0.14
The header injector extension
Loading...
Searching...
No Matches
base64.ts
Go to the documentation of this file.
1
12import { BaseCipher } from "../base/baseCipher";
13
21export class Base64Cipher extends BaseCipher {
25 readonly CipherName = "Base64";
26
33 super();
34 }
35
43 encode(plainText: string = ""): string {
44 const buffer = Buffer.from(plainText);
45 const encoded = buffer.toString("base64");
46 return encoded;
47 }
48
57 decode(cipherText: string = ""): string {
58 const buffer = Buffer.from(cipherText, "base64");
59 const decoded = buffer.toString();
60 return decoded;
61 }
62}
Implementation of Base64 encoding and decoding.
Definition base64.ts:21
readonly CipherName
Identifier name for this encoding scheme.
Definition base64.ts:25
constructor()
Constructor for Base64 encoder/decoder.
Definition base64.ts:32
Abstract base class providing common functionality for cipher implementations.
Definition baseCipher.ts:18
export const Record< string,(...args:any[])=> string