-
-
Notifications
You must be signed in to change notification settings - Fork 618
Add crypto methods for export and import of secrets bundle #4227
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
Changes from 1 commit
30c8ba6
30e586a
fc59cf0
4a00109
235d1d4
af07b84
7bfe091
ff83fe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Copyright 2024 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import type * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-wasm"; | ||
|
||
declare module "@matrix-org/matrix-sdk-crypto-wasm" { | ||
interface OlmMachine { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this? isn't it already in the index.d.ts of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes but with return types of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be fixed on the wasm side; matrix-org/matrix-rust-sdk-crypto-wasm#123 does so but it will need a release cycle :/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, that PR doesn't help with the return type of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It should still be a useful type otherwise you'll get junk into the import method. If it isn't meant to be introspectable then it should be a branded type so a round-trip export->import works without needing to rely on |
||
importSecretsBundle(bundle: RustSdkCryptoJs.SecretsBundle): Promise<void>; | ||
exportSecretsBundle(): Promise<RustSdkCryptoJs.SecretsBundle>; | ||
} | ||
|
||
interface SecretsBundle { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
to_json(): Promise<{ | ||
cross_signing: { | ||
master_key: string; | ||
self_signing_key: string; | ||
user_signing_key: string; | ||
}; | ||
backup?: { | ||
algorithm: string; | ||
key: string; | ||
backup_version: string; | ||
}; | ||
}>; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could check the getCrossSigningStatus? and see that the identity is there and trusted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes the test to hang on
OlmMachine::getIdentity
and I have 0 introspection on the rust side of things to debug this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,
getCrossSigningStatus
will want to fire off/keys/query
requests and wait for them to complete, so that is more of an integration-test thing.That said: some integration tests here might be nice?