@spirobel/monero-wallet-api 0.3.12 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ScanSettingOpened } from "../api";
|
|
1
2
|
export declare const TOOL_MAGIC_STRING = "monerochan";
|
|
2
3
|
export declare function parseToolLink(link: string): MoneroTool | null;
|
|
3
4
|
export type ToolInvocationValidity = "valid" | "invalid" | "unverified";
|
|
@@ -62,5 +63,5 @@ export type ShareViewkey002Pruned = {
|
|
|
62
63
|
primary_address: string;
|
|
63
64
|
wallet_slot: number;
|
|
64
65
|
};
|
|
65
|
-
export declare function potentialSuccessRedirect002(payload: ShareViewkeyPayload): Promise<
|
|
66
|
-
export declare function handle002ShareRequest(req: Request, parsed_cb: (parsed_body: ShareViewkey002Pruned) => Promise<void>, successUrl?: string): Promise<ShareViewkeyResult>;
|
|
66
|
+
export declare function potentialSuccessRedirect002(payload: ShareViewkeyPayload): Promise<ShareViewkeyResult | undefined>;
|
|
67
|
+
export declare function handle002ShareRequest(req: Request, wallets: ScanSettingOpened[], parsed_cb: (parsed_body: ShareViewkey002Pruned) => Promise<void>, successUrl?: string): Promise<ShareViewkeyResult>;
|
|
@@ -221,9 +221,12 @@ export async function potentialSuccessRedirect002(payload) {
|
|
|
221
221
|
window.location.href = shareVKresult.successUrl;
|
|
222
222
|
window.location.reload();
|
|
223
223
|
}
|
|
224
|
+
else {
|
|
225
|
+
return shareVKresult;
|
|
226
|
+
}
|
|
224
227
|
}
|
|
225
228
|
// backend response
|
|
226
|
-
export async function handle002ShareRequest(req, parsed_cb, successUrl) {
|
|
229
|
+
export async function handle002ShareRequest(req, wallets, parsed_cb, successUrl) {
|
|
227
230
|
try {
|
|
228
231
|
const json_body = await req.json();
|
|
229
232
|
const { viewkey, primary_address, wallet_slot } = json_body;
|
|
@@ -234,6 +237,12 @@ export async function handle002ShareRequest(req, parsed_cb, successUrl) {
|
|
|
234
237
|
typeof wallet_slot !== "number") {
|
|
235
238
|
return { ok: false, successUrl: null };
|
|
236
239
|
}
|
|
240
|
+
const foundSlot = wallets.find((wallet) => wallet.wallet_slot === wallet_slot);
|
|
241
|
+
if (foundSlot) {
|
|
242
|
+
if (foundSlot.primary_address !== primary_address) {
|
|
243
|
+
return { ok: false, successUrl: null };
|
|
244
|
+
}
|
|
245
|
+
}
|
|
237
246
|
await parsed_cb({ viewkey, primary_address, wallet_slot });
|
|
238
247
|
return {
|
|
239
248
|
ok: true,
|