Skip to content

Commit 37ca33c

Browse files
Merge pull request #393 from pimlicolabs/add-username
Add username to verification
2 parents 5a94bcf + d9ec1ec commit 37ca33c

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.changeset/puny-bags-fail.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"permissionless": patch
3+
---
4+
5+
Added return of userName for passkeys verification actions

packages/permissionless/actions/passkeyServer/verifyAuthentication.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type VerifyAuthenticationReturnType = {
1111
success: boolean
1212
id: string
1313
publicKey: Hex
14+
userName: string
1415
}
1516

1617
export const verifyAuthentication = async (
@@ -102,6 +103,7 @@ export const verifyAuthentication = async (
102103
const success = Boolean(serverResponse?.success)
103104
const id = serverResponse?.id
104105
const publicKey = serverResponse?.publicKey
106+
const userName = serverResponse?.userName
105107

106108
if (typeof id !== "string") {
107109
throw new Error("Invalid passkey id returned from server")
@@ -113,9 +115,14 @@ export const verifyAuthentication = async (
113115
)
114116
}
115117

118+
if (typeof userName !== "string") {
119+
throw new Error("Invalid user name returned from server")
120+
}
121+
116122
return {
117123
success,
118124
id,
119-
publicKey: publicKey as Hex
125+
publicKey: publicKey as Hex,
126+
userName
120127
}
121128
}

packages/permissionless/actions/passkeyServer/verifyRegistration.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type VerifyRegistrationReturnType = {
1212
success: boolean
1313
id: string
1414
publicKey: Hex
15+
userName: string
1516
}
1617

1718
export const verifyRegistration = async (
@@ -105,6 +106,7 @@ export const verifyRegistration = async (
105106
const success = Boolean(serverResponse?.success)
106107
const id = serverResponse?.id
107108
const publicKey = serverResponse?.publicKey
109+
const userName = serverResponse?.userName
108110

109111
if (typeof id !== "string") {
110112
throw new Error("Invalid passkey id returned from server")
@@ -116,9 +118,14 @@ export const verifyRegistration = async (
116118
)
117119
}
118120

121+
if (typeof userName !== "string") {
122+
throw new Error("Invalid user name returned from server")
123+
}
124+
119125
return {
120126
success,
121127
id,
122-
publicKey: publicKey as Hex
128+
publicKey: publicKey as Hex,
129+
userName
123130
}
124131
}

packages/permissionless/types/passkeyServer.ts

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export type PasskeyServerRpcSchema = [
8080
success: boolean
8181
id: string
8282
publicKey: Hex
83+
userName: string
8384
}
8485
},
8586
{
@@ -110,6 +111,7 @@ export type PasskeyServerRpcSchema = [
110111
success: boolean
111112
id: string
112113
publicKey: Hex
114+
userName: string
113115
}
114116
},
115117
{

0 commit comments

Comments
 (0)