mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-16 06:53:08 +00:00
"Direct Message" can lead to confusion with "Direct Connection" that refers to low latency network connections.
31 lines
789 B
TypeScript
31 lines
789 B
TypeScript
import { Button } from '@material-ui/core';
|
|
import React from 'react';
|
|
import { KeyPair } from '../crypto';
|
|
import { saveKeyPairToStorage } from './key_pair_storage';
|
|
|
|
export interface Props {
|
|
EncryptionKeyPair: KeyPair | undefined;
|
|
password: string | undefined;
|
|
}
|
|
|
|
export function SaveKeyPair({ password, EncryptionKeyPair }: Props) {
|
|
const saveKeyPair = () => {
|
|
if (!EncryptionKeyPair) return;
|
|
if (!password) return;
|
|
saveKeyPairToStorage(EncryptionKeyPair, password).then(() => {
|
|
console.log('Encryption KeyPair saved to storage');
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
variant="contained"
|
|
color="primary"
|
|
onClick={saveKeyPair}
|
|
disabled={!password || !EncryptionKeyPair}
|
|
>
|
|
Save Encryption Key Pair to storage
|
|
</Button>
|
|
);
|
|
}
|