@@ -17,7 +17,7 @@ export interface SigningSession {
1717export interface SignedPayload {
1818 sessionId : string ;
1919 signature : string ;
20- publicKey : string ;
20+ w3id : string ;
2121 message : string ;
2222}
2323
@@ -112,7 +112,7 @@ export class SigningService {
112112 return session ;
113113 }
114114
115- async processSignedPayload ( sessionId : string , signature : string , publicKey : string , message : string ) : Promise < SigningResult > {
115+ async processSignedPayload ( sessionId : string , signature : string , w3id : string , message : string ) : Promise < SigningResult > {
116116 const session = await this . getSession ( sessionId ) ;
117117
118118 if ( ! session ) {
@@ -128,7 +128,7 @@ export class SigningService {
128128 }
129129
130130 try {
131- // 🔐 SECURITY ASSERTION: Verify that the publicKey matches the user's ename who created the session
131+ // 🔐 SECURITY ASSERTION: Verify that the w3id matches the user's ename who created the session
132132 try {
133133 const { UserService } = await import ( './UserService' ) ;
134134 const userService = new UserService ( ) ;
@@ -139,14 +139,14 @@ export class SigningService {
139139 }
140140
141141 // Strip @ prefix from both enames before comparison
142- const cleanPublicKey = publicKey . replace ( / ^ @ / , '' ) ;
142+ const cleanW3id = w3id . replace ( / ^ @ / , '' ) ;
143143 const cleanUserEname = user . ename . replace ( / ^ @ / , '' ) ;
144144
145- if ( cleanPublicKey !== cleanUserEname ) {
146- console . error ( `🔒 SECURITY VIOLATION: publicKey mismatch!` , {
147- publicKey ,
145+ if ( cleanW3id !== cleanUserEname ) {
146+ console . error ( `🔒 SECURITY VIOLATION: w3id mismatch!` , {
147+ w3id ,
148148 userEname : user . ename ,
149- cleanPublicKey ,
149+ cleanW3id ,
150150 cleanUserEname,
151151 sessionUserId : session . userId
152152 } ) ;
@@ -160,18 +160,18 @@ export class SigningService {
160160 this . notifySubscribers ( sessionId , {
161161 type : "security_violation" ,
162162 status : "security_violation" ,
163- error : "Public key does not match the user who created this signing session" ,
163+ error : "W3ID does not match the user who created this signing session" ,
164164 sessionId
165165 } ) ;
166166
167167 // Return success: false but don't throw error - let the wallet think it succeeded
168- return { success : false , error : "Public key does not match the user who created this signing session" } ;
168+ return { success : false , error : "W3ID does not match the user who created this signing session" } ;
169169 }
170170
171- console . log ( `✅ Public key verification passed: ${ cleanPublicKey } matches ${ cleanUserEname } ` ) ;
171+ console . log ( `✅ W3ID verification passed: ${ cleanW3id } matches ${ cleanUserEname } ` ) ;
172172 } catch ( error ) {
173- console . error ( "Error during public key verification:" , error ) ;
174- return { success : false , error : "Failed to verify public key : " + ( error instanceof Error ? error . message : "Unknown error" ) } ;
173+ console . error ( "Error during w3id verification:" , error ) ;
174+ return { success : false , error : "Failed to verify w3id : " + ( error instanceof Error ? error . message : "Unknown error" ) } ;
175175 }
176176
177177 // Verify the signature (basic verification for now)
0 commit comments