Skip to content

Commit

Permalink
Merge branch 'master' into feat/nwc-custom-records
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz authored Jul 4, 2024
2 parents d853821 + eb3e895 commit 8f1b157
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 59 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"dependencies": {
"@bitcoinerlab/secp256k1": "^1.1.1",
"@getalby/sdk": "^3.5.0",
"@getalby/sdk": "^3.6.0",
"@headlessui/react": "^1.7.18",
"@lightninglabs/lnc-web": "^0.3.1-alpha",
"@noble/ciphers": "^0.5.1",
Expand Down
6 changes: 4 additions & 2 deletions src/app/screens/Accounts/Detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function AccountDetail() {

const { account: accountInfo } = useAccount();

// lightning address is returned for current active account
const lightningAddress = accountInfo?.lightningAddress || "";

const [account, setAccount] = useState<GetAccountRes | null>(null);
Expand All @@ -70,7 +71,6 @@ function AccountDetail() {
url: "",
lnAddress: "",
});
const { account: authAccount } = useAccount();

async function exportAccount({ id, name }: AccountAction) {
setExportLoading(true);
Expand Down Expand Up @@ -238,8 +238,10 @@ function AccountDetail() {
/>
</div>
</form>
{/* show lnaddress setting only for OAuth accounts and active account settings */}
{lightningAddress &&
isAlbyOAuthAccount(authAccount?.connectorType) && (
isAlbyOAuthAccount(account.connectorType) &&
account.id === auth.account?.id && (
<>
<MenuDivider />
<div className="flex flex-col sm:flex-row justify-between items-center">
Expand Down
32 changes: 20 additions & 12 deletions src/extension/background-script/actions/nostr/enable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "~/types";

import { addPermissionFor } from "~/extension/background-script/permissions";
import { EventKind } from "~/extension/providers/nostr/types";
import state from "../../state";
import { ExtensionIcon, setIcon } from "../setup/setIcon";

Expand Down Expand Up @@ -108,20 +109,27 @@ const enable = async (message: MessageAllowanceEnable, sender: Sender) => {
});

// Add specific signing permissions

const reasonableEventKindIds = [
0, // Update profile
1, // Short text note
3, // Update follow list
4, // Encrypted direct messages
7, // Reaction
9734, // Zap request
10002, // Relay list metadata
22242, // Client relay authentication
30023, // Long-form content
30008, // Manage profile badges
30009, // Badge definition
30078, // App Data
EventKind.Metadata,
EventKind.Text,
EventKind.Contacts,
EventKind.DM,
EventKind.Repost,
EventKind.React,
EventKind.ZapRequest,
EventKind.MuteList,
EventKind.RelayList,
EventKind.Bookmarks,
EventKind.Authenticate,
EventKind.HTTPAuth,
EventKind.LongNote,
EventKind.ProfileBadge,
EventKind.CreateBadge,
EventKind.AppData,
EventKind.UploadChunk,
];

reasonableEventKindIds.forEach(async (kindId) => {
await addPermissionFor(
PermissionMethodNostr.NOSTR_SIGNMESSAGE + "/" + kindId,
Expand Down
16 changes: 11 additions & 5 deletions src/extension/background-script/connectors/lndhub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,17 @@ export default class LndHub implements Connector {

return authData;
} catch (e) {
throw new Error(
`API error (${this.config.url})${
e instanceof Error ? `: ${e.message}` : ""
}`
);
let error = "";
if (axios.isAxiosError(e)) {
const data = e.response?.data as
| { reason?: string; message?: string }
| undefined;
error = data?.reason || data?.message || e.message;
} else if (e instanceof Error) {
error = e.message;
}

throw new Error(`API error (${this.config.url}) ${error}`);
}
}

Expand Down
19 changes: 19 additions & 0 deletions src/extension/providers/nostr/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,26 @@ export enum EventKind {
Contacts = 3,
DM = 4,
Deleted = 5,
Repost = 6,
React = 7,
AwardBadge = 8,
CreateChannel = 40,
UpdateChannel = 41,
SendChannelMessage = 42,
HideChannelMessage = 43,
MuteChannelUser = 44,
ReportNote = 1984,
ZapRequest = 9734,
ZapReceipt = 9735,
MuteList = 10000,
RelayList = 10002,
Bookmarks = 10003,
Authenticate = 22242,
RemoteSign = 24133,
HTTPAuth = 27235,
ProfileBadge = 30008,
CreateBadge = 30009,
LongNote = 30023,
AppData = 30078,
UploadChunk = 10000135,
}
9 changes: 9 additions & 0 deletions src/i18n/locales/ar/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"translation": {
"welcome": {
"set_password": {
"title": "تعيين رمز المرور لفتح الامتداد"
}
}
}
}
34 changes: 23 additions & 11 deletions src/i18n/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
"successfully_removed": "Der private Schlüssel von Nostr wurde erfolgreich entfernt.",
"label": "Nostr Privater Schlüssel",
"failed_to_remove": "Der eingegebene Kontoname stimmt nicht überein, dein alter privater Nostr-Schlüssel wurde wiederhergestellt.",
"warning": "Bitte gebe den Namen des Kontos ein, um die Löschung des privaten Schlüssels von nostr zu bestätigen:\n\n{{ Name }}"
"warning": "Bist du dir sicher, dass du deinen privaten nostr-Schlüssel entfernen möchten?\n\nGebe \"{{Name}}\" zur Bestätigung ein:"
},
"public_key": {
"label": "Nostr Öffentlicher Schlüssel"
Expand Down Expand Up @@ -529,9 +529,9 @@
},
"remove": {
"error": "Der eingegebene Kontoname stimmte nicht überein.",
"confirm": "Bitte gebe den Namen des Kontos ein, um die Löschung deines Kontos zu bestätigen:\n\n{{ Name }}\n\n⚠️ Wenn du fortfährst, werden alle zugehörigen Schlüssel (Hauptschlüssel, Nostr, etc.) gelöscht. Bitte vergewissern dich, dass du eine Sicherungskopie erstellt hast, denn es gibt keine andere Möglichkeit, sie wiederherzustellen.",
"subtitle": "Alle verknüpften Zertifikate werden gelöscht. Bitte sei dir sicher.",
"title": "Diese Wallet entfernen"
"title": "Diese Wallet entfernen",
"confirm": "Bist du dir sicher, dass du deine Wallet entfernen willst?\n\n⚠️ Wenn du fortfährst, werden alle zugehörigen Schlüssel (Master Key, Nostr, etc.) gelöscht. Bitte vergewisserne dich, dass du eine Sicherungskopie erstellt hast, denn es gibt keine andere Möglichkeit, sie wiederherzustellen.\n\n\nGebe \"{{Name}}\" zur Bestätigung ein:"
},
"actions": {
"export": "Exportieren",
Expand Down Expand Up @@ -599,8 +599,8 @@
"remove_secretkey": {
"title": "Hauptschlüssel entfernen",
"success": "Der Hauptschlüssel wurde erfolgreich entfernt.",
"confirm": "Bitte gebe den Namen des Kontos ein, um die Löschung deines Hauptschlüssels zu bestätigen:\n\n{{ Name }}",
"subtitle": "Entfernt den Hauptschlüssel aus dieser Wallet."
"subtitle": "Entfernt den Hauptschlüssel aus dieser Wallet.",
"confirm": "Bist du dir sicher, dass du deinen Hauptschlüssel entfernen möchten?\n\nGebe zur Bestätigung \"{{ Name }}\" ein:"
},
"network": {
"options": {
Expand Down Expand Up @@ -729,6 +729,10 @@
"title": "Notiz löschen",
"description": "Relays zum Löschen eines Ereignisses auffordern"
},
"6": {
"title": "umbuchen",
"description": "Eine Notiz neu veröffentlichen"
},
"7": {
"title": "reagieren",
"description": "Unterschreibe eine Reaktion auf eine Notiz"
Expand Down Expand Up @@ -797,17 +801,25 @@
"title": "Anwendungsdaten",
"description": "Anwendungsspezifische Daten unterschreiben"
},
"10000135": {
"description": "Hochladen von Daten in Stücken",
"title": "Chunk hochladen"
},
"unknown": {
"description": "Nicht identifizierte Aktion",
"title": "Art {{kind}}"
},
"6": {
"title": "umbuchen",
"description": "Eine Notiz neu veröffentlichen"
"10000": {
"title": "Stummschaltungsliste",
"description": "Blockiert Spammer und schlechte Schauspieler aus deinem Feed"
},
"10000135": {
"description": "Hochladen von Daten in Stücken",
"title": "Chunk hochladen"
"10003": {
"description": "Lesezeichen für Benutzerbeiträge",
"title": "Lesezeichen"
},
"27235": {
"title": "HTTP-Authentifizierung",
"description": "HTTP Authentifizierung"
}
},
"allow": "Erlaube {{Herausgeber}} zu {{Aktion}}"
Expand Down
19 changes: 15 additions & 4 deletions src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@
"private_key": {
"title": "Manage your Nostr private key",
"subtitle": "Paste your nostr private key or generate a new one. <0>Learn more »</0>",
"warning": "Please enter the name of the account to confirm the deletion of your nostr private key:\n\n{{ name }}",
"warning": "Are you sure you want to remove your nostr private key?\n\nType \"{{name}}\" to confirm:",
"success": "Nostr private key encrypted & saved successfully.",
"failed_to_remove": "The entered account name didn't match, your old Nostr private key has been restored.",
"successfully_removed": "Nostr private key removed successfully.",
Expand Down Expand Up @@ -569,13 +569,13 @@
"remove": {
"title": "Remove This Wallet",
"subtitle": "All the linked allowances will be deleted. Please be certain.",
"confirm": "Please enter the name of the account to confirm the deletion of your account:\n\n{{ name }}\n\n ⚠️ All associated keys (Master Key, Nostr, etc) will be deleted if you continue. Please make sure you have backed them up, there is no other way to restore them.",
"confirm": "Are you sure you want to remove your wallet?\n\n⚠️ All associated keys (Master Key, Nostr, etc) will be deleted if you continue. Please make sure you have backed them up, there is no other way to restore them.\n\nType \"{{name}}\" to confirm:",
"error": "The entered account name didn't match."
},
"remove_secretkey": {
"title": "Remove Master Key",
"subtitle": "Removes the Master Key from this wallet.",
"confirm": "Please enter the name of the account to confirm the deletion of your Master Key:\n\n{{ name }}",
"confirm": "Are you sure you want to remove your Master Key?\n\nType \"{{ name }}\" to confirm:",
"success": "Successfully removed the Master Key."
},
"actions": {
Expand Down Expand Up @@ -1039,10 +1039,18 @@
"title": "zap receipt",
"description": "Display a confirmation of a paid lightning invoice"
},
"10000": {
"title": "mute list",
"description": "Blocks spammers and bad actors from your feed"
},
"10002": {
"title": "relay list",
"description": "Update preferred relays for discovering your notes and receiving others' notes"
},
"10003": {
"title": "bookmarks",
"description": "Bookmark user posts"
},
"22242": {
"title": "authenticate",
"description": "Authenticate to a relay"
Expand All @@ -1051,6 +1059,10 @@
"title": "remote sign",
"description": "Request and sign events remotely"
},
"27235": {
"title": "HTTP Auth",
"description": "HTTP Authentication"
},
"30008": {
"title": "profile badge",
"description": "Accept, reject and change display order of awarded badges"
Expand Down Expand Up @@ -1339,7 +1351,6 @@
"title": "encrypt",
"description": "Encrypt data"
},

"signmessage": {
"title": "sign message",
"description": "Sign all nostr events"
Expand Down
3 changes: 0 additions & 3 deletions src/i18n/locales/fa/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@
"private_key": {
"title": "کلیدخصوصی ناستر خود را مدیریت کنید",
"subtitle": "لطفا کلید خصوصی ناسترتان را بچسبانید یا یکی جدید بسازید. <0>بیشتر بدانید</0>",
"warning": "لطفا برای تایید حذف کلید خصوصی ناسترتان، نام حساب کاربری را وارد کنید:\n\n{{ name }}",
"success": "کلید خصوصی ناستر با موفقیت رمزنگاری و ذخیره شد.",
"failed_to_remove": "نام حساب کاربری وارد شده مطابقت ندارد، ‬کلید خصوصی قدیمی ناستر شما بازیابی شده است.",
"successfully_removed": "کلید خصوصی ناستر با موفقیت حذف شد.",
Expand Down Expand Up @@ -449,7 +448,6 @@
}
},
"remove": {
"confirm": "لطفا نام حساب کاربری را وارد کنید تا حذف حساب تان را تایید کنید:\n\n{{ name }}\n\n.⚠️ اگر ادامه دهید تمام کلیدهای مرتبط (کلید اصلی، ناستر و غیره) حذف خواهند شد. لطفا مطمئن شوید که حتما آنها را جایی ذخیره کرده اید، هیچ راه دیگری برای بازپس گیری آنها وجود ندارد.",
"error": "نام حساب کاربری وارد شده مطابقت نداشت."
},
"actions": {
Expand Down Expand Up @@ -512,7 +510,6 @@
},
"remove_secretkey": {
"title": "حذف کلید اصلی",
"confirm": "لطفا برای تایید حذف کلید اصلی، نام حساب کاربری را وارد کنید:\n\n{{ name }}",
"success": "کلید اصیل با موفقیت حذف شد."
},
"network": {
Expand Down
3 changes: 0 additions & 3 deletions src/i18n/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@
"failed_to_remove": "दर्ज किया गया खाता नाम मेल नहीं खाता, आपका पुराना नोस्ट्र प्राइवेट की पुनर्स्थापित किया गया है।",
"title": "अपनी Nostr प्राइवेट की प्रबंधित करें",
"label": "Nostr प्राइवेट की",
"warning": "कृपया अपनी nostr प्राइवेट की को हटाने की पुष्टि करने के लिए खाते का नाम दर्ज करें:\n\n{{ name }}",
"successfully_removed": "नोस्ट्र प्राइवेट की सफलतापूर्वक हटा दी गई।",
"subtitle": "अपनी नोस्ट्रप्राइवेट की पेस्ट करे या एक नई कुंजी बनाएँ। <0>और जानें »</0>",
"success": "Nostr प्राइवेट की एन्क्रिप्ट की गई और सफलतापूर्वक सहेजी गई।"
Expand Down Expand Up @@ -651,11 +650,9 @@
}
},
"remove": {
"confirm": "कृपया अपने खाते को हटाए जाने की पुष्टि करने के लिए खाते का नाम दर्ज करें:\n\n{{ name }}\n\n⚠️ यदि आप जारी रखते हैं तो सभी संबद्ध कुंजियाँ (मास्टर की, नोस्ट्र, आदि) हटा दी जाएंगी। कृपया सुनिश्चित करें कि आपने उनका बैकअप ले लिया है, उन्हें पुनर्स्थापित करने का कोई अन्य तरीका नहीं है।",
"error": "दर्ज किया गया खाता नाम मेल नहीं खाता।"
},
"remove_secretkey": {
"confirm": "कृपया अपने मास्टर की को हटाने की पुष्टि करने के लिए खाते का नाम दर्ज करें:\n\n{{ name }}",
"success": "मास्टर की को सफलतापूर्वक हटा दिया गया।",
"title": "मास्टर की को हटाएँ"
},
Expand Down
1 change: 0 additions & 1 deletion src/i18n/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@
"label": "Nostr秘密鍵",
"failed_to_remove": "入力されたアカウントネームは一致しませんでした。Nostr秘密鍵は戻されました。",
"title": "Nostr秘密鍵の管理",
"warning": "Nostr秘密鍵の削除を確定するためにアカウントネームを入力してください:",
"success": "Nostr秘密鍵は暗号化して保存されました",
"subtitle": "Nostr秘密鍵をペーストするか新しい鍵を生成する<0>もっと詳しく知る</0>"
},
Expand Down
11 changes: 4 additions & 7 deletions src/i18n/locales/pt_BR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@
"label": "Chave privada Nostr",
"subtitle": "Cole sua chave privada Nostr ou gere uma nova. <0>Saiba mais »</0>",
"success": "Chave privada Nostr criptografada e salva com sucesso.",
"failed_to_remove": "O nome da conta inserido não está correto, sua chave privada Nostr antiga foi restaurada.",
"warning": "Por favor, insira o nome da conta para confirmar a exclusão de sua chave privada nostr:\n\n{{ name }}"
"failed_to_remove": "O nome da conta inserido não está correto, sua chave privada Nostr antiga foi restaurada."
},
"public_key": {
"label": "Chave pública Nostr"
Expand Down Expand Up @@ -397,7 +396,6 @@
},
"remove": {
"error": "O nome da conta inserido não corresponde.",
"confirm": "Por favor, insira o nome da conta para confirmar a exclusão:\n\n{{ name }}\n\n ⚠️ Por favor, insira o nome da conta para confirmar a exclusão. Todas as chaves associadas (Chave mestra, Nostr, etc) serão excluídas se você continuar. Certifique-se de ter feito backup das chaves, não há outra maneira de restaurá-las.",
"title": "Remover esta carteira"
},
"actions": {
Expand Down Expand Up @@ -469,7 +467,6 @@
"remove_secretkey": {
"title": "Remover chave mestra",
"success": "Chave mestra removida com sucesso.",
"confirm": "Por favor, insira o nome da conta para confirmar a exclusão de sua chave mestra:\n\n{{ name }}",
"subtitle": "Remove a chave mestra desta conta."
},
"network": {
Expand Down Expand Up @@ -736,6 +733,9 @@
"1": {
"title": "nota curta"
},
"3": {
"title": "atualizar lista de seguidores"
},
"4": {
"title": "mensagem direta"
},
Expand All @@ -744,9 +744,6 @@
},
"30023": {
"title": "nota longa"
},
"3": {
"title": "atualizar lista de seguidores"
}
}
},
Expand Down
Loading

0 comments on commit 8f1b157

Please sign in to comment.