-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
blockchain_integration/pi_network/PiShield/tests/quantum-resistance.test.js
This file contains 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
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); | ||
}); | ||
}); |