Skip to content

Commit

Permalink
Merge branch 'develop' into 2625-port-chainmanager-from-poc
Browse files Browse the repository at this point in the history
  • Loading branch information
adrastaea authored Nov 25, 2024
2 parents 1e7aa6e + 7110cb5 commit 2ba65b0
Show file tree
Hide file tree
Showing 68 changed files with 1,030 additions and 709 deletions.
Binary file modified .github/secrets/Certificates.p12.gpg
Binary file not shown.
3 changes: 1 addition & 2 deletions .github/secrets/decrypt_secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ gpg --quiet --batch --yes --decrypt --passphrase="$IOS_CERTIFICATE_KEY" --output

mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles

cp ./.github/secrets/match_AppStore_comquietmobile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/718ac015-309f-49b6-9653-f6cf84a6377c.mobileprovision

cp ./.github/secrets/match_AppStore_comquietmobile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/762df280-302c-4336-a56d-c74914169337.mobileprovision

security create-keychain -p "" build.keychain
security import ./.github/secrets/Certificates.p12 -t agg -k ~/Library/Keychains/build.keychain -P "$IOS_CERTIFICATE_KEY" -A
Expand Down
Binary file modified .github/secrets/match_AppStore_comquietmobile.mobileprovision.gpg
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
os: [ubuntu-20.04, macos-13, windows-2019]

steps:
- uses: dorny/paths-filter@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/desktop-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:

build-macos:
# needs: run-e2e-tests-mac
runs-on: macos-12
runs-on: macos-13
if: |
startsWith(github.ref, 'refs/tags/@quiet/desktop')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/desktop-rtl-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04, macos-12]
os: [ubuntu-20.04, macos-13]

steps:
- uses: dorny/paths-filter@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/desktop-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04, macos-12]
os: [ubuntu-20.04, macos-13]

steps:
- uses: dorny/paths-filter@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: workflow_dispatch
jobs:
detox-ios:
timeout-minutes: 25
runs-on: [macos-latest-xlarge]
runs-on: [macos-13-xlarge]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: E2E Mac
on: [workflow_call]
jobs:
mac:
runs-on: macos-12
runs-on: macos-13
timeout-minutes: 180
env:
TEST_MODE: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/identity-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
os: [ubuntu-20.04, macos-13, windows-2019]

steps:
- uses: dorny/paths-filter@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04] #, macos-latest, windows-2019]
os: [ubuntu-20.04] #, macos-13, windows-2019]

steps:
- name: 'Print OS'
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/mobile-deploy-ios-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test IOS build

on:
pull_request:

jobs:
test-build-ios:
# needs: detox-ios
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-13]

steps:
- name: "Print OS"
run: echo ${{ matrix.os }}

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'recursive'
lfs: true

- name: Install gpg
run: brew install gnupg

- name: Setup XCode
uses: maxim-lobanov/setup-xcode@9a697e2b393340c3cacd97468baa318e4c883d98 # v1.5.1
with:
xcode-version: '15.2'

- name: Setup environment
uses: ./.github/actions/setup-env
with:
cachePrefix: "deploy-ios"
bootstrap-packages: "@quiet/eslint-config,@quiet/logger,@quiet/common,@quiet/types,@quiet/state-manager,@quiet/backend,@quiet/identity,@quiet/mobile,backend-bundle"

- name: Install pod dependencies
run: |
cd ./packages/mobile/ios
pod install
shell: bash

- name: Setup provisioning profile
run: ./.github/secrets/decrypt_secrets.sh
env:
IOS_PROFILE_KEY: ${{ secrets.IOS_PROFILE_KEY }}
IOS_CERTIFICATE_KEY: ${{ secrets.IOS_CERTIFICATE_KEY }}

- name: Build
run: |
cd ./packages/mobile/ios
xcodebuild archive \
-workspace Quiet.xcworkspace \
-scheme Quiet \
-configuration Release \
-archivePath build/Quiet.xcarchive \
PROVISIONING_PROFILE="762df280-302c-4336-a56d-c74914169337" \
CODE_SIGN_IDENTITY="Apple Distribution: A Quiet LLC (CTYKSWN9T4)"
- name: Export .ipa
run: |
cd ./packages/mobile/ios
xcodebuild \
-exportArchive \
-archivePath build/Quiet.xcarchive \
-exportOptionsPlist ci.plist \
-exportPath build/
- name: Cleanup environment
if: always()
run: security delete-keychain build.keychain && rm -f ~/Library/MobileDevice/Provisioning\ Profiles/*.mobileprovision
6 changes: 3 additions & 3 deletions .github/workflows/mobile-deploy-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [macos-latest]
os: [macos-13]

steps:
- name: "Print OS"
Expand Down Expand Up @@ -59,8 +59,8 @@ jobs:
-scheme Quiet \
-configuration Release \
-archivePath build/Quiet.xcarchive \
PROVISIONING_PROFILE="718ac015-309f-49b6-9653-f6cf84a6377c" \
CODE_SIGN_IDENTITY="Apple Distribution: Zbay LLC (CTYKSWN9T4)"
PROVISIONING_PROFILE="762df280-302c-4336-a56d-c74914169337" \
CODE_SIGN_IDENTITY="Apple Distribution: A Quiet LLC (CTYKSWN9T4)"
- name: Export .ipa
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/state-manager-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04, macos-12]
os: [ubuntu-20.04, macos-13]

steps:
- uses: dorny/paths-filter@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/utils-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
os: [ubuntu-20.04, macos-13, windows-2019]

steps:
- name: "Print OS"
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog

## [unreleased]
## [2.3.2]

### Chores

* Moved some responsibilities of identity management to the backend ([#2602](https://github.com/TryQuiet/quiet/issues/2602))
* Added auth submodule in preparation for future encyrption work ([#2623](https://github.com/TryQuiet/quiet/issues/2623))

### New features

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"prepare": "husky",
"lint-staged": "lerna run lint-staged",
"build:auth": "cd ./3rd-party/auth && pnpm install && pnpm build",
"bootstrap": "npm run build:auth && lerna bootstrap"
"bootstrap": "npm run build:auth && lerna bootstrap",
"watch": "lerna watch -- lerna run build --since"
},
"engines": {
"node": "18.12.1",
Expand Down
22 changes: 21 additions & 1 deletion packages/backend/src/nest/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,26 @@ export const getPorts = async (): Promise<Ports> => {
}
}

/**
* Generate a random onion address
* @param length Length of the onion address, provided for testing invalid lengths (default: 56)
* @returns Random onion address
**/
export function generateRandomOnionAddress(length: number = 56): string {
const charset = 'abcdefghijklmnopqrstuvwxyz' // Lowercase letters only
const charsetLength = charset.length
let randomString = ''

const randomValues = new Uint32Array(length)
crypto.webcrypto.getRandomValues(randomValues)

for (let i = 0; i < length; i++) {
randomString += charset[randomValues[i] % charsetLength]
}

return randomString + '.onion'
}

export class DummyIOServer extends Server {
emit(event: string, ...args: any[]): boolean {
logger.info(`Emitting ${event} with args:`, args)
Expand Down Expand Up @@ -203,7 +223,7 @@ export const rootPermsData: PermsData = {
tmp.setGracefulCleanup()

export const testBootstrapMultiaddrs = [
createLibp2pAddress('abcd.onion', 'QmfLUJcDSLVYnNqSPSRK4mKG8MGw51m9K2v59k3yq1C8s4'),
createLibp2pAddress(generateRandomOnionAddress(56), 'QmfLUJcDSLVYnNqSPSRK4mKG8MGw51m9K2v59k3yq1C8s4'),
]

export const libp2pInstanceParams = async (): Promise<Libp2pNodeParams> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,8 @@ describe('ConnectionsManagerService', () => {
}
await localDbService.setCommunity(actualCommunity)
await localDbService.setCurrentCommunityId(community.id)
// TODO: Revisit this when we move the Identity model to the backend, since
// this network data lives in that model.
const network = {
peerId: userIdentity.peerId,
hiddenService: userIdentity.hiddenService,
}
await localDbService.setNetworkInfo(network)

await localDbService.setIdentity(userIdentity)

await connectionsManagerService.closeAllServices()

Expand All @@ -119,10 +114,7 @@ describe('ConnectionsManagerService', () => {
await connectionsManagerService.init()

const localPeerAddress = createLibp2pAddress(userIdentity.hiddenService.onionAddress, userIdentity.peerId.id)
const updatedLaunchCommunityPayload = {
community: { ...actualCommunity, peerList: [localPeerAddress, remotePeer] },
network,
}
const updatedLaunchCommunityPayload = { ...actualCommunity, peerList: [localPeerAddress, remotePeer] }

expect(launchCommunitySpy).toHaveBeenCalledWith(updatedLaunchCommunityPayload)
})
Expand All @@ -137,20 +129,13 @@ describe('ConnectionsManagerService', () => {
it('community is only launched once', async () => {
await localDbService.setCommunity(community)
await localDbService.setCurrentCommunityId(community.id)
const launchCommunityPayload = {
community: community,
network: {
peerId: userIdentity.peerId,
hiddenService: userIdentity.hiddenService,
},
}

//@ts-ignore
const launchSpy = jest.spyOn(connectionsManagerService, 'launch').mockResolvedValue('address')

await Promise.all([
connectionsManagerService.launchCommunity(launchCommunityPayload),
connectionsManagerService.launchCommunity(launchCommunityPayload),
connectionsManagerService.launchCommunity(community),
connectionsManagerService.launchCommunity(community),
])

expect(launchSpy).toBeCalledTimes(1)
Expand All @@ -159,13 +144,8 @@ describe('ConnectionsManagerService', () => {
it('Bug reproduction - Error on startup - Error: TOR: Connection already established - Trigger launchCommunity from backend and state manager', async () => {
await localDbService.setCommunity(community)
await localDbService.setCurrentCommunityId(community.id)
// TODO: Revisit this when we move the Identity model to the backend, since
// this network data lives in that model.
const network = {
peerId: userIdentity.peerId,
hiddenService: userIdentity.hiddenService,
}
await localDbService.setNetworkInfo(network)

await localDbService.setIdentity(userIdentity)

const peerid = 'QmaEvCkpUG7GxhgvMkk8wxurfi1ehjHhSUNRksWTmXN2ix'
await localDbService.put(LocalDBKeys.PEERS, {
Expand Down
Loading

0 comments on commit 2ba65b0

Please sign in to comment.