-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
180 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.