fix amber and serial port signers

This commit is contained in:
hzrd149 2024-11-18 10:57:32 -06:00
parent 1fa3e6573f
commit 1461511c5d
5 changed files with 8 additions and 28 deletions

View File

@ -1,4 +1,4 @@
import { AmberClipboardSigner } from "applesauce-signer";
import { AmberClipboardSigner } from "applesauce-signer/signers/amber-clipboard-signer";
import { Account } from "./account";
export default class AmberAccount extends Account {
@ -15,5 +15,6 @@ export default class AmberAccount extends Account {
constructor(pubkey: string) {
super(pubkey);
this.signer = new AmberClipboardSigner();
this.signer.pubkey = pubkey;
}
}

View File

@ -1,4 +1,4 @@
import { SerialPortSigner } from "applesauce-signer";
import { SerialPortSigner } from "applesauce-signer/signers/serial-port-signer";
import { Account } from "./account";
export default class SerialPortAccount extends Account {
@ -14,5 +14,6 @@ export default class SerialPortAccount extends Account {
constructor(pubkey: string) {
super(pubkey);
this.signer = new SerialPortSigner();
this.signer.pubkey = pubkey;
}
}

View File

@ -1,8 +0,0 @@
import { AmberClipboardSigner } from "applesauce-signer";
import { alwaysVerify } from "./verify-event";
/** @deprecated use AmberClipboardSigner class instead */
const amberSignerService = new AmberClipboardSigner();
amberSignerService.verifyEvent = alwaysVerify;
export default amberSignerService;

View File

@ -1,14 +0,0 @@
import { SerialPortSigner } from "applesauce-signer";
import { alwaysVerify } from "./verify-event";
/** @deprecated use SerialPortSigner class instead */
const serialPortService = new SerialPortSigner();
serialPortService.verifyEvent = alwaysVerify;
setInterval(() => {
if (serialPortService.isConnected) {
serialPortService.ping();
}
}, 1000 * 10);
export default serialPortService;

View File

@ -9,8 +9,6 @@ import UsbFlashDrive from "../../components/icons/usb-flash-drive";
import HelpCircle from "../../components/icons/help-circle";
import accountService from "../../services/account";
import serialPortService from "../../services/serial-port";
import amberSignerService from "../../services/amber-signer";
import { AtIcon } from "../../components/icons";
import Package from "../../components/icons/package";
import Eye from "../../components/icons/eye";
@ -47,7 +45,8 @@ export default function LoginStartView() {
try {
setLoading(true);
const pubkey = await serialPortService.getPublicKey();
const signer = new SerialPortSigner();
const pubkey = await signer.getPublicKey();
accountService.addAccount(new SerialPortAccount(pubkey));
accountService.switchAccount(pubkey);
} catch (e) {
@ -61,7 +60,8 @@ export default function LoginStartView() {
const signinWithAmber = async () => {
try {
const pubkey = await amberSignerService.getPublicKey();
const signer = new AmberClipboardSigner();
const pubkey = await signer.getPublicKey();
accountService.addAccount(new AmberAccount(pubkey));
accountService.switchAccount(pubkey);
} catch (e) {