1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

extract SecretStorageKeyObject

This commit is contained in:
David Baker
2021-07-07 21:14:34 +01:00
parent 64a1c83acc
commit fd2d106f2a
2 changed files with 5 additions and 2 deletions

View File

@@ -27,7 +27,9 @@ export const SECRET_STORAGE_ALGORITHM_V1_AES = "m.secret_storage.v1.aes-hmac-sha
const ZERO_STR = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
// Some of the key functions use a tuple and some use an object...
export type SecretStorageKeyTuple = [keyId: string, keyInfo: ISecretStorageKeyInfo];
export type SecretStorageKeyObject = {keyId: string, keyInfo: ISecretStorageKeyInfo};
export interface ISecretRequest {
requestId: string;
@@ -123,7 +125,7 @@ export class SecretStorage {
algorithm: string,
opts: IAddSecretStorageKeyOpts,
keyId?: string,
): Promise<{keyId: string, keyInfo: ISecretStorageKeyInfo}> {
): Promise<SecretStorageKeyObject> {
const keyInfo = { algorithm } as ISecretStorageKeyInfo;
if (!opts) opts = {} as IAddSecretStorageKeyOpts;

View File

@@ -38,6 +38,7 @@ import {
SecretStorage,
SecretStorageKeyTuple,
ISecretRequest,
SecretStorageKeyObject,
} from './SecretStorage';
import { IAddSecretStorageKeyOpts, ISecretStorageKeyInfo } from "./api";
import { OutgoingRoomKeyRequestManager } from './OutgoingRoomKeyRequestManager';
@@ -981,7 +982,7 @@ export class Crypto extends EventEmitter {
algorithm: string,
opts: IAddSecretStorageKeyOpts,
keyID: string,
): Promise<{keyId: string, keyInfo: ISecretStorageKeyInfo}> {
): Promise<SecretStorageKeyObject> {
return this.secretStorage.addKey(algorithm, opts, keyID);
}