Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.6.0-beta.8] "One time key signed_curve25519:AAAABw already exists." #237

Closed
CyberShadow opened this issue Jul 1, 2022 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@CyberShadow
Copy link

CyberShadow commented Jul 1, 2022

Hi, thanks for this project!

I'm trying to use it to write a bot which acts on my behalf to automate some things. As such, it runs under my account.

I noticed that the last stable version (v0.5.9) could not decrypt encrypted messages, so I'm trying v0.6.0-beta.8.

Upon adding a RustSdkCryptoStorageProvider instance and passing it to MatrixClient, it crashes printing this:

Fri, 01 Jul 2022 06:45:50 GMT [ERROR] [MatrixHttpClient (REQ-171)] {
  errcode: 'M_UNKNOWN',
  error: `One time key signed_curve25519:AAAABw already exists. Old key: {"key":"mPKa***************************************","signatures":{"@cybershadow:cy.md":{"ed25519:DYFH******":"r5Am**********************************************************************************"}}}; new key: {'key': 'IUFe***************************************', 'signatures': {'@cybershadow:cy.md': {'ed25519:DYFH******': '2z2W**********************************************************************************'}}}`
}
/home/vladimir/work/matrix-bot/node_modules/matrix-bot-sdk/lib/http.js:92
                reject(new MatrixError_1.default(errBody, response.statusCode));
                       ^
MatrixError: M_UNKNOWN: One time key signed_curve25519:AAAABw already exists. Old key: {"key":"mPKa***************************************","signatures":{"@cybershadow:cy.md":{"ed25519:DYFH******":"r5Am**********************************************************************************"}}}; new key: {'key': 'IUFe***************************************', 'signatures': {'@cybershadow:cy.md': {'ed25519:DYFH******': '2z2W**********************************************************************************'}}}
    at Request._callback (/home/vladimir/work/matrix-bot/node_modules/matrix-bot-sdk/lib/http.js:92:24)
    at self.callback (/home/vladimir/work/matrix-bot/node_modules/request/request.js:185:22)
    at Request.emit (node:events:527:28)
    at Request.<anonymous> (/home/vladimir/work/matrix-bot/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:527:28)
    at IncomingMessage.<anonymous> (/home/vladimir/work/matrix-bot/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (node:events:641:28)
    at IncomingMessage.emit (node:events:539:35)
    at endReadableNT (node:internal/streams/readable:1344:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  body: {
    errcode: 'M_UNKNOWN',
    error: `One time key signed_curve25519:AAAABw already exists. Old key: {"key":"mPKa***************************************","signatures":{"@cybershadow:cy.md":{"ed25519:DYFH******":"r5Am**********************************************************************************"}}}; new key: {'key': 'IUFe***************************************', 'signatures': {'@cybershadow:cy.md': {'ed25519:DYFH******': '2z2W**********************************************************************************'}}}`
  },
  statusCode: 400,
  errcode: 'M_UNKNOWN',
  error: `One time key signed_curve25519:AAAABw already exists. Old key: {"key":"mPKa***************************************","signatures":{"@cybershadow:cy.md":{"ed25519:DYFH******":"r5Am**********************************************************************************"}}}; new key: {'key': 'IUFe***************************************', 'signatures': {'@cybershadow:cy.md': {'ed25519:DYFH******': '2z2W**********************************************************************************'}}}`,
  retryAfterMs: undefined
}
Node.js v18.3.0

Perhaps this is because I'm trying to run it on an existing user? To do this, I opened an Element instance in a private window, logged in as myself, got the token, approved the instance from another client (by comparing emoji), then closed the private window.

Also, I don't know if this is relevant or not, but I noticed that in the signatures object in the message above, I see instances with the same key ('ed25519:DYFH******') but different values ("r5Am..." and '2z2W...').

Hope this helps!

@CyberShadow CyberShadow added the bug Something isn't working label Jul 1, 2022
@turt2live
Copy link
Owner

turt2live commented Jul 1, 2022

The access token was already used to set up encryption for that device: a fresh access token may be required.

Edit: Element sets up encryption, so using a script like the login_register example might work better.

@turt2live turt2live closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2022
@CyberShadow
Copy link
Author

Thanks, that works! Is it possible to verify the bot's device? And, is it possible to import E2E room keys into the bot?

@turt2live
Copy link
Owner

verification isn't supported, but manual verification of the bot is always a thing you can do. Importing room keys is also not supported at the moment.

@CyberShadow
Copy link
Author

CyberShadow commented Jul 1, 2022

verification isn't supported, but manual verification of the bot is always a thing you can do.

Sorry to bother you but could you please give me a pointer for how one would accomplish this?

Or, would it perhaps make more sense to use matrix-rust-sdk at this time? I found this project via https://matrix.org/docs/guides/usage-of-matrix-bot-sdk/ but I see now that it's not in the matrix/ namespace, and even uses matrix-rust-sdk's crypto crate.

Edit: never mind, I reimplemented my bot with matrix-rust-sdk.

@Xavier4492
Copy link

Xavier4492 commented May 12, 2024

verification isn't supported, but manual verification of the bot is always a thing you can do.

Hello, I've been looking for several days how to do this manually, but I can't find the right eventName to listen to "m.key.verification.request" nor any to_device event, what am I missing?
Is there a way to log all incoming events (not those for which a listener recorded)

Thanks for you job !! big stuff

Edit: Thank to @turt2live to give me client.on("to_device.decrypted", (event) => {...}, starting point for manual session verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants