Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PPPP encryption #497

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
},
"dependencies": {
"@noble/secp256k1": "^1.5.2",
"@xmtp/ecies-bindings-wasm": "^0.1.7",
"@xmtp/proto": "^3.34.0",
"@xmtp/user-preferences-bindings-wasm": "^0.2.1",
"async-mutex": "^0.4.0",
"elliptic": "^6.5.4",
"ethers": "^5.5.3",
Expand Down
32 changes: 0 additions & 32 deletions src/crypto/SelfEncryption.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/keystore/InMemoryKeystore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { bytesToHex } from '../crypto/utils'
import Long from 'long'
import { selfDecrypt, selfEncrypt } from '../keystore/encryption'
// eslint-disable-next-line camelcase
import { generate_private_preferences_topic } from '@xmtp/ecies-bindings-wasm'
import { generate_private_preferences_topic } from '@xmtp/user-preferences-bindings-wasm'

const { ErrorCode } = keystore

Expand Down
10 changes: 5 additions & 5 deletions src/keystore/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {
import { ciphertext } from '@xmtp/proto'
import {
// eslint-disable-next-line camelcase
ecies_decrypt_k256_sha3_256,
user_preferences_decrypt,
// eslint-disable-next-line camelcase
ecies_encrypt_k256_sha3_256,
} from '@xmtp/ecies-bindings-wasm'
user_preferences_encrypt,
} from '@xmtp/user-preferences-bindings-wasm'

export const decryptV1 = async (
myKeys: PrivateKeyBundleV1,
Expand Down Expand Up @@ -62,7 +62,7 @@ export async function selfEncrypt(
) {
const publicKey = identityKey.publicKey.secp256k1Uncompressed.bytes
const privateKey = identityKey.secp256k1.bytes
return ecies_encrypt_k256_sha3_256(publicKey, privateKey, payload)
return user_preferences_encrypt(publicKey, privateKey, payload)
}

export async function selfDecrypt(
Expand All @@ -71,5 +71,5 @@ export async function selfDecrypt(
) {
const publicKey = identityKey.publicKey.secp256k1Uncompressed.bytes
const privateKey = identityKey.secp256k1.bytes
return ecies_decrypt_k256_sha3_256(publicKey, privateKey, payload)
return user_preferences_decrypt(publicKey, privateKey, payload)
}
36 changes: 0 additions & 36 deletions test/crypto/P4Encryption.test.ts

This file was deleted.

Loading