internal: incomplete vault systems behind feature flag (#2340)

This commit is contained in:
Mo
2023-06-30 09:01:56 -05:00
committed by GitHub
parent d16e401bb9
commit b032eb9c9b
638 changed files with 20321 additions and 4813 deletions

View File

@@ -259,15 +259,17 @@ describe('crypto operations', async function () {
})
it('pkc crypto_box_easy keypair generation', async function () {
const keypair = await webCrypto.sodiumCryptoBoxGenerateKeypair()
const seed = await webCrypto.generateRandomKey(32)
const keypair = await webCrypto.sodiumCryptoBoxSeedKeypair(seed)
expect(keypair.keyType).to.equal('x25519')
expect(keypair.publicKey.length).to.equal(64)
expect(keypair.privateKey.length).to.equal(64)
})
it('pkc crypto_box_easy encrypt/decrypt', async function () {
const senderKeypair = await webCrypto.sodiumCryptoBoxGenerateKeypair()
const recipientKeypair = await webCrypto.sodiumCryptoBoxGenerateKeypair()
const seed = await webCrypto.generateRandomKey(32)
const senderKeyPair = await webCrypto.sodiumCryptoBoxSeedKeypair(seed)
const recipientKeyPair = await webCrypto.sodiumCryptoBoxSeedKeypair(seed)
const nonce = await webCrypto.generateRandomKey(192)
const plaintext = 'hello world 🌍'
@@ -275,8 +277,8 @@ describe('crypto operations', async function () {
const ciphertext = await webCrypto.sodiumCryptoBoxEasyEncrypt(
plaintext,
nonce,
senderKeypair.privateKey,
recipientKeypair.publicKey,
senderKeyPair.privateKey,
recipientKeyPair.publicKey,
)
expect(ciphertext.length).to.equal(44)
@@ -284,8 +286,8 @@ describe('crypto operations', async function () {
const decrypted = await webCrypto.sodiumCryptoBoxEasyDecrypt(
ciphertext,
nonce,
senderKeypair.publicKey,
recipientKeypair.privateKey,
senderKeyPair.publicKey,
recipientKeyPair.privateKey,
)
expect(decrypted).to.equal(plaintext)