Skip to content

Commit

Permalink
Merge pull request #1988 from oasisprotocol/mz/label
Browse files Browse the repository at this point in the history
Rename keyphrase to mnemonic
  • Loading branch information
lukaw3d authored Jul 3, 2024
2 parents 9ddb06c + 696b584 commit 2cda112
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 33 deletions.
1 change: 1 addition & 0 deletions .changelog/1988.trivial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename keyphrase to mnemonic
4 changes: 2 additions & 2 deletions cypress/e2e/create-wallet.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Create wallet', () => {
it('Should not be able to confirm with a different (valid) mnemonic', () => {
cy.contains('mnemonic does not match').should('not.exist')

cy.findByPlaceholderText('Enter your keyphrase here').type(
cy.findByPlaceholderText('Enter your mnemonic here').type(
'abuse gown claw final toddler wedding sister parade useful typical spatial skate decrease bulk student manual cloth shove fat car little swamp tag ginger',
{ delay: 0 },
)
Expand All @@ -43,7 +43,7 @@ describe('Create wallet', () => {
it('Should confirm mnemonic', () => {
cy.findByRole('button', { name: /Send/ }).should('not.exist')
cy.findByRole('button', { name: /Import my wallet/ }).click()
cy.findByPlaceholderText('Enter your keyphrase here').type(generatedMnemonic, { delay: 0 })
cy.findByPlaceholderText('Enter your mnemonic here').type(generatedMnemonic, { delay: 0 })
cy.findByRole('button', { name: /Import my wallet/ }).click()
cy.contains('mnemonic does not match').should('not.exist')
cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true })
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/open-wallet.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ describe('Open wallet', () => {
})

it('Should reject invalid mnemonics', () => {
cy.findByPlaceholderText('Enter your keyphrase here').type('this is an invalid mnemonic')
cy.findByPlaceholderText('Enter your mnemonic here').type('this is an invalid mnemonic')
cy.findByRole('button', { name: /Import my wallet/ }).click()
cy.findByText(/Invalid keyphrase/).should('be.visible')
cy.findByText(/Invalid mnemonic/).should('be.visible')
})

it('Should accept valid mnemonic', () => {
cy.findByPlaceholderText('Enter your keyphrase here').type(mnemonic, { delay: 1 })
cy.findByPlaceholderText('Enter your mnemonic here').type(mnemonic, { delay: 1 })
cy.findByRole('button', { name: /Import my wallet/ }).click()
cy.findByText(/Invalid keyphrase/).should('not.exist')
cy.findByText(/Invalid mnemonic/).should('not.exist')
cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true })
cy.findByRole('button', { name: /Open/ }).click()
cy.url().should('include', 'oasis1qqca0gplrfn63ljg9c833te7em36lkz0cv8djffh')
})

it('Should open multiple accounts from mnemonic', () => {
cy.findByPlaceholderText('Enter your keyphrase here').type(mnemonic, { delay: 1 })
cy.findByPlaceholderText('Enter your mnemonic here').type(mnemonic, { delay: 1 })
cy.findByRole('button', { name: /Import my wallet/ }).click()
cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true })
cy.findAllByTestId('account-choice').should('have.length', 4)
Expand All @@ -58,7 +58,7 @@ describe('Open wallet', () => {
cy.findByRole('link', { name: /Mnemonic/ }).click()
cy.url().should('include', '/open-wallet/mnemonic')

cy.findByPlaceholderText('Enter your keyphrase here').type(mnemonic, { delay: 1 })
cy.findByPlaceholderText('Enter your mnemonic here').type(mnemonic, { delay: 1 })
cy.findByRole('button', { name: /Import my wallet/ }).click()
cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true })
cy.findAllByTestId('account-choice').should('have.length', 4)
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/scenario-account-switcher.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Scenario : multiple accounts', () => {
// Open account 1 through mnemonic
cy.findByRole('link', { name: /Open wallet/ }).click()
cy.findByRole('link', { name: /Mnemonic/ }).click()
cy.findByPlaceholderText('Enter your keyphrase here').type(
cy.findByPlaceholderText('Enter your mnemonic here').type(
'abuse gown claw final toddler wedding sister parade useful typical spatial skate decrease bulk student manual cloth shove fat car little swamp tag ginger',
{ delay: 0 },
)
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/scenario-transaction.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Scenario : from mnemonic', () => {
cy.visit('/')
cy.findByRole('link', { name: /Open wallet/ }).click()
cy.findByRole('link', { name: /Mnemonic/ }).click()
cy.findByPlaceholderText('Enter your keyphrase here').type(
cy.findByPlaceholderText('Enter your mnemonic here').type(
'abuse gown claw final toddler wedding sister parade useful typical spatial skate decrease bulk student manual cloth shove fat car little swamp tag ginger',
{ delay: 1 },
)
Expand Down
4 changes: 2 additions & 2 deletions playwright/tests/persist.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test.describe('Persist', () => {
test('Should persist multiple mnemonic accounts', async ({ page }) => {
await test.step('Import from mnemonic', async () => {
await page.goto('/open-wallet/mnemonic')
await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic)
await page.getByPlaceholder('Enter your mnemonic here').fill(mnemonic)
await page.getByRole('button', { name: /Import my wallet/ }).click()
await page.getByText('Create a profile').uncheck()
await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 })
Expand Down Expand Up @@ -160,7 +160,7 @@ test.describe('Persist', () => {
}) => {
await page.goto('/open-wallet/mnemonic')

await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic)
await page.getByPlaceholder('Enter your mnemonic here').fill(mnemonic)
await page.getByRole('button', { name: /Import my wallet/ }).click()
await page.getByText('Create a profile').uncheck()
await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('Chromium expect mnemonic, privateKey, and password to NOT leak with preven
}) => {
await test.step('fill sensitive inputs and toggle visibility', async () => {
await page.goto('/open-wallet/mnemonic')
await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic)
await page.getByPlaceholder('Enter your mnemonic here').fill(mnemonic)
await page.getByRole('button', { name: /Import my wallet/ }).click()
await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 })
await page.getByText('Create a profile').uncheck()
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/preventSavingInputsToDisk/firefox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('Firefox expect mnemonic, privateKey, and password to NOT leak with prevent
}) => {
await test.step('fill sensitive inputs (visibility pre-toggled)', async () => {
await page.goto('/open-wallet/mnemonic')
await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic)
await page.getByPlaceholder('Enter your mnemonic here').fill(mnemonic)
// Do not submit form.

const tab2 = await context.newPage()
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/syncTabs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ test.describe('syncTabs', () => {
await page.getByTestId('network-selector').click()
await page.getByRole('menuitem', { name: 'Testnet' }).click()

await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic)
await page.getByPlaceholder('Enter your mnemonic here').fill(mnemonic)
await page.getByRole('button', { name: /Import my wallet/ }).click()
await page.getByText('Create a profile').uncheck()
await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 })
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/toolbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ test.describe('My Accounts tab', () => {

async function openAccountSelectorWithMultipleItems(page: Page) {
await page.goto('/open-wallet/mnemonic')
await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic)
await page.getByPlaceholder('Enter your mnemonic here').fill(mnemonic)
await page.getByRole('button', { name: /Import my wallet/ }).click()
await page.getByText('Create a profile').uncheck()
const uncheckedAccounts = page.getByRole('checkbox', { name: /oasis1/, checked: false })
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/MnemonicValidation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,24 @@ export function MnemonicValidation(props: Props) {
>
<Grid gap="small" pad="none" columns={size === 'small' ? '100%' : ['1fr', '1fr']}>
<Form onSubmit={onSubmit} {...preventSavingInputsToUserData}>
<Header>{t('openWallet.mnemonic.header', 'Enter your keyphrase')}</Header>
<Header>{t('openWallet.mnemonic.header', 'Enter your mnemonic')}</Header>
<Paragraph>
{t(
'openWallet.mnemonic.instruction',
'Enter all your keyphrase words below separated by spaces. Most keyphrases are made of either 24 or 12 words.',
'Enter all your mnemonic words below separated by spaces. Most mnemonics are made of either 24 or 12 words.',
)}
</Paragraph>
<MnemonicField
inputElementId="mnemonic"
placeholder={t('openWallet.mnemonic.enterPhraseHere', 'Enter your keyphrase here')}
placeholder={t('openWallet.mnemonic.enterPhraseHere', 'Enter your mnemonic here')}
autoFocus
value={rawMnemonic}
onChange={onChange}
error={
mnemonicIsValid === false
? t(
'openWallet.mnemonic.error',
'Invalid keyphrase. Please make sure to input the words in the right order, all lowercase.',
'Invalid mnemonic. Please make sure to input the words in the right order, all lowercase.',
)
: ''
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/CreateWalletPage/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('<CreateWalletPage />', () => {
expect(container.firstChild).toMatchSnapshot()
})

it('can regenerate the keyphrase', () => {
it('can regenerate mnemonic', () => {
const { getByText } = renderPage(store)
fireEvent.click(getByText(/createWallet.newMnemonic/))
expect(generateMnemonicMock).toHaveBeenCalledTimes(1)
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/CreateWalletPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,19 @@ export function CreateWalletPage(props: CreateWalletProps) {
<Trans
i18nKey="createWallet.instruction"
t={t}
defaults="Save your keyphrase <strong>in the right order</strong> in a secure location, you will need it to open your wallet."
defaults="Save your mnemonic <strong>in the right order</strong> in a secure location, you will need it to open your wallet."
></Trans>
</Text>
</Box>
<AlertBox status="warning">
{t(
'createWallet.doNotShare',
'Never share your keyphrase, anyone with your keyphrase can access your wallet and your tokens.',
'Never share your mnemonic, anyone with your mnemonic can access your wallet and your tokens.',
)}
</AlertBox>
<Box pad={{ vertical: 'medium' }}>
<CheckBox
label={t('createWallet.confirmSaved', 'I saved my keyphrase')}
label={t('createWallet.confirmSaved', 'I saved my mnemonic')}
disabled={mnemonic.length <= 0}
checked={checked}
onChange={event => setChecked(event.target.checked)}
Expand Down
4 changes: 2 additions & 2 deletions src/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
"validators": "Validatoren"
},
"createWallet": {
"confirmSaved": "Ich habe meine Keyphrase gespeichert.",
"doNotShare": "Gib niemals deine Keyphrase weiter, denn jeder, der deine Keyphrase hat, kann auf deine Wallet und deine Token zugreifen."
"confirmSaved": "Ich habe meine mnemonic gespeichert.",
"doNotShare": "Gib niemals deine mnemonic weiter, denn jeder, der deine mnemonic hat, kann auf deine Wallet und deine Token zugreifen."
},
"delegations": {
"activeDelegations": "Aktive Delegationen",
Expand Down
14 changes: 7 additions & 7 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@
"validators": "Validators"
},
"createWallet": {
"confirmSaved": "I saved my keyphrase",
"doNotShare": "Never share your keyphrase, anyone with your keyphrase can access your wallet and your tokens.",
"instruction": "Save your keyphrase <strong>in the right order</strong> in a secure location, you will need it to open your wallet.",
"confirmSaved": "I saved my mnemonic",
"doNotShare": "Never share your mnemonic, anyone with your mnemonic can access your wallet and your tokens.",
"instruction": "Save your mnemonic <strong>in the right order</strong> in a secure location, you will need it to open your wallet.",
"mnemonicMismatch": "Entered mnemonic does not match.",
"newMnemonic": "Generate a new mnemonic",
"thisIsYourPhrase": "This is your mnemonic"
Expand Down Expand Up @@ -320,11 +320,11 @@
"privateKey": "Private key"
},
"mnemonic": {
"enterPhraseHere": "Enter your keyphrase here",
"error": "Invalid keyphrase. Please make sure to input the words in the right order, all lowercase.",
"header": "Enter your keyphrase",
"enterPhraseHere": "Enter your mnemonic here",
"error": "Invalid mnemonic. Please make sure to input the words in the right order, all lowercase.",
"header": "Enter your mnemonic",
"import": "Import my wallet",
"instruction": "Enter all your keyphrase words below separated by spaces. Most keyphrases are made of either 24 or 12 words."
"instruction": "Enter all your mnemonic words below separated by spaces. Most mnemonics are made of either 24 or 12 words."
},
"privateKey": {
"enterPrivateKeyHere": "Enter your private key here",
Expand Down

0 comments on commit 2cda112

Please sign in to comment.