feat: feed feature, typescript, remove google, fix errs & warns
publish / Build-and-publish (push) Successful in 13m32s
publish / Build-and-publish (push) Successful in 13m32s
This commit is contained in:
@@ -34,7 +34,7 @@ export class NostrController extends EventEmitter {
|
||||
/**
|
||||
* Function will publish provided event to the provided relays
|
||||
*/
|
||||
publishEvent = async (event: Event, relays: string[]) => {
|
||||
publishEvent = async (event: Event, relays: string[]): Promise<string[]> => {
|
||||
const simplePool = new SimplePool()
|
||||
const promises = simplePool.publish(relays, event)
|
||||
|
||||
@@ -47,7 +47,7 @@ export class NostrController extends EventEmitter {
|
||||
})
|
||||
|
||||
if (publishedRelays.length === 0) {
|
||||
const failedPublishes: any[] = []
|
||||
const failedPublishes: Array<{ relay: string; error: string }> = []
|
||||
const fallbackRejectionReason =
|
||||
'Attempt to publish an event has been rejected with unknown reason.'
|
||||
|
||||
@@ -92,7 +92,7 @@ export class NostrController extends EventEmitter {
|
||||
return Promise.resolve(signedEvent)
|
||||
}
|
||||
|
||||
nip04Encrypt = async (receiver: string, content: string) => {
|
||||
nip04Encrypt = async (receiver: string, content: string): Promise<string> => {
|
||||
if (!this.generatedKeys) {
|
||||
throw new Error(`Private & public key pair is not found.`)
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class NostrController extends EventEmitter {
|
||||
* @param isSigner Boolean indicating whether the recipient is a signer or viewer.
|
||||
* @param setAuthUrl Function to set the authentication URL in the component state.
|
||||
*/
|
||||
sendDM = async (pubkey: string, message: string) => {
|
||||
sendDM = async (pubkey: string, message: string): Promise<string[]> => {
|
||||
// Set up timeout promise to handle encryption timeout
|
||||
const timeoutPromise = new Promise<never>((_, reject) => {
|
||||
setTimeout(() => {
|
||||
@@ -159,7 +159,7 @@ export class NostrController extends EventEmitter {
|
||||
* @param hexKey hex private or public key
|
||||
* @returns whether or not is key valid
|
||||
*/
|
||||
validateHex = (hexKey: string) => {
|
||||
validateHex = (hexKey: string): RegExpMatchArray | null => {
|
||||
return hexKey.match(/^[a-f0-9]{64}$/)
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export class NostrController extends EventEmitter {
|
||||
return { private: nip19.nsecEncode(nsec), public: getPublicKey(nsec) }
|
||||
}
|
||||
|
||||
verifySignedEvent = (event: SignedEvent) => {
|
||||
verifySignedEvent = (event: SignedEvent): void => {
|
||||
const isGood = verifyEvent(event)
|
||||
|
||||
if (!isGood) {
|
||||
|
||||
Reference in New Issue
Block a user