2022-01-13 18:37:14 +00:00
|
|
|
import { Action } from 'redux';
|
|
|
|
|
2022-01-18 12:49:44 +00:00
|
|
|
import { IBanner } from '../reducers/encryption';
|
2022-01-13 18:37:14 +00:00
|
|
|
import { ENCRYPTION } from './actionsTypes';
|
|
|
|
|
|
|
|
export interface IEncryptionSet extends Action {
|
|
|
|
enabled: boolean;
|
2022-01-18 12:49:44 +00:00
|
|
|
banner: IBanner;
|
2022-01-13 18:37:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IEncryptionSetBanner extends Action {
|
2022-01-18 12:49:44 +00:00
|
|
|
banner: IBanner;
|
2022-01-13 18:37:14 +00:00
|
|
|
}
|
|
|
|
export interface IEncryptionDecodeKey extends Action {
|
|
|
|
password: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type TActionEncryption = IEncryptionSet & IEncryptionSetBanner & IEncryptionDecodeKey;
|
|
|
|
|
|
|
|
export function encryptionInit(): Action {
|
|
|
|
return {
|
|
|
|
type: ENCRYPTION.INIT
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function encryptionStop(): Action {
|
|
|
|
return {
|
|
|
|
type: ENCRYPTION.STOP
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-01-18 12:49:44 +00:00
|
|
|
export function encryptionSet(enabled = false, banner: IBanner = ''): IEncryptionSet {
|
2022-01-13 18:37:14 +00:00
|
|
|
return {
|
|
|
|
type: ENCRYPTION.SET,
|
|
|
|
enabled,
|
|
|
|
banner
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-01-18 12:49:44 +00:00
|
|
|
export function encryptionSetBanner(banner: IBanner = ''): IEncryptionSetBanner {
|
2022-01-13 18:37:14 +00:00
|
|
|
return {
|
|
|
|
type: ENCRYPTION.SET_BANNER,
|
|
|
|
banner
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export function encryptionDecodeKey(password: string): IEncryptionDecodeKey {
|
|
|
|
return {
|
|
|
|
type: ENCRYPTION.DECODE_KEY,
|
|
|
|
password
|
|
|
|
};
|
|
|
|
}
|