Skip to content

Commit 14611d8

Browse files
committed
resolved tests
1 parent 1e5247b commit 14611d8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

spec/crypto-v3.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ import {
99
} from './resources/crypto-v3-data-20231207'
1010
import CryptoV3 from '../src/crypto-v3'
1111
import Crypto from '../src/crypto'
12+
import { SIGNING_KEYS } from '../src/resource/signing-keys'
1213

1314
const INTERNAL_TEST_VERSION = 3
1415

1516
const testFileBuffer = new Uint8Array(Buffer.from('./resources/ogp.svg'))
1617

18+
const encryptionPublicKey = SIGNING_KEYS.test.publicKey
19+
const signingSecretKey = SIGNING_KEYS.test.secretKey
20+
1721
jest.mock('axios', () => mockAxios)
1822

1923
describe('CryptoV3', function () {
2024
afterEach(() => mockAxios.reset())
2125

22-
const crypto = new CryptoV3()
23-
const cryptoV1 = new Crypto()
26+
const crypto = new CryptoV3({ signingPublicKey: encryptionPublicKey })
27+
const cryptoV1 = new Crypto({ signingPublicKey: encryptionPublicKey })
2428

2529
it('should generate a keypair', () => {
2630
const keypair = crypto.generate()
@@ -136,7 +140,7 @@ describe('CryptoV3', function () {
136140

137141
// Act
138142
const ciphertext = crypto.encrypt(plaintext, publicKey)
139-
const verifiedText = cryptoV1.encrypt(plainVerifiedText, publicKey)
143+
const verifiedText = cryptoV1.encrypt(plainVerifiedText, ciphertext.submissionPublicKey, signingSecretKey)
140144
const decrypted = crypto.decrypt(secretKey, {
141145
...ciphertext,
142146
verifiedContent: verifiedText,

spec/resources/crypto-v3-data-20231207.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ const ciphertext = {
3939
'ywWDxb29guAgVK4yhLmLK19UKzLrfLAl65JzPDCVNz8=;/Q3WNg7Dk/tWBmpdUcST39zG16/Nyn8V:p1YqpiwEtOssq3yZUhZC1SgIYJcfJDmVFmgNwKf8D+YEqDzLaq5GShR7hTtTixtp',
4040
}
4141

42-
const cipherTextWithVerified = ciphertext && {
43-
verifiedContent: 'Pb3Vsnlq4dxGOd6it4b2b3J2JPM5NDtmmxl3iCpy0Bc=;gURQt+HU9XpeCcS4tzlDjJGAgQOyzOpg:Ip4UavPqxT94DkUbTB6RdbXqZ2JlHQVn+e6SkH5Ec7lcTKAQ8I695F6eG6Zx8GY='
44-
}
45-
4642
const formPublicKey = 'ySgusViv6xdSIXELuGOq2L3Obp8xorT0Qilv+G4nHnM='
4743
const formSecretKey = 'Ngx1Kwpe8JXZUof/DCkkVduVmPSN4paqaKj5971Gq5c='
4844
const submissionPublicKey = '8JCuSlyJZ5N684o9TNdZLijtuORTlD/pbXiFwNf7Fhc='
@@ -52,7 +48,6 @@ export {
5248
plaintext,
5349
plainVerifiedText,
5450
ciphertext,
55-
cipherTextWithVerified,
5651
formPublicKey,
5752
formSecretKey,
5853
submissionPublicKey,

0 commit comments

Comments
 (0)