@@ -278,7 +278,7 @@ function AuthenticateComponent() {
278278 id : keyData . id ,
279279 ciphertext : Utils . bytesToHex ( keyBox . keyBoxCiphertext ) ,
280280 nonce : Utils . bytesToHex ( keyBox . keyBoxNonce ) ,
281- authorPublicKey : appIdentity . encryptionPublicKey ,
281+ authorPublicKey : keys . encryptionPublicKey ,
282282 accountAddress : accountAddress ,
283283 } ;
284284 } ) ;
@@ -405,27 +405,33 @@ function AuthenticateComponent() {
405405 rpcUrl : import . meta. env . VITE_HYPERGRAPH_RPC_URL ,
406406 } ) ;
407407
408+ const appIdentityKeys = {
409+ encryptionPrivateKey : newAppIdentity . encryptionPrivateKey ,
410+ encryptionPublicKey : newAppIdentity . encryptionPublicKey ,
411+ signaturePrivateKey : newAppIdentity . signaturePrivateKey ,
412+ signaturePublicKey : newAppIdentity . signaturePublicKey ,
413+ } ;
408414 console . log ( 'encrypting app identity' ) ;
409415 const { ciphertext, nonce } = await Connect . encryptAppIdentity (
410416 signer ,
411417 newAppIdentity . address ,
412418 newAppIdentity . addressPrivateKey ,
413419 permissionId ,
414- keys ,
420+ appIdentityKeys ,
415421 ) ;
416422 console . log ( 'proving ownership' ) ;
417423 const { accountProof, keyProof } = await Identity . proveIdentityOwnership (
418424 smartAccountClient ,
419425 accountAddress ,
420- keys ,
426+ appIdentityKeys ,
421427 ) ;
422428
423429 const message : Messages . RequestConnectCreateAppIdentity = {
424430 appId : state . appInfo . appId ,
425431 address : newAppIdentity . address ,
426432 accountAddress,
427- signaturePublicKey : keys . signaturePublicKey ,
428- encryptionPublicKey : keys . encryptionPublicKey ,
433+ signaturePublicKey : newAppIdentity . signaturePublicKey ,
434+ encryptionPublicKey : newAppIdentity . encryptionPublicKey ,
429435 ciphertext,
430436 nonce,
431437 accountProof,
@@ -441,18 +447,16 @@ function AuthenticateComponent() {
441447 body : JSON . stringify ( message ) ,
442448 } ) ;
443449 const appIdentityResponse = await response . json ( ) ;
444- // TODO: All apps are essentially using the same keys, we should change to using
445- // the newly created app identity keys, but that requires changing a lot of the verification logic in the server and HypergraphAppContext
446450 await encryptSpacesAndRedirect ( {
447451 accountAddress,
448452 appIdentity : {
449453 address : newAppIdentity . address ,
450454 addressPrivateKey : newAppIdentity . addressPrivateKey ,
451455 accountAddress,
452- encryptionPrivateKey : keys . encryptionPrivateKey ,
453- signaturePrivateKey : keys . signaturePrivateKey ,
454- encryptionPublicKey : keys . encryptionPublicKey ,
455- signaturePublicKey : keys . signaturePublicKey ,
456+ encryptionPrivateKey : newAppIdentity . encryptionPrivateKey ,
457+ signaturePrivateKey : newAppIdentity . signaturePrivateKey ,
458+ encryptionPublicKey : newAppIdentity . encryptionPublicKey ,
459+ signaturePublicKey : newAppIdentity . signaturePublicKey ,
456460 sessionToken : appIdentityResponse . appIdentity . sessionToken ,
457461 sessionTokenExpires : new Date ( appIdentityResponse . appIdentity . sessionTokenExpires ) ,
458462 permissionId,
0 commit comments