123🦈ปลาฉลามขึ้นบก on Nostr: GM #siamstr ...
GM #siamstr
เมื่อวานผมรู้สึกพูดไม่ค่อยรู้เรื่องตอนอธิบายเรื่อง NIP-07 เลยขอมาแก้ตัวตรงนี้นะครับ
NIP-07 (window.nostr capability for web browsers) ได้มีการนำเสนอเกี่ยวกับ window.nostr โดยมันช่วยให้ เว็บเบราว์เซอร์ หรือ extension และ เว็บไซน์หรือเว็บแอพ สามารถเข้ามามีปฏิสัมพันธ์กับ Nostr ได้
โดยมีฟังก์ชันการทำงานหลัก ๆ 2 อย่างดังนี้:
- window.nostr.getPublicKey(): ใช้ในการขอ Npub (มันส่งกลับในรูป Hex นะครับเผื่อใครไปลองแล้วงงว่าคำไมค่าไม่มีคำว่า npub)
- window.nostr.signEvent(event): ใช้ในการส่ง unsign event ไปยัง extension เพื่อทำการเซ็น
นอกจากนี้ยังมีฟังก์ชันการทำงานอื่น ๆ ที่สามารถทำได้เช่น
- การขอรายการรีเลย์: window.nostr.getRelays(): { [url: string]: {read: boolean, write: boolean} }
จะตอบกลับเป็น รายการรีเลย์และนโยบายของมัน(อณุญาติให้อ่านหรือเขียนมั้ย)
- ตระกูลการส่ง DM:
window.nostr.nip44.encrypt(pubkey, plaintext): string // returns ciphertext as specified in nip-44
window.nostr.nip44.decrypt(pubkey, ciphertext): string // takes ciphertext as specified in nip-44
Published at
2024-06-13 01:39:09Event JSON
{
"id": "018b622ee65386494b4709a32f15e9c267fb7e52947dba8e14512c5d18d1295b",
"pubkey": "66df60562d939ada8612436489945a4ecf1d62346b3d9478dea8a338f3203c64",
"created_at": 1718242749,
"kind": 1,
"tags": [
[
"t",
"siamstr"
]
],
"content": "GM #siamstr\n\nเมื่อวานผมรู้สึกพูดไม่ค่อยรู้เรื่องตอนอธิบายเรื่อง NIP-07 เลยขอมาแก้ตัวตรงนี้นะครับ\nNIP-07 (window.nostr capability for web browsers) ได้มีการนำเสนอเกี่ยวกับ window.nostr โดยมันช่วยให้ เว็บเบราว์เซอร์ หรือ extension และ เว็บไซน์หรือเว็บแอพ สามารถเข้ามามีปฏิสัมพันธ์กับ Nostr ได้\nโดยมีฟังก์ชันการทำงานหลัก ๆ 2 อย่างดังนี้:\n- window.nostr.getPublicKey(): ใช้ในการขอ Npub (มันส่งกลับในรูป Hex นะครับเผื่อใครไปลองแล้วงงว่าคำไมค่าไม่มีคำว่า npub)\n- window.nostr.signEvent(event): ใช้ในการส่ง unsign event ไปยัง extension เพื่อทำการเซ็น\n นอกจากนี้ยังมีฟังก์ชันการทำงานอื่น ๆ ที่สามารถทำได้เช่น\n- การขอรายการรีเลย์: window.nostr.getRelays(): { [url: string]: {read: boolean, write: boolean} } \nจะตอบกลับเป็น รายการรีเลย์และนโยบายของมัน(อณุญาติให้อ่านหรือเขียนมั้ย)\n- ตระกูลการส่ง DM: \nwindow.nostr.nip44.encrypt(pubkey, plaintext): string // returns ciphertext as specified in nip-44\nwindow.nostr.nip44.decrypt(pubkey, ciphertext): string // takes ciphertext as specified in nip-44",
"sig": "06c5b871e62e69c1424c414e19d8648c701e0cc2246e2870b03526d4a05bdb37b17b92bdcefd042b5d80a5a170031430bf4220f39b4237ef8900a6e272e0ce03"
}