You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
extract SecretStorageKeyObject
This commit is contained in:
@@ -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";
|
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 SecretStorageKeyTuple = [keyId: string, keyInfo: ISecretStorageKeyInfo];
|
||||||
|
export type SecretStorageKeyObject = {keyId: string, keyInfo: ISecretStorageKeyInfo};
|
||||||
|
|
||||||
export interface ISecretRequest {
|
export interface ISecretRequest {
|
||||||
requestId: string;
|
requestId: string;
|
||||||
@@ -123,7 +125,7 @@ export class SecretStorage {
|
|||||||
algorithm: string,
|
algorithm: string,
|
||||||
opts: IAddSecretStorageKeyOpts,
|
opts: IAddSecretStorageKeyOpts,
|
||||||
keyId?: string,
|
keyId?: string,
|
||||||
): Promise<{keyId: string, keyInfo: ISecretStorageKeyInfo}> {
|
): Promise<SecretStorageKeyObject> {
|
||||||
const keyInfo = { algorithm } as ISecretStorageKeyInfo;
|
const keyInfo = { algorithm } as ISecretStorageKeyInfo;
|
||||||
|
|
||||||
if (!opts) opts = {} as IAddSecretStorageKeyOpts;
|
if (!opts) opts = {} as IAddSecretStorageKeyOpts;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
SecretStorage,
|
SecretStorage,
|
||||||
SecretStorageKeyTuple,
|
SecretStorageKeyTuple,
|
||||||
ISecretRequest,
|
ISecretRequest,
|
||||||
|
SecretStorageKeyObject,
|
||||||
} from './SecretStorage';
|
} from './SecretStorage';
|
||||||
import { IAddSecretStorageKeyOpts, ISecretStorageKeyInfo } from "./api";
|
import { IAddSecretStorageKeyOpts, ISecretStorageKeyInfo } from "./api";
|
||||||
import { OutgoingRoomKeyRequestManager } from './OutgoingRoomKeyRequestManager';
|
import { OutgoingRoomKeyRequestManager } from './OutgoingRoomKeyRequestManager';
|
||||||
@@ -981,7 +982,7 @@ export class Crypto extends EventEmitter {
|
|||||||
algorithm: string,
|
algorithm: string,
|
||||||
opts: IAddSecretStorageKeyOpts,
|
opts: IAddSecretStorageKeyOpts,
|
||||||
keyID: string,
|
keyID: string,
|
||||||
): Promise<{keyId: string, keyInfo: ISecretStorageKeyInfo}> {
|
): Promise<SecretStorageKeyObject> {
|
||||||
return this.secretStorage.addKey(algorithm, opts, keyID);
|
return this.secretStorage.addKey(algorithm, opts, keyID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user