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

bootstrapCrossSigning() failing with "Error: the signing key is missing from the object that signed the message" #4625

Open
Crazypersonalph opened this issue Jan 17, 2025 · 1 comment

Comments

@Crazypersonalph
Copy link

Good afternoon,
I am writing a simple program to send encrypted messages to a matrix room.
I am currently trying to setup cross-signing, but am erroring out with

import * as sdk from "matrix-js-sdk";
import "fake-indexeddb/auto";
import bs58 from "bs58";


const recoveryKeyString = process.env.BACKUP_KEY_MATRIX

const client = sdk.createClient({ 
 baseUrl: "https://matrix.org", 
 accessToken: process.env.MATRIX_ACCESS_TOKEN, 
 userId: process.env.MATRIX_USER,
 deviceId: "frigate-server",
 cryptoCallbacks: {
    getSecretStorageKey: async (keys) => {
        const key = sdk.Crypto.decodeRecoveryKey(recoveryKeyString);
        return [Object.keys(keys.keys)[0], key];
    },
},
});

await client.initRustCrypto();
client.getCrypto().bootstrapSecretStorage({
    // This function will be called if a new secret storage key (aka recovery key) is needed.
    // You should prompt the user to save the key somewhere, because they will need it to unlock secret storage in future.
    createSecretStorageKey: async () => {
        return key;
    }
    
});

await client.getCrypto().bootstrapCrossSigning({
    authUploadDeviceSigningKeys: async (makeRequest) => {
        return makeRequest(authDict);
    },
});

client.startClient({ initialSyncLimit: 10});

const content = {
    body: "message text",
    msgtype: "m.text",
};

client.getCrypto().prepareToEncrypt(process.env.MATRIX_ROOM_ID);

await client.sendEvent(process.env.MATRIX_ROOM_ID, "m.room.message", content, "", (err, res) => {
    console.log(err);
});

All messages sent to the room aren't encrypted either.
The account was originally setup with Element, in which secure backup, encryption, and cross-signing were also setup.
All values provided in process.env are correct.

It is erroring out with:

bootstrapCrossSigning: starting {
  setupNewCrossSigning: undefined,
  olmDeviceHasMaster: false,
  olmDeviceHasUserSigning: false,
  olmDeviceHasSelfSigning: false,
  privateKeysInSecretStorage: true
}
bootstrapCrossSigning: Cross-signing private keys not found locally, but they are available in secret storage, reading storage and caching locally
WARN matrix_sdk_crypto::store: No public identity found while importing cross-signing keys, a /keys/query needs to be done

Error: the signing key is missing from the object that signed the message

Does anybody have any input?

Kind Regards

@Crazypersonalph
Copy link
Author

Crazypersonalph commented Jan 17, 2025

Also noticed this in the logs, not sure if it's related.
Key backup present on server but not trusted: not enabling key backup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant