matrix-org / matrix-org/matrix-js-sdk
Boostrapping Cross Signing Returns true, but does not work.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
I am trying to verify different user sessions using my clients (react-native apps). So for that my understanding is that we need to establish the cross-signing for devices for that account.
I'm using a local synapse server!
async getCrossSigningInfo() {
const client = await this.getClient();
const userCrossSigning = client.getStoredCrossSigningForUser();
console.log('Cross Signing', userCrossSigning);
let isCrossSigningReady = await client.isCrossSigningReady();
let crossSigningID = client.getCrossSigningId();
console.log('isCrossSigningReady', isCrossSigningReady, crossSigningID);
if (isCrossSigningReady) {
await client.downloadKeys([client.getUserId()]);
return;
} else {
const bootstrapCrossSigning = await client.bootstrapCrossSigning({
setupNewCrossSigning: true,
});
}
}
isCrossSigningReady false
For the first time, SDK logs
Bootstrapping cross-signing
{
setupNewCrossSigning: true,
publicKeysOnDevice: null,
privateKeysInCache: false,
privateKeysInStorage: null,
privateKeysExistSomewhere: null
}
Cross-signing private keys not found locally or in secret storage, creating new keys
Cache master cross-signing private key locally
Cache self_signing cross-signing private key locally
Cache user_signing cross-signing private key locally
Cross-signing ready
Now what do I have to do? Do I need to upload these keys? if so how? So that they are available to other devices as well. If my assumption is correct then this would help in device verification.
When trying the second time.
isCrossSigningReady true irzwgUc7AZ8cKobvyHFjuj3QOw7AunaMQOIoiwvKxCQ
got device keys for @green45:localhost: {AJECGGUMWE: {…}, MDRPNHMQFS: {…}}AJECGGUMWE: {algorithms: Array(2), device_id: 'AJECGGUMWE', keys: {…}, signatures: {…}, user_id: '@green45:localhost', …}MDRPNHMQFS: {algorithms: Array(2), device_id: 'MDRPNHMQFS', keys: {…}, signatures: {…}, user_id: '@green45:localhost', …}}
got cross-signing keys for @green45:localhost: {master: undefined, self_signing: undefined, user_signing: undefined}
So when I try to re-sync, my assumption is that if I have to upload the keys somewhere so that they are accessible to all devices of the same user, or I could be wrong. Need help in finding the missing piece.
matrix-js-sdk: 23.1.1
Note: When I connect my server to element and see if cross signing works there, it does and when I re-sync all my clients I do see the cross signing keys.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing bootstrapCrossSigning, isCrossSigningReady, downloadKeys, and getStoredCrossSigningForUser in the SDK implementation and documentation. Compare the key storage and synchronization flow with the Element client, then reproduce the reported undefined cross-signing keys against the local Synapse server. Done means the expected cross-signing keys are available after re-sync, or the missing setup step is documented clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- cryptography, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100