Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ente-auth extension #15354

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion extensions/ente-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Ente Auth Changelog

## [Bug fix] - 2024-11-13
- Added PR-15036 changes contributed by albarin

## [New Additions] - 2024-11-13

- Add the ability to change preferred actions; e.g. (paste or copy on enter)

## [Bug fix] - 2024-08-28
- Fix error in `Get TOPT` command when secrets are empty

## [Initial Version] - 2024-08-28
## [Initial Version] - 2024-08-28
15 changes: 13 additions & 2 deletions extensions/ente-auth/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# A Raycast extension that uses your Ente Auth exports

## Features

- Imports: Ability to dynamically import secrets
- TOTP Code Display: Fetches and displays TOTP secrets exported from Ente Auth.
- Sorted Data: Most used TOTP codes will be displayed at the top. Use ⌘ + [Number] to select.
Expand All @@ -12,7 +13,6 @@

## Usage

> [!NOTE]
> The Ente Auth [CLI](https://github.com/ente-io/ente/tree/main/cli) is required.

## Setup
Expand All @@ -21,14 +21,25 @@ As explained [here](https://github.com/ente-io/ente/tree/main/cli#accounts), run
`ente account add` to login into an existing account. If you wish to update your account information, run the below:
```ente account update --app auth --email <email> --dir <path>```.

#### Adding your account

As explained [here](https://github.com/ente-io/ente/tree/main/cli#accounts), run:
`ente account add` to login into an existing account.
If you wish to update your account information, run the below:
`ente account update --app auth --email <email> --dir <path>`.

## Next Steps

#### Using Raycast

- Run `Export Secrets`. This will create a `~/Documents/ente` directory and a file named `ente_auth.txt`.
- Run `Import Secrets`. This will import all serialized items into Raycast encrypted database.

#### Using Ente
To perform a manual import, run: ```ente export```, then run `Import Secrets`.

To perform a manual import, run: `ente export`, then run `Import Secrets`.
Or perform the same actions but through the UI as long as the file is placed in the `~/Documents/ente` folder.

## Optionally

You can delete exported secrets from it's exported path by using `Delete Export`.
28 changes: 28 additions & 0 deletions extensions/ente-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
"categories": [
"Security"
],
"keywords": [
"ente",
"totp",
"2fa",
"security",
"authentication",
"otp",
"mfa",
"authenticator"
],
"license": "MIT",
"commands": [
{
Expand Down Expand Up @@ -54,6 +64,24 @@
"title": "Ente CLI Export Location",
"description": "If you wish to change the default export path, type here the location of your local installation.",
"placeholder": "Export Path"
},
{
"name": "action",
"type": "dropdown",
"title": "Primary Action",
"description": "Choose whether the primary action should copy or paste the output.",
"data": [
{
"title": "Copy",
"value": "copy"
},
{
"title": "Paste",
"value": "paste"
}
],
"default": "paste",
"required": false
}
],
"dependencies": {
Expand Down
34 changes: 21 additions & 13 deletions extensions/ente-auth/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { JsonFormat } from "./helpers/types";
import { getJsonFormatFromStore } from "./helpers";
import { useFrecencySorting } from "@raycast/utils";
import { getProgressIcon, getFavicon } from "@raycast/utils";
import { ActionPanel, Action, List, Icon } from "@raycast/api";
import { ActionPanel, Action, List, Icon, getPreferenceValues } from "@raycast/api";

// Ente colors - purple #A400B6, orange #FF9800
const getProgressColor = (remainingTime: number) => {
Expand Down Expand Up @@ -49,9 +49,28 @@ export default function Command() {
const Label = Metadata.Label;
const Separator = Metadata.Separator;

const PreferredAction = getPreferenceValues().action;

return (
<List navigationTitle="Get TOTP" searchBarPlaceholder="Search..." isShowingDetail>
{secrets.map((item, index) => {
const userActions = [
<Action.CopyToClipboard
key="copy"
title="Copy Current"
icon={Icon.Key}
content={item.current_totp}
onCopy={() => visitItem(item)}
/>,
<Action.Paste
key="paste"
title="Paste Current"
icon={Icon.Key}
content={item.current_totp}
onPaste={() => visitItem(item)}
/>,
];

return (
<List.Item
key={index}
Expand Down Expand Up @@ -96,18 +115,7 @@ export default function Command() {
actions={
<ActionPanel>
<ActionPanel.Section title="Current">
<Action.Paste
title="Paste TOTP"
icon={Icon.Clipboard}
content={item.current_totp}
onPaste={() => visitItem(item)}
/>
<Action.CopyToClipboard
title="Copy Current"
icon={Icon.Key}
content={item.current_totp}
onCopy={() => visitItem(item)}
/>
{PreferredAction === "copy" ? userActions : userActions.toReversed()}
</ActionPanel.Section>
<ActionPanel.Section title="Next">
<Action.CopyToClipboard
Expand Down