File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
packages/sdk-platforms/react-native/react-native-zksync-sso/src/passkey Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,13 @@ import {
1010 arrayBufferToBase64Url
1111} from './utils' ;
1212
13+ /**
14+ * Authenticates a user using their platform passkey and returns the authentication data.
15+ *
16+ * @param message - The challenge message to authenticate against, as an ArrayBuffer
17+ * @param rpId - The relying party ID used for passkey authentication
18+ * @returns A Promise that resolves to an ArrayBuffer containing the encoded authentication payload
19+ */
1320export const authenticateWithPasskey = async (
1421 message : ArrayBuffer ,
1522 rpId : string
Original file line number Diff line number Diff line change 22import { type PasskeyAuthenticatorAsync } from 'react-native-zksync-sso' ;
33import { authenticateWithPasskey } from '../authenticate' ;
44
5+ /**
6+ * Authenticator class that implements passkey-based authentication.
7+ * This class handles the signing of messages using platform-specific passkey authentication.
8+ */
59export class Authenticator implements PasskeyAuthenticatorAsync {
610 private rpId : string ;
711
12+ /**
13+ * Creates a new Authenticator instance.
14+ * @param rpId - The relying party ID used for passkey authentication
15+ */
816 constructor ( rpId : string ) {
917 this . rpId = rpId ;
1018 }
1119
20+ /**
21+ * Signs a message using the platform's passkey authentication.
22+ * @param message - The message to sign as an ArrayBuffer
23+ * @returns A Promise that resolves to the signed message as an ArrayBuffer
24+ */
1225 async signMessage (
1326 message : ArrayBuffer ,
1427 ) : Promise < ArrayBuffer > {
Original file line number Diff line number Diff line change @@ -15,17 +15,34 @@ import {
1515 base64ToArrayBuffer
1616} from './utils' ;
1717
18+ /**
19+ * Information about the relying party (RP) for passkey registration
20+ */
1821export interface RPInfo {
1922 name : string ;
2023 id : string ;
2124}
2225
26+ /**
27+ * Information about the account being registered
28+ */
2329export interface AccountInfo {
2430 name : string ;
2531 userID : string ;
2632 rp : RPInfo ;
2733}
2834
35+ /**
36+ * Registers a new account using a platform passkey and deploys it.
37+ * This function handles the creation of a new passkey and the deployment of the account
38+ * with the generated credentials.
39+ *
40+ * @param accountInfo - Information about the account to register
41+ * @param secretAccountSalt - Salt used for account derivation
42+ * @param challenge - Challenge string for passkey creation
43+ * @param config - Configuration for deployment
44+ * @returns A Promise that resolves to the deployed Account
45+ */
2946export const registerAccountWithUniqueId = async (
3047 accountInfo : AccountInfo ,
3148 secretAccountSalt : string ,
You can’t perform that action at this time.
0 commit comments