Skip to content

Commit

Permalink
Create quantum-resistance.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 8, 2024
1 parent f1b8c4d commit e05b007
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// tests/quantum-resistance.test.js

const { QuantumResistance } = require('../quantum-resistance');
const { expect } = require('chai');

describe('Quantum Resistance', () => {
let quantumResistance;

beforeEach(() => {
quantumResistance = new QuantumResistance();
});

it('should generate a quantum-resistant key pair', async () => {
const keyPair = await quantumResistance.generateKeyPair();
expect(keyPair).to.have.property('publicKey');
expect(keyPair).to.have.property('privateKey');
});

it('should encrypt and decrypt data using quantum-resistant cryptography', async () => {
const plaintext = 'Hello, World!';
const keyPair = await quantumResistance.generateKeyPair();
const ciphertext = await quantumResistance.encrypt(plaintext, keyPair.publicKey);
const decryptedText = await quantumResistance.decrypt(ciphertext, keyPair.privateKey);
expect(decryptedText).to.equal(plaintext);
});
});

0 comments on commit e05b007

Please sign in to comment.