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

Make doc clearer on getCrossSigningKeyId #4477

Merged
merged 3 commits into from
Nov 4, 2024
Merged

Make doc clearer on getCrossSigningKeyId #4477

merged 3 commits into from
Nov 4, 2024

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Oct 29, 2024

I was trying to work out why this was being used in a check. It turns out it only returns the key ID if the private part is stored locally, which seems very much non-obvious.

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

I was trying to work out why this was being used in a check. It
turns out it only returns the key ID if the private part is stored
locally, which seems very much non-obvious.
Comment on lines 276 to 277
* Get the ID of one of the user's cross-signing keys, if the private is available.
* If the private key is not available, this will return null.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "key", but it might be good to be more explicit about what "is available" means. Does "in 4S" count as "available"? (I think not?)

This is already touched on in the @returns tag, but I don't think "cross-signing has been initialised" is very clear either. It would be good to clarify that while you're here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, looks like it depends what hasMaster etc. mean on olmMachine.crossSigningStatus. Do you have any idea without me delving into the rust?

Copy link
Member

@richvdh richvdh Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://matrix-org.github.io/matrix-rust-sdk/matrix_sdk_crypto/olm/struct.CrossSigningStatus.html might be vaguely helpful.

It means "cached in the local crypto store"; ie the private key has been loaded from 4S or similar.

I also note that this will return null if we have the private key but not the public key (which can happen if we haven't yet done a /keys/query, or if the device that created the keys failed to publish them), or if the public and private keys don't match. We should probably say that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - hopefully better now.

src/crypto-api/index.ts Outdated Show resolved Hide resolved
src/crypto-api/index.ts Outdated Show resolved Hide resolved
Co-authored-by: Richard van der Hoff <[email protected]>
@dbkr dbkr added this pull request to the merge queue Nov 4, 2024
Merged via the queue into develop with commit 794f044 Nov 4, 2024
26 checks passed
@dbkr dbkr deleted the dbkr/doc_fix branch November 4, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants