BlueWallet/class/contact-list.ts

25 lines
556 B
TypeScript
Raw Normal View History

2024-05-15 22:46:54 +01:00
import BIP47Factory from '@spsina/bip47';
2024-05-20 10:54:13 +01:00
2024-05-30 14:54:29 +01:00
import { SilentPayment } from 'silent-payments';
2024-05-15 22:46:54 +01:00
import ecc from '../blue_modules/noble_ecc';
export class ContactList {
2024-05-30 14:54:29 +01:00
isBip47PaymentCodeValid(pc: string) {
2024-05-15 22:46:54 +01:00
try {
BIP47Factory(ecc).fromPaymentCode(pc);
return true;
} catch (_) {
return false;
}
}
2024-05-30 14:54:29 +01:00
isBip352PaymentCodeValid(pc: string) {
return SilentPayment.isPaymentCodeValid(pc);
}
isPaymentCodeValid(pc: string): boolean {
return this.isBip47PaymentCodeValid(pc) || this.isBip352PaymentCodeValid(pc);
}
2024-05-15 22:46:54 +01:00
}