---
# System prepended metadata

title: XMTP Mobile SDKs

---

# XMTP Mobile SDKs
Living document & meeting notes.

## Overview

### Objectives

1. Unblock native (Android/Kotlin, iOS/Swift) mobile app devs from building with XMTP.

 - Bunches - http://bunches.xyz/
 - Ghost Messenger - https://g.host/
 - Dubdubdub
 - XMTP (1st party)

2. Unblock React Native mobile app devs from building with XMTP.

 - Phaver - https://phaver.com/
 - Showtime - https://www.showtime.xyz/
 - FWB - https://www.fwb.help/

3. Unblock Flutter mobile app devs from building with XMTP.

 - Orb - https://orb.ac/
 - Tribes - https://www.tribes.xyz/

---

## Android / Kotlin
### _NOT STARTED_


### Requirements

Port `xmtp-js` to `xmtp-kotlin` and demonstrate core functionality in a Kotlin sample app.

### Deadline

TBD

### Task overview

TBD

---

## iOS / Swift

### Requirements

Port `xmtp-js` to `xmtp-swift` and demonstrate core functionality in a Swift sample app.

### Deadline

Dec. 13, 2022

### Task overview

- [ ] Create Swift package: `xmtp_proto`
    - [ ] Add a Swift package generator to https://github.com/xmtp/proto   
    - [ ] Publish to Swift Package Manager
- [ ] [**MILESTONE 1**] Create Swift package: `xmtp-swift`
    - [ ] Set up work repo: https://github.com/xmtp/xmtp-Swift
    - [ ] Wrap xmtp in a Swift-conventional `xmtp.Client` (like `xmtp-js`)
    - [ ] Reproduce utility classes/methods
        - [ ] Conversations
        - [ ] Content types
        - [ ] canMessage
        - [ ] ...
    - [ ] Publish to Swift Package Manager
- [ ] [**MILESTONE 2**] Create sample app: xmtp/example-chat-swift
    - [ ] Set up work repo: https://github.com/xmtp/example-chat-swift
    - [ ] Use xmtp-swift to demonstrate SDK (like `example-chat-react`)
        - [ ] Initialize client
        - [ ] List messages
        - [ ] Send messages
        - [ ] Stream messages

---

## Flutter

### Requirements

Port `xmtp-js` to `xmtp-flutter` and demonstrate core functionality in a Flutter sample app.

### Deadline

Dec. 13, 2022

### Task overview

- [ ] Setup XMTP as a [verified publisher](https://dart.dev/tools/pub/publishing#verified-publisher)
- [ ] Create dart package: `xmtp_proto`
    - [ ] Add a dart-package generator to https://github.com/xmtp/proto   
    - [ ] Publish to https://pub.dev/packages/xmtp_proto
- [ ] [**MILESTONE 1**] Create dart package: `xmtp-flutter`
    - [ ] Set up work repo: https://github.com/xmtp/xmtp-flutter
    - [ ] Wrap xmtp in a dart-conventional `xmtp.Client` (like `xmtp-js`)
    - [ ] Reproduce utility classes/methods
        - [ ] Conversations
        - [ ] Content types
        - [ ] canMessage
        - [ ] ...
    - [ ] Publish to https://pub.dev/packages/xmtp
- [ ] [**MILESTONE 2**] Create sample app: xmtp/example-chat-flutter
    - [ ] Set up work repo: https://github.com/xmtp/example-chat-flutter
    - [ ] Use xmtp-flutter to demonstrate SDK (like `example-chat-react`)
        - [ ] Initialize client
        - [ ] List messages
        - [ ] Send messages
        - [ ] Stream messages

---

## React Native

### Requirements

Make it so that devs can simply use the xmtp-js SDK in React Native without experimental polyfills.

Support the following React Native JS environments:
- Hermes v0.70 for both iOS and Android
- JavaScriptCore for iOS starting with iOS 14
- V8 for Android

_Devs can hack in React Native now by using the experimental [webcrypto](https://github.com/PeculiarVentures/webcrypto) polyfill per our [React Native example app](https://github.com/xmtp/example-chat-react-native)._

### Deadline

Dec. 13, 2022


### Task overview

- [ ] Remove the `SubtleCrypto` dependency from `xmtp-js` _OR_ add a Node crypto workaround as proposed in [#157](https://github.com/xmtp/xmtp-js/pull/157)
- [ ] Extend the example app to authenticate an account and send a message from that account


### Resources

- [XMTP protocol spec](https://github.com/xmtp/proto/pull/14/files)
- [JS client interface](https://xmtp.org/docs/client-sdk/javascript/reference/classes/Client)

---

## Open questions

### Authentication and key-management
- How are we initializing a client with keys?
    - Can Orb tell us more about their situation to help answer this?
- How would using the secure enclave change the client.create flow?
- Do we tell the dev to reach into the enclave or do we do it for them?
    - If you want to store your own keys, here's the hook
    - If you want us to do it for you, here's the solution
- Do we need to rethink where we keep the keys when we're working with them?
    - Check with Jazz and Signal approach
    - Conversation-specific keys and push notifications: how do you go and efficiently find the key to decrypt the push notification message? Need some persistent state so that devs don't have to query hundreds of keys.

### Crypto
- Should we use dart's [AES-GCM implementation](https://pub.dev/documentation/cryptography/latest/cryptography/AesGcm-class.html) or something else?
    - Is it good enough? Is it audited?
        - Good enough to start.
- What will we use for secp256k1 in dart?

### GRPC
- Should we use grpc directly instead of going through grpc-gateway like `xmtp-js`?
    - Yes, but we need to expose the grpc ports in the network.
    - Need to support native metadata on key authorization.

---

## Meeting notes
Add new meeting notes by copying and pasting [this template](#DATE-Meeting-Notes).

---
### 11/28/22 Meeting Notes
#### Attendees:
- Pat, Nick, Darick, Anoop, Dan, Elise
#### Notes:
- Dart update:
  - PR up for adding contact bundles
  - In progress: Got end-to-end fetching, decrypting & reading for v1 messages.
  - Structure is cominng in place as we go
- Swift update:
  - PR up for fetching and adding contact bundles
  - Adding Client now
  - Close to first end-to-end message & working thru last encryption pieces
- React Native update:
  - We upgraded the example repo to use xmtp-js v7.0 and fully removed our localstorage dependency which unblocks WalletConnect
  - Showtime also ran into the same localStorage issue & one other crypto library issue. My highest priority is unblocking them
  - Still have to investigate streaming bug report
- Push server update:
  - SO CLOSE to first working push off of RN!
  - Sending a "You have mail"  push is one bug away
  - Next up is decrypting keys and showing real messages
#### Agenda:
- Subscribing & Streaming
  - Context: https://github.com/xmtp/proto/pull/30
  - TL;DR: streamAllMessages is a useful API in web. TBD in mobile, but we should check out the convo in Martin's PR.
#### Action items:
- Align on expected expectations around streaming by reading thru [Martin's PR](https://github.com/xmtp/proto/pull/30).
- Look into [publisher verification](https://dart.dev/tools/pub/publishing#verified-publisher) for XMTP (@elise)
### 11/14/22 Meeting Notes
#### Attendees:
- Pat, Dan, Elise, Nick, Anoop, Darick, J-Ha, Saul
#### Agenda:
- React Native auth
- Dart update
- Swift update
- Typedocs
#### Notes:
- React Native auth
    - Assuming that wagmi works with WalletConnect and Coinbase Wallet in React Native. Elise to validate this week.
- Dart update
    - Unlisted xmtp_proto package is ready to go. Someone needs to set up XMTP as a publisher. Will need to verify ownership of domain, then we can transfer ownership of the package.
    - Starting from the opposite end - assume you have a private key.
    - Auth metadata is required in prod and dev
- Swift update
    - Swift proto package is up and working. Anyone can point at the URL to get access to those types.
    - Working to get basic hello world with a user contact running by pulling stuff over from JS SDK into an iOS app
    - Wallet connection flow is working
    - Do we want Swift stuff on the proto precommit hook?
        - Dan closed the PR to remove the precommit hook.
        - We should add Swift stuff at the very least.
        - Need to figure out a bigger plan for how we version these SDKs at the same time.
        - Should consolidate into a single Docker image.
- Typedocs
    - Look into Swift DocC - generate docs off of comments
    - Probably something similar for Dart but need to confirm
- Yash starting as DX PM on 12/5

#### Action items:
- [ ] Look into [publisher verification](https://dart.dev/tools/pub/publishing#verified-publisher) for XMTP (@elise)

---

### 11/9/22 Meeting Notes
#### Attendees:
- Dan, Elise, Nick, Anoop, Darick, Saul
#### Agenda:
- Intro
- Project scope
- Open questions 
#### Notes:
- AES-256-GCM: Using the built-in dart implenmentation is a good place to start
- Also need secp256k1 curve implementation
- How do we want to implement key management in a less ephemeral context than the browser?
- Philosophy: 
    - give them the right primitives to come to good solutions
    - keep the structure similar to xmtp-js (Conversations, etc)
    - Modifying client for key management: should do this the same for RN, etc
    - Treat the app as a spec for devs
- Build SDK then app or build app then SDK - no preference
- Visuals
    - First milestone: no visuals, just minimal viable to exercise SDK - similar to quickstart-react
    - Stretch milestone: resemble example-chat-react
- Workflow
    - Tag xmtp-mobile team for reviews, tag martin for cryptography-related stuff
- Questions for Orb
    - What wallets do you want to support?
    - What library are you already using to sign in the Flutter world?
        - They're definitely already doing this because Lens requires SIWE
    - What methods would you use to integrate/interact with those wallets?
        - get address
        - sign
    - Could make sense to go to them with a candidate interface
- API headers - can use the auth section of xmtp-js to rebuild this
- Need to support both v1 and v2 style messages
- Conventionally we'd call this xmtp-flutter if it depends on flutter (which we might need to for secure enclave stuff)

    
#### Action items:
- [x] Reach out to Orb on expectations around authentication (@saulmc)
- [ ] Consult with Jazz on working key management after something to react to (tbd)
- [ ] Expose grpc ports in the network (@nick)
- [ ] Support native metadata on key authorization (@nick)
- [x] Create GitHub team for review tagging (@elise)
- [x] Create private repo for the xmtp-flutter SDK and give Dan access (@elise)

---

### DATE Meeting Notes
#### Attendees:
- ...
#### Agenda:
- ...
#### Notes:
- ...
#### Action items:
- [ ]