Skip to content

Commit

Permalink
Merge pull request #296 from xmtp/kele/get-hmac-keys-method
Browse files Browse the repository at this point in the history
feat: get HMAC keys method
  • Loading branch information
alexrisch authored Mar 7, 2024
2 parents c12f56f + e8dc303 commit 8e6a763
Show file tree
Hide file tree
Showing 13 changed files with 2,305 additions and 1,989 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ repositories {
dependencies {
implementation project(':expo-modules-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
implementation "org.xmtp:android:0.7.6"
implementation "org.xmtp:android:0.8.2"
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.facebook.react:react-native:0.71.3'
implementation "com.daveanthonythomas.moshipack:moshipack:1.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,14 @@ class XMTPModule : Module() {
Base64.encodeToString(conversation.toTopicData().toByteArray(), NO_WRAP)
}

AsyncFunction("getHmacKeys") { clientAddress: String ->
logV("getHmacKeys")
val client = clients[clientAddress] ?: throw XMTPException("No client")
val hmacKeys = client.conversations.getHmacKeys()
logV("$hmacKeys")
hmacKeys.toByteArray().map { it.toInt() and 0xFF }
}

// Import a conversation from its serialized topic data.
AsyncFunction("importConversationTopicData") { clientAddress: String, topicData: String ->
logV("importConversationTopicData")
Expand Down
27 changes: 17 additions & 10 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { NavigationContainer } from '@react-navigation/native'
import { Ethereum } from '@thirdweb-dev/chains'
import {
ThirdwebProvider,
metamaskWallet,
rainbowWallet,
} from '@thirdweb-dev/react-native'
import { Button, Platform } from 'react-native'
import Config from 'react-native-config'
// Used to polyfill webCrypto in react-native
import PolyfillCrypto from 'react-native-webview-crypto'
import { QueryClient, QueryClientProvider } from 'react-query'
import { XmtpProvider } from 'xmtp-react-native-sdk'

Expand All @@ -9,9 +18,6 @@ import HomeScreen from './src/HomeScreen'
import LaunchScreen from './src/LaunchScreen'
import { Navigator } from './src/Navigation'
import TestScreen from './src/TestScreen'
import { ThirdwebProvider, metamaskWallet, rainbowWallet } from '@thirdweb-dev/react-native'
import { Ethereum } from '@thirdweb-dev/chains'
import Config from 'react-native-config'

const queryClient = new QueryClient()

Expand All @@ -20,18 +26,19 @@ export default function App() {
// console.log("Thirdweb client id: " + Config.THIRD_WEB_CLIENT_ID)
return (
<ThirdwebProvider
activeChain={ Ethereum }
supportedChains={ [ Ethereum ] }
clientId={ Config.THIRD_WEB_CLIENT_ID }
activeChain={Ethereum}
supportedChains={[Ethereum]}
clientId={Config.THIRD_WEB_CLIENT_ID}
dAppMeta={{
name: 'XMTP Example',
description: 'Example app from xmtp-react-native repo',
logoUrl: 'https://pbs.twimg.com/profile_images/1668323456935510016/2c_Ue8dF_400x400.jpg',
logoUrl:
'https://pbs.twimg.com/profile_images/1668323456935510016/2c_Ue8dF_400x400.jpg',
url: 'https://xmtp.org',
}}
supportedWallets={[
metamaskWallet(), rainbowWallet()
]}>
supportedWallets={[metamaskWallet(), rainbowWallet()]}
>
<PolyfillCrypto />
<QueryClientProvider client={queryClient}>
<XmtpProvider>
<NavigationContainer>
Expand Down
27 changes: 17 additions & 10 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ PODS:
- hermes-engine/Pre-built (= 0.71.14)
- hermes-engine/Pre-built (0.71.14)
- libevent (2.1.12)
- LibXMTP (0.4.1-beta1)
- LibXMTP (0.4.2-beta5)
- Logging (1.0.0)
- MessagePacker (0.4.7)
- MMKV (1.3.3):
Expand Down Expand Up @@ -344,6 +344,9 @@ PODS:
- RCTTypeSafety
- React-Core
- ReactCommon/turbomodule/core
- react-native-webview (13.8.1):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-perflogger (0.71.14)
- React-RCTActionSheet (0.71.14):
- React-Core/RCTActionSheetHeaders (= 0.71.14)
Expand Down Expand Up @@ -442,16 +445,16 @@ PODS:
- GenericJSON (~> 2.0)
- Logging (~> 1.0.0)
- secp256k1.swift (~> 0.1)
- XMTP (0.8.0):
- XMTP (0.8.15):
- Connect-Swift (= 0.3.0)
- GzipSwift
- LibXMTP (= 0.4.1-beta1)
- LibXMTP (= 0.4.2-beta5)
- web3.swift
- XMTPReactNative (0.1.0):
- ExpoModulesCore
- MessagePacker
- secp256k1.swift
- XMTP (= 0.8.0)
- XMTP (= 0.8.15)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -502,6 +505,7 @@ DEPENDENCIES:
- react-native-quick-crypto (from `../node_modules/react-native-quick-crypto`)
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
Expand Down Expand Up @@ -630,6 +634,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-randombytes"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-webview:
:path: "../node_modules/react-native-webview"
React-perflogger:
:path: "../node_modules/react-native/ReactCommon/reactperflogger"
React-RCTActionSheet:
Expand Down Expand Up @@ -673,7 +679,7 @@ SPEC CHECKSUMS:
CoinbaseWalletSDK: ea1f37512bbc69ebe07416e3b29bf840f5cc3152
CoinbaseWalletSDKExpo: c79420eb009f482f768c23b6768fc5b2d7c98777
Connect-Swift: d38eedc1907d440314f8d26d5a038a00cbb0f6f1
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
EXApplication: 2a0d9abd4feace9c6faedfe541c1dec02e3702cd
EXConstants: f348da07e21b23d2b085e270d7b74f282df1a7d9
EXFileSystem: 844e86ca9b5375486ecc4ef06d3838d5597d895d
Expand All @@ -691,11 +697,11 @@ SPEC CHECKSUMS:
FBReactNativeSpec: b6ae48e67aaba46442f84d6f9ba598ccfbe2ee66
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
GenericJSON: 79a840eeb77030962e8cf02a62d36bd413b67626
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
GzipSwift: 893f3e48e597a1a4f62fafcb6514220fcf8287fa
hermes-engine: d7cc127932c89c53374452d6f93473f1970d8e88
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
LibXMTP: 01d1797089db5fe7e0a39c524261f460a0f183c9
LibXMTP: 3cbd1d0dd44ae3648f571a0e81bbe73565759e67
Logging: 9ef4ecb546ad3169398d5a723bc9bea1c46bef26
MessagePacker: ab2fe250e86ea7aedd1a9ee47a37083edd41fd02
MMKV: f902fb6719da13c2ab0965233d8963a59416f911
Expand Down Expand Up @@ -725,6 +731,7 @@ SPEC CHECKSUMS:
react-native-quick-crypto: 455c1b411db006dba1026a30681ececb19180187
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
react-native-webview: bdc091de8cf7f8397653e30182efcd9f772e03b3
React-perflogger: 4987ad83731c23d11813c84263963b0d3028c966
React-RCTActionSheet: 5ad952b2a9740d87a5bd77280c4bc23f6f89ea0c
React-RCTAnimation: d2de22af3f536cc80bb5b3918e1a455114d1b985
Expand All @@ -744,10 +751,10 @@ SPEC CHECKSUMS:
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
SwiftProtobuf: b02b5075dcf60c9f5f403000b3b0c202a11b6ae1
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
XMTP: 9296a8e8dc53a033d5ca38207d5ed05843e657b6
XMTPReactNative: 808e9937e815f506a84ace93af6f84df7e3fb038
XMTP: 00fe090825e6bc5991870c1925befc06b1a30b78
XMTPReactNative: c452a9190442c7cbc0a4c0676cfc598761d463d2
Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9

PODFILE CHECKSUM: 95d6ace79946933ecf80684613842ee553dd76a2

COCOAPODS: 1.14.2
COCOAPODS: 1.14.3
3 changes: 3 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"react-native-screens": "~3.20.0",
"react-native-svg": "^13.9.0",
"react-native-url-polyfill": "^2.0.0",
"react-native-webview": "^13.8.1",
"react-native-webview-crypto": "^0.0.25",
"react-query": "^3.39.3",
"stream-browserify": "^3.0.0",
"text-encoding": "^0.7.0"
Expand All @@ -48,6 +50,7 @@
"@types/node": "^18.16.3",
"@types/react": "18.2.0",
"@types/react-native": "0.71.8",
"@types/text-encoding": "^0.0.39",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"eslint": "^8.54.0",
Expand Down
Loading

0 comments on commit 8e6a763

Please sign in to comment.