Oddbean new post about | logout
 I'm trying to build a nostr app but am having trouble decrypting kind 4 messages.  Here is console log of my error if there are any JS pros that wouldn't mind giving me some input on what I may be doing wrong I would appreciate it.  #AskNostr

Console log: 
Public key used for checking be59c605266b5bc209d78eecf84b3104a1d51433922902c311ab57c2a788c4f1
2024-04-19T22:32:50.313Z - Event with our pubkey found: {
  content: 'PdAedhedo9g6mHHoKZoxaUFpoDCq5Gp2ialxRyDS2N0=?iv=jeHSBPW2KOtHV+AlbKm1eQ==',
  created_at: 1713565970,
  id: '050ac005d2e8eb0ccd68a82e0e4067fd23a49997da6f2bc367d3a51f4eac7104',
  kind: 4,
  pubkey: '607b55670f54cc08c1bce8b54c184b18b5af3f73e86842f9c2c0d67e93c940b2',
  sig: '23402c489eb0619f96893caf69e265182aa8f7a7a03cc812f78005358a6c1fcea4bc0cd4fd31dde8919919f6a462f9f091123645e3c7011c35ef4d0fe038584f',
  tags: [
    [
      'p',
      'be59c605266b5bc209d78eecf84b3104a1d51433922902c311ab57c2a788c4f1',
      'wss://nostrpub.yeghro.site/'
    ]
  ]
}
Processing event: {
  content: 'PdAedhedo9g6mHHoKZoxaUFpoDCq5Gp2ialxRyDS2N0=?iv=jeHSBPW2KOtHV+AlbKm1eQ==',
  created_at: 1713565970,
  id: '050ac005d2e8eb0ccd68a82e0e4067fd23a49997da6f2bc367d3a51f4eac7104',
  kind: 4,
  pubkey: '607b55670f54cc08c1bce8b54c184b18b5af3f73e86842f9c2c0d67e93c940b2',
  sig: '23402c489eb0619f96893caf69e265182aa8f7a7a03cc812f78005358a6c1fcea4bc0cd4fd31dde8919919f6a462f9f091123645e3c7011c35ef4d0fe038584f',
  tags: [
    [
      'p',
      'be59c605266b5bc209d78eecf84b3104a1d51433922902c311ab57c2a788c4f1',
      'wss://nostrpub.yeghro.site/'
    ]
  ]
}
Received content: PdAedhedo9g6mHHoKZoxaUFpoDCq5Gp2ialxRyDS2N0=?iv=jeHSBPW2KOtHV+AlbKm1eQ==
Encrypted message: PdAedhedo9g6mHHoKZoxaUFpoDCq5Gp2ialxRyDS2N0=
IV (base64): jeHSBPW2KOtHV+AlbKm1eQ==
Shared secret: 04de00db466c912f545905f087626fdbe339ceda8102c6ada0b452d5b039edffab3501172422948853413d812d586bcb5916d1b5564375fd71aa96336ca91716f6
Encryption key: 3464653030646234363663393132663534353930356630383736323666646265
Extracted pubkey: 607b55670f54cc08c1bce8b54c184b18b5af3f73e86842f9c2c0d67e93c940b2
Error decrypting message: Error: error:1C800064:Provider routines::bad decrypt

  library: 'Provider routines',
  reason: 'bad decrypt',
  code: 'ERR_OSSL_BAD_DECRYPT'
}
Encryption Key: 3464653030646234363663393132663534353930356630383736323666646265
IV used for decryption (hex): 8de1d204f5b628eb4757e0256ca9b579
Ciphertext Base64: PdAedhedo9g6mHHoKZoxaUFpoDCq5Gp2ialxRyDS2N0=