Skip to content

Commit

Permalink
temp push
Browse files Browse the repository at this point in the history
  • Loading branch information
code-z2 committed Oct 21, 2024
1 parent 566f5ba commit 56060ef
Show file tree
Hide file tree
Showing 22 changed files with 180 additions and 116 deletions.
41 changes: 38 additions & 3 deletions apps/native/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,47 @@ import "@vaariance/ui/styles.css";

import { StatusBar } from "expo-status-bar";
import { View } from "react-native";
import { Text } from "@vaariance/ui";
import { Text, Button } from "@vaariance/ui";
import Cosmr1CredentialHandlerModule from "@vaariance/cred-native";

export default function App() {
const credentialManager = Cosmr1CredentialHandlerModule;

const register = async () => {
const result = await credentialManager.register({
attestation: "none",
challenge: btoa("register me"),
rp: {
id: "localhost",
name: "localhost",
},
user: {
displayName: "user",
id: btoa("user id"),
name: "[email protected]",
},
timeout: 60000,
});
console.log(result);
};

const authenticate = async () => {
const result = await credentialManager.authenticate({
challenge: btoa("sign this"),
timeout: 6000,
userVerification: "required",
rpId: "localhost",
});
console.log(result);
};
return (
<View className="flex-1 items-center justify-center">
<Text>Open up App.tsx to start working on your app!</Text>
<View className="flex-1 items-center justify-center flex-col-reverse bg-background gap-5">
<Button variant={"default"} onPress={register}>
<Text>Create A Passkey</Text>
</Button>
<Button variant={"default"} onPress={authenticate}>
<Text>Sign in with Passkey</Text>
</Button>
<StatusBar style="auto" />
</View>
);
Expand Down
1 change: 1 addition & 0 deletions apps/native/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<string name="app_name">native</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
<string name="expo_system_ui_user_interface_style" translatable="false">light</string>
</resources>
2 changes: 1 addition & 1 deletion apps/native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
buildscript {
ext {
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '28')
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23'
Expand Down
4 changes: 2 additions & 2 deletions apps/native/ios/native.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = space.variance.internal;
PRODUCT_NAME = native;
PRODUCT_NAME = "native";
SWIFT_OBJC_BRIDGING_HEADER = "native/native-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -379,7 +379,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = space.variance.internal;
PRODUCT_NAME = native;
PRODUCT_NAME = "native";
SWIFT_OBJC_BRIDGING_HEADER = "native/native-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
3 changes: 2 additions & 1 deletion apps/native/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true
"strict": true,
"moduleResolution": "Bundler"
},
"include": [
"**/*.ts",
Expand Down
42 changes: 38 additions & 4 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,46 @@
"use client";
import "@vaariance/ui/styles.css";
import { Button } from "@vaariance/ui";
import { Button, Text } from "@vaariance/ui";
import Cosmr1CredentialHandlerModule from "@vaariance/cred-web";

export default function Web() {
const credentialManager = Cosmr1CredentialHandlerModule();

const register = async () => {
const result = await credentialManager.register({
attestation: "none",
challenge: Buffer.from(btoa("register me"), "base64"),
rp: {
id: "localhost",
name: "localhost",
},
user: {
displayName: "user",
id: Buffer.from(btoa("user id"), "base64"),
name: "[email protected]",
},
timeout: 60000,
});
console.log(result);
};

const authenticate = async () => {
const result = await credentialManager.authenticate({
challenge: Buffer.from(btoa("sign this"), "base64"),
timeout: 6000,
userVerification: "required",
rpId: "localhost",
});
console.log(result);
};
return (
<div className="flex-1 items-center justify-center">
<h1>Web</h1>
<Button onPress={() => console.log("Pressed!")}>click me</Button>
<div className="w-full h-screen flex flex-col-reverse items-center justify-center bg-background gap-5">
<Button variant={"default"} onPress={register}>
<Text>Create A Passkey</Text>
</Button>
<Button variant={"default"} onPress={authenticate}>
<Text>Sign in with Passkey</Text>
</Button>
</div>
);
}
2 changes: 1 addition & 1 deletion apps/web/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5 changes: 5 additions & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module.exports = {
reactStrictMode: true,
transpilePackages: [
"nativewind",
"react-native-css-interop",
"@vaariance/ui",
],
webpack: (config) => {
config.resolve.alias = {
...(config.resolve.alias || {}),
Expand Down
5 changes: 4 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
"react-native-web": "^0.19.10"
},
"devDependencies": {
"@vaariance/configs": "*",
"@types/node": "^20.10.6",
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
"@vaariance/configs": "*",
"autoprefixer": "^10.4.20",
"babel-plugin-react-native-web": "^0.19.10",
"eslint": "^8.56.0",
"eslint-config-next": "14.0.4",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.14",
"typescript": "^5.3.3"
}
}
2 changes: 2 additions & 0 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "@vaariance/configs/typescript/nextjs.json",
"compilerOptions": {
"moduleResolution": "Bundler",
"jsxImportSource": "nativewind",
"plugins": [{ "name": "next" }]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
Expand Down
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/configs/tailwind/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module.exports = {
darkMode: "class",
content: [
"./app/**/*.{js,jsx,ts,tsx}",
"../../packages/ui/**/*.{js,ts,jsx,tsx}",
"./**/*.{js,ts,jsx,tsx}",
"../../packages/ui/src/**/*.{ts,tsx}",
],
presets: [require("nativewind/preset")],
important: "html",
theme: {
extend: {
colors: {
Expand Down
6 changes: 3 additions & 3 deletions packages/cred-native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (useManagedAndroidSdkVersions) {
project.android {
compileSdkVersion safeExtGet("compileSdkVersion", 34)
defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 21)
minSdkVersion safeExtGet("minSdkVersion", 28)
targetSdkVersion safeExtGet("targetSdkVersion", 34)
}
}
Expand All @@ -44,8 +44,8 @@ android {

dependencies {
// Credentials and Google Sign-In
implementation "androidx.credentials:credentials:1.5.0-alpha05"
implementation "androidx.credentials:credentials-play-services-auth:1.5.0-alpha05"
implementation "androidx.credentials:credentials:1.2.2"
implementation "androidx.credentials:credentials-play-services-auth:1.2.2"

// utility
implementation 'com.google.code.gson:gson:2.9.0'
Expand Down
2 changes: 1 addition & 1 deletion packages/cred-web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const Cosmr1CredentialHandlerModule = (
}),
};

return Object.assign(moduleObject, mainFunctions);
return Object.assign(moduleObject, helpers, mainFunctions);
};

export default Cosmr1CredentialHandlerModule;
File renamed without changes.
21 changes: 8 additions & 13 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{
"name": "@vaariance/ui",
"version": "0.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"sideEffects": [
"**/*.css"
],
"type": "module",
"exports": {
".": "./dist/index.js",
"./*": "./dist/*",
"./styles.css": "./styles.css"
".": "./src/index.ts",
"./*": "./src/*",
"./styles.css": "./src/styles.css"
},
"scripts": {
"prebuild": "tsup",
"dev": "tsup --watch",
"clean": "rm -rf dist"
"dev": "pnpm build --watch",
"build": "tsc --noEmit",
"clean": "rm -rf .swc .turbo dist"
},
"devDependencies": {
"@vaariance/configs": "*",
Expand All @@ -40,9 +39,5 @@
"react-native": "*",
"nativewind": "*",
"tailwindcss-animate": "*"
},
"files": [
"dist",
"styles.css"
]
}
}
Loading

0 comments on commit 56060ef

Please sign in to comment.