committed by
GitHub
9 changed files with 248 additions and 145 deletions
@ -17,6 +17,9 @@ importers: |
|||||
'@meshtastic/js': |
'@meshtastic/js': |
||||
specifier: 2.3.7-1 |
specifier: 2.3.7-1 |
||||
version: 2.3.7-1 |
version: 2.3.7-1 |
||||
|
'@noble/curves': |
||||
|
specifier: ^1.5.0 |
||||
|
version: 1.5.0 |
||||
'@radix-ui/react-accordion': |
'@radix-ui/react-accordion': |
||||
specifier: ^1.2.0 |
specifier: ^1.2.0 |
||||
version: 1.2.0(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]) |
version: 1.2.0(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]) |
||||
@ -587,6 +590,13 @@ packages: |
|||||
'@meshtastic/[email protected]': |
'@meshtastic/[email protected]': |
||||
resolution: {integrity: sha512-pv+Xk6HkKrScCrQp31k5QOUYozabXn6NhXN7c7Cc9ysG94U1wGtfueRbEbFxXCHO3JshNz0CdE1FcSMnrLMjsQ==} |
resolution: {integrity: sha512-pv+Xk6HkKrScCrQp31k5QOUYozabXn6NhXN7c7Cc9ysG94U1wGtfueRbEbFxXCHO3JshNz0CdE1FcSMnrLMjsQ==} |
||||
|
|
||||
|
'@noble/[email protected]': |
||||
|
resolution: {integrity: sha512-J5EKamIHnKPyClwVrzmaf5wSdQXgdHcPZIZLu3bwnbeCx8/7NPK5q2ZBWF+5FvYGByjiQQsJYX6jfgB2wDPn3A==} |
||||
|
|
||||
|
'@noble/[email protected]': |
||||
|
resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} |
||||
|
engines: {node: '>= 16'} |
||||
|
|
||||
'@nodelib/[email protected]': |
'@nodelib/[email protected]': |
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} |
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} |
||||
engines: {node: '>= 8'} |
engines: {node: '>= 8'} |
||||
@ -3521,6 +3531,12 @@ snapshots: |
|||||
transitivePeerDependencies: |
transitivePeerDependencies: |
||||
- buffer |
- buffer |
||||
|
|
||||
|
'@noble/[email protected]': |
||||
|
dependencies: |
||||
|
'@noble/hashes': 1.4.0 |
||||
|
|
||||
|
'@noble/[email protected]': {} |
||||
|
|
||||
'@nodelib/[email protected]': |
'@nodelib/[email protected]': |
||||
dependencies: |
dependencies: |
||||
'@nodelib/fs.stat': 2.0.5 |
'@nodelib/fs.stat': 2.0.5 |
||||
|
|||||
@ -0,0 +1,39 @@ |
|||||
|
import { Button } from "@components/UI/Button.js"; |
||||
|
import { |
||||
|
Dialog, |
||||
|
DialogContent, |
||||
|
DialogDescription, |
||||
|
DialogFooter, |
||||
|
DialogHeader, |
||||
|
DialogTitle, |
||||
|
} from "@components/UI/Dialog.js"; |
||||
|
|
||||
|
export interface PkiRegenerateDialogProps { |
||||
|
open: boolean; |
||||
|
onOpenChange: () => void; |
||||
|
onSubmit: () => void; |
||||
|
} |
||||
|
|
||||
|
export const PkiRegenerateDialog = ({ |
||||
|
open, |
||||
|
onOpenChange, |
||||
|
onSubmit, |
||||
|
}: PkiRegenerateDialogProps): JSX.Element => { |
||||
|
return ( |
||||
|
<Dialog open={open} onOpenChange={onOpenChange}> |
||||
|
<DialogContent> |
||||
|
<DialogHeader> |
||||
|
<DialogTitle>Regenerate Key pair?</DialogTitle> |
||||
|
<DialogDescription> |
||||
|
Are you sure you want to regenerate key pair? |
||||
|
</DialogDescription> |
||||
|
</DialogHeader> |
||||
|
<DialogFooter> |
||||
|
<Button variant="destructive" onClick={() => onSubmit()}> |
||||
|
Regenerate |
||||
|
</Button> |
||||
|
</DialogFooter> |
||||
|
</DialogContent> |
||||
|
</Dialog> |
||||
|
); |
||||
|
}; |
||||
@ -0,0 +1,15 @@ |
|||||
|
import { x25519 } from "@noble/curves/ed25519"; |
||||
|
|
||||
|
export function getX25519PrivateKey(): Uint8Array { |
||||
|
const key = x25519.utils.randomPrivateKey(); |
||||
|
|
||||
|
key[0] &= 248; |
||||
|
key[31] &= 127; |
||||
|
key[31] |= 64; |
||||
|
|
||||
|
return key; |
||||
|
} |
||||
|
|
||||
|
export function getX25519PublicKey(privateKey: Uint8Array): Uint8Array { |
||||
|
return x25519.getPublicKey(privateKey); |
||||
|
} |
||||
Loading…
Reference in new issue