Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
37412b8
init the authenticator app code base
DilshanSenarath Sep 10, 2025
91b257b
add theme provider
DilshanSenarath Sep 11, 2025
f1f8b68
add support to scan qr codes
DilshanSenarath Sep 12, 2025
f6ed065
add qr code scanning functionality
DilshanSenarath Sep 14, 2025
29dc8db
add basic push registration implementation
DilshanSenarath Sep 14, 2025
53ac840
add the initial implementation for device regsitration
DilshanSenarath Sep 15, 2025
5d7cc01
implement the crypto service
DilshanSenarath Sep 16, 2025
f3eabe0
implement secure storage service
DilshanSenarath Sep 16, 2025
42c2d15
implement async storage
DilshanSenarath Sep 16, 2025
e0ba121
implement the firebase messaging core
DilshanSenarath Sep 17, 2025
7afde43
refactor the push device registration logic
DilshanSenarath Sep 17, 2025
f94486d
handle error scenarios of push device registration
DilshanSenarath Sep 17, 2025
955fccf
implemenet push authentication implementation
DilshanSenarath Sep 18, 2025
17fbc27
add the logic to display accounts
DilshanSenarath Sep 18, 2025
0770ef9
add totp base implementation
DilshanSenarath Sep 18, 2025
fcf4507
add totp generation support for crypto service
DilshanSenarath Sep 18, 2025
cfb73f0
add the basic totp implementation
DilshanSenarath Sep 18, 2025
1f4b72f
add push shared account support
DilshanSenarath Sep 19, 2025
86faa01
add support to remove accounts
DilshanSenarath Sep 19, 2025
aa9e532
implement totp view
DilshanSenarath Sep 25, 2025
dc11749
improve totp view UI
DilshanSenarath Sep 26, 2025
33a7cca
implement push login history page
DilshanSenarath Sep 29, 2025
53247c5
improve app notification view
DilshanSenarath Sep 30, 2025
ba93522
add logos and support for totp algorithm and digits
DilshanSenarath Sep 30, 2025
ad6db0a
fix the issues in push and totp regsitration flows
DilshanSenarath Oct 2, 2025
a003283
fix the background notification issue
DilshanSenarath Oct 2, 2025
c5d3fc4
add local authentication for the app
DilshanSenarath Oct 2, 2025
e4fcdc4
fix the UI issues
DilshanSenarath Oct 2, 2025
000b5e2
fix styling issues
DilshanSenarath Oct 2, 2025
b4c7a5b
init the config and docs
DilshanSenarath Oct 3, 2025
9011479
fix the styling issue
DilshanSenarath Oct 3, 2025
ed23df5
update logic extract the host name
DilshanSenarath Oct 3, 2025
bb17c33
add domain excluded username
DilshanSenarath Oct 3, 2025
8c5d38b
handle undefined username
DilshanSenarath Oct 3, 2025
3d6830d
handle user store domain
DilshanSenarath Oct 3, 2025
21dd5ce
add deployment configurations
DilshanSenarath Oct 3, 2025
ab382ee
add asgardeo root context
DilshanSenarath Oct 6, 2025
2545cf2
refactor the app screens
DilshanSenarath Oct 6, 2025
2093bbb
refactor the home and common components
DilshanSenarath Oct 6, 2025
2ddcb13
honer the stored preference when resolving the theme
DilshanSenarath Oct 7, 2025
14f2ea3
refactor the qr screen code
DilshanSenarath Oct 7, 2025
5be4056
refactor the account deletion logic
DilshanSenarath Oct 7, 2025
30079dc
refactor the push screens
DilshanSenarath Oct 8, 2025
6b0bd14
remove ai instruction file
DilshanSenarath Oct 8, 2025
8a511f1
add instruction file
DilshanSenarath Oct 8, 2025
fc5d3f5
add authentication for app opening
DilshanSenarath Oct 8, 2025
67fb2dc
add camera icon support for alert
DilshanSenarath Oct 8, 2025
0f4d237
rename files
DilshanSenarath Oct 8, 2025
058e23c
refactor the code base to have default import
DilshanSenarath Oct 8, 2025
5ea13db
add ending colons
DilshanSenarath Oct 8, 2025
dc30069
add full logo for the app header
DilshanSenarath Oct 8, 2025
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
56 changes: 56 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copilot Instructions: React Native Sample App Code Review

## 🎯 Purpose
You are reviewing a **React Native sample mobile application** intended to serve as a **reference implementation** for other developers.
Your goal is to ensure that the codebase is **clean, maintainable, secure, and follows React Native best practices**.

---

## 🔍 Review Objectives

### 1. Code Quality & Structure
- Ensure the code follows modern **React Native and React** best practices:
- Prefer **functional components** and **React Hooks**.
- Use clear and descriptive **naming conventions**.
- Maintain a **modular structure** with reusable components.
- Verify that files are logically organized (e.g., `screens/`, `components/`, `hooks/`, `services/`, `assets/`).
- Identify and highlight **unused code**, constants, or imports.
- Suggest improvements to **readability** and **maintainability**.

### 2. Performance & Optimization
- Detect potential performance bottlenecks:
- Unnecessary re-renders.
- Heavy computations inside render functions.
- Missing cleanup functions in `useEffect`.
- Suggest using **`useMemo`**, **`useCallback`**, or **FlatList optimizations** where appropriate.
- Ensure proper and efficient **image handling**.

### 3. Best Practices
- Ensure **TypeScript** or **PropTypes** are used for type safety.
- Check for consistent **error handling** and **async flow management**.
- Confirm configuration values are **not hardcoded** — use environment variables or config files.
- Verify clean and consistent **navigation setup** (e.g., React Navigation).
- Review **styling** consistency — recommend StyleSheet, Tailwind, or styled-components, avoiding inline duplication.

### 4. Security & Data Handling
- Ensure no sensitive information (API keys, tokens, credentials) is committed.
- Suggest secure methods for environment variable management.
- Validate that local storage (AsyncStorage, MMKV, etc.) safely handles user data.

### 5. Documentation & Comments
- Check if major modules, hooks, or components have brief, meaningful comments.
- Recommend improvements to the **README** for developer onboarding.
- Suggest adding usage examples or developer notes for clarity.

### 6. Code-Level Issues
- Identify **linting**, **formatting**, or **naming inconsistencies**.
- Point out **deprecated APIs** or outdated React Native patterns.
- Detect **potential bugs**, logical flaws, or anti-patterns.
- Recommend adding or improving **unit tests** if missing.

---

## ✅ Expected Output Format

Copilot should provide structured feedback like this:

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ packages:
- 'samples/*'
- '!samples/__legacy__/*'
- '!samples/teamspace-nextjs'
- '!samples/authenticator-app'

catalog:
'@wso2/eslint-plugin': 'https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?a1fc6eb570653c999828aea9f5027cba06af4391'
Expand Down
42 changes: 42 additions & 0 deletions samples/authenticator-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/
expo-env.d.ts

# Native
.kotlin/
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo

app-example

android
ios
7 changes: 7 additions & 0 deletions samples/authenticator-app/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit",
"source.sortMembers": "explicit"
}
}
50 changes: 50 additions & 0 deletions samples/authenticator-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Welcome to your Expo app 👋

This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).

## Get started

1. Install dependencies

```bash
npm install
```

2. Start the app

```bash
npx expo start
```

In the output, you'll find options to open the app in a

- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo

You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).

## Get a fresh project

When you're ready, run:

```bash
npm run reset-project
```

This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.

## Learn more

To learn more about developing your project with Expo, look at the following resources:

- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.

## Join the community

Join our community of developers creating universal apps.

- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
91 changes: 91 additions & 0 deletions samples/authenticator-app/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"expo": {
"name": "Asgardeo",
"slug": "Asgardeo",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/logo-icon.png",
"scheme": "authenticatorapp",
"userInterfaceStyle": "automatic",
"newArchEnabled": true,
"ios": {
"config": {
"usesNonExemptEncryption": false
},
"supportsTablet": true,
"infoPlist": {
"NSCameraUsageDescription": "This app needs access to the camera to scan QR codes.",
"UIBackgroundModes": [
"remote-notification"
]
},
"bundleIdentifier": "io.asgardeo.dev.push.totp.authenticator",
"googleServicesFile": "./config/GoogleService-Info.plist",
"entitlements": {
"aps-environment": "production"
}
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/logo-icon.png",
"backgroundColor": "#ffffff"
},
"edgeToEdgeEnabled": true,
"package": "io.asgardeo.dev.push.totp.authenticator",
"permissions": [
"CAMERA",
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO"
],
"googleServicesFile": "./config/google-services.json"
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/logo-icon.png"
},
"plugins": [
"expo-router",
"@react-native-firebase/app",
"@react-native-firebase/messaging",
[
"expo-camera",
{
"cameraPermission": "Allow this app to access your camera to scan QR codes."
}
],
[
"expo-splash-screen",
{
"image": "./assets/images/logo-icon.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff"
}
],
[
"expo-secure-store",
{
"configureAndroidBackup": true
}
],
[
"expo-build-properties",
{
"ios": {
"useFrameworks": "static"
}
}
],
[
"expo-local-authentication",
{
"faceIDPermission": "Allow $(PRODUCT_NAME) to use Face ID."
}
]
],
"experiments": {
"typedRoutes": true
}
}
}
95 changes: 95 additions & 0 deletions samples/authenticator-app/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import AccountHeaderRight from "../src/components/account/AccountHeaderRight";
import { Stack } from "expo-router";
import { ReactElement, useEffect, useState } from "react";
import HeaderTitle from "../src/components/common/HeaderTitle";
import { ThemeConfigs } from "../src/models/ui";
import AsgardeoProvider from "../src/contexts/asgardeo/AsgardeoProvider";
import AppPaths from "../src/constants/AppPaths";
import Theme from "../src/utils/Theme";

const theme: ThemeConfigs = Theme.getInstance().getConfigs();

/**
* Root Layout component.
*
* @returns Root Layout component.
*/
const RootLayout = (): ReactElement => {
const [mounted, setMounted] = useState(false);

/**
* Sets the mounted state to true when the component is mounted.
*/
useEffect(() => {
setMounted(true);
}, []);

return (
<AsgardeoProvider isAppInitialized={mounted}>
<Stack>
<Stack.Screen
name={AppPaths.ROOT}
options={{
headerShown: false
}}
/>
<Stack.Screen
name={AppPaths.HOME}
options={{
headerStyle: { backgroundColor: theme.colors.header.background },
headerTitle: HeaderTitle
}}
/>
<Stack.Screen
name={AppPaths.QR_SCANNER}
options={{
headerShown: false,
presentation: "modal"
}}
/>
<Stack.Screen
name={AppPaths.PUSH_AUTH}
options={{
headerShown: false
}}
/>
<Stack.Screen
name={AppPaths.ACCOUNT}
options={({ route }) => ({
headerStyle: { backgroundColor: theme.colors.header.background },
headerTitle: HeaderTitle,
headerRight: (): ReactElement => <AccountHeaderRight params={route.params as Record<string, string>} />
})}
/>
<Stack.Screen
name={AppPaths.PUSH_AUTH_HISTORY}
options={({ route }) => ({
headerStyle: { backgroundColor: theme.colors.header.background },
headerTitle: HeaderTitle,
headerRight: (): ReactElement => <AccountHeaderRight params={route.params as Record<string, string>} />
})}
/>
</Stack>
</AsgardeoProvider>
);
}

export default RootLayout;
36 changes: 36 additions & 0 deletions samples/authenticator-app/app/account.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { useLocalSearchParams } from "expo-router";
import { FunctionComponent, ReactElement } from "react";
import TOTPCode from "../src/components/account/TOTPCode";

/**
* Account Screen component.
*
* @returns Account screen component.
*/
const AccountScreen: FunctionComponent = (): ReactElement | null => {
const { id } = useLocalSearchParams<{ id: string }>();

return (
<TOTPCode id={id} />
);
}

export default AccountScreen;
Loading
Loading