forked from javascript-obfuscator/javascript-obfuscator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCryptUtilsStringArray.ts
More file actions
38 lines (31 loc) · 1.13 KB
/
CryptUtilsStringArray.ts
File metadata and controls
38 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { inject, injectable } from 'inversify';
import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
import { ICryptUtilsStringArray } from '../interfaces/utils/ICryptUtilsStringArray';
import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
import { base64alphabetSwapped } from '../constants/Base64AlphabetSwapped';
import { CryptUtils } from './CryptUtils';
@injectable()
export class CryptUtilsStringArray extends CryptUtils implements ICryptUtilsStringArray {
/**
* @type {string}
*/
protected override readonly base64Alphabet: string = base64alphabetSwapped;
/**
* @param {IRandomGenerator} randomGenerator
*/
public constructor (
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator
) {
super(randomGenerator);
}
/**
* Removes base64 encoded string without padding characters and with swapped alphabet
*
* @param {string} string
* @returns {string}
*/
public override btoa (string: string): string {
const output = super.btoa(string);
return output.replace(/=+$/, '');
}
}