Skip to content

Commit

Permalink
Merge pull request #497 from xmtp/rygine/update-pppp
Browse files Browse the repository at this point in the history
Update PPPP encryption
  • Loading branch information
rygine authored Dec 5, 2023
2 parents bd3b725 + d8b343d commit fc36363
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 81 deletions.
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.

0 comments on commit fc36363

Please sign in to comment.