Compare commits
7 commits
a2366c40f2
...
b519c0e447
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b519c0e447 | ||
|
|
63e5d2c9dc | ||
|
|
17b84612fa | ||
|
|
ed9b19641a | ||
|
|
b628201986 | ||
|
|
7dfd8c7924 | ||
|
|
bed6619be9 |
7 changed files with 1870 additions and 1127 deletions
|
|
@ -2,21 +2,3 @@
|
|||
.github
|
||||
build
|
||||
node_modules
|
||||
|
||||
# Runtime state files (should not be baked into image)
|
||||
*.sqlite
|
||||
*.sqlite-journal
|
||||
*.sqlite-wal
|
||||
*.sqlite-shm
|
||||
*.db
|
||||
admin.connect
|
||||
admin.enroll
|
||||
admin.npub
|
||||
app.nprofile
|
||||
.jwt_secret
|
||||
|
||||
# Runtime data directories
|
||||
metric_cache/
|
||||
metric_events/
|
||||
bundler_events/
|
||||
logs/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
FROM node:20
|
||||
FROM node:18
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
|
|||
2936
package-lock.json
generated
2936
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -77,7 +77,6 @@
|
|||
"zip-a-folder": "^3.1.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"@types/chai": "^4.3.4",
|
||||
"@types/chai-string": "^1.4.5",
|
||||
"@types/cors": "^2.8.17",
|
||||
|
|
@ -94,4 +93,4 @@
|
|||
"typescript": "5.5.4"
|
||||
},
|
||||
"overrides": {}
|
||||
}
|
||||
}
|
||||
|
|
@ -241,8 +241,6 @@ export default class {
|
|||
const paid = await this.paymentManager.PayInvoice(appUser.user.user_id, req, app, {
|
||||
ack: pendingOp => { this.notifyAppUserPayment(appUser, pendingOp) }
|
||||
})
|
||||
// Refresh appUser balance from DB so notification has accurate latest_balance
|
||||
appUser.user.balance_sats = paid.latest_balance
|
||||
this.notifyAppUserPayment(appUser, paid.operation)
|
||||
getLogger({ appName: app.name })(appUser.identifier, "invoice paid", paid.amount_paid, "sats")
|
||||
return paid
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import { base64, hex } from "@scure/base";
|
||||
import { base64 } from "@scure/base";
|
||||
import { randomBytes } from "@noble/hashes/utils";
|
||||
import { streamXOR as xchacha20 } from "@stablelib/xchacha20";
|
||||
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
||||
import { secp256k1 } from "@noble/curves/secp256k1";
|
||||
import { sha256 } from "@noble/hashes/sha256";
|
||||
export type EncryptedData = {
|
||||
ciphertext: Uint8Array;
|
||||
nonce: Uint8Array;
|
||||
}
|
||||
export const getSharedSecret = (privateKey: string, publicKey: string) => {
|
||||
const key = secp256k1.getSharedSecret(hex.decode(privateKey), hex.decode("02" + publicKey));
|
||||
const key = secp256k1.getSharedSecret(privateKey, "02" + publicKey);
|
||||
return sha256(key.slice(1, 33));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,24 +205,20 @@ export class NostrPool {
|
|||
const log = getLogger({ appName: keys.name })
|
||||
this.log(`📤 Publishing Kind ${event.kind} event to ${relays.length} relay(s): ${relays.join(', ')}`)
|
||||
const pool = new SimplePool()
|
||||
try {
|
||||
await Promise.all(pool.publish(relays, signed).map(async p => {
|
||||
try {
|
||||
await p
|
||||
sent = true
|
||||
} catch (e: any) {
|
||||
this.log(ERROR, `Failed to publish Kind ${event.kind} event:`, e.message || e)
|
||||
log(e)
|
||||
}
|
||||
}))
|
||||
if (!sent) {
|
||||
this.log(ERROR, `Failed to send Kind ${event.kind} event to any relay`)
|
||||
log("failed to send event")
|
||||
} else {
|
||||
this.log(`✅ Kind ${event.kind} event published successfully (id: ${signed.id.slice(0, 16)}...)`)
|
||||
await Promise.all(pool.publish(relays, signed).map(async p => {
|
||||
try {
|
||||
await p
|
||||
sent = true
|
||||
} catch (e: any) {
|
||||
this.log(ERROR, `Failed to publish Kind ${event.kind} event:`, e.message || e)
|
||||
log(e)
|
||||
}
|
||||
} finally {
|
||||
pool.close(relays)
|
||||
}))
|
||||
if (!sent) {
|
||||
this.log(ERROR, `Failed to send Kind ${event.kind} event to any relay`)
|
||||
log("failed to send event")
|
||||
} else {
|
||||
this.log(`✅ Kind ${event.kind} event published successfully (id: ${signed.id.slice(0, 16)}...)`)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue