diff --git a/wallets/client/components/passphrase.js b/wallets/client/components/passphrase.js
index 98f4ac1a1..79df7ace6 100644
--- a/wallets/client/components/passphrase.js
+++ b/wallets/client/components/passphrase.js
@@ -1,4 +1,5 @@
-import React from 'react'
+import React, { useCallback } from 'react'
+import Button from 'react-bootstrap/Button'
import { CopyButton } from '@/components/form'
import styles from '@/styles/wallet.module.css'
@@ -7,7 +8,7 @@ export function Passphrase ({ passphrase }) {
return (
<>
- Make sure to copy your passphrase now.
+ Make sure to save your passphrase now.
This is the only time we will show it to you.
@@ -23,9 +24,49 @@ export function Passphrase ({ passphrase }) {
))}
-
+
+ or
+
>
)
}
+
+export default function DownloadButton ({ passphrase }) {
+ const onClick = useCallback(() => {
+ const filename = 'stacker-news-passphrase.txt'
+ const value = `STACKER NEWS PASSPHRASE
+-----------------------
+
+Your passphrase to unlock your wallets on any device is:
+
+${passphrase}
+
+Please keep this passphrase safe and do not share it with anyone.
+`
+ download(filename, value)
+ }, [passphrase])
+
+ return (
+
+ )
+}
+
+function download (filename, value) {
+ const blob = new Blob([value], { type: 'text/plain' })
+ const url = URL.createObjectURL(blob)
+ const a = document.createElement('a')
+ a.href = url
+ a.download = filename
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+ URL.revokeObjectURL(url)
+}