Passed
Pull Request — master (#89)
by Mathieu
01:31
created

FileEncryptionAdapter.descrypt   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
1
import * as crypto from 'crypto';
2
import {IFileEncryption} from 'src/Application/IFileEncryption';
3
4
export class FileEncryptionAdapter implements IFileEncryption {
5
  public encrypt(buffer: Buffer, password: string): Buffer {
6
    const cipher = crypto.createCipher('aes-256-cbc', password);
7
8
    return Buffer.concat([cipher.update(buffer), cipher.final()]);
9
  }
10
11
  public descrypt(filePath: string, password: string) {}
12
}
13