Giter VIP home page Giter VIP logo

nostr-sdk-ios's People

Contributors

bryanmontz avatar dcadenas avatar joelklabo avatar pavlekreator avatar tyiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nostr-sdk-ios's Issues

Make decoding of Tags fail gracefully against malformed data

It's possible that a Nostr event with malformed tags gets created. We should make the SDK resilient against this kind of data.

A proper tags subarray might look something like this:
["e", "hex-event-id"] or ["e", "hex-event-id", "other parameter"]

Examples of bad data that we should defend against:

  • tags subarray is empty (i.e. [])
  • tags subarray has only the tag name and no other value or parameters (e.g. ["e"])
  • tags subarray has a tag name that is not a string (e.g. [["e"], "value"] or [1, "value"])
  • tags subarray is not an array (e.g. "instead of an array, this is a string")

Not publishing on main thread `Relay`

2023-06-10 13:51:51.783271-0700 NostrSDKDemo[29109:47174192] [SwiftUI] Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.

Explore introducing builder-pattern to event creation

Many different kinds of Nostr events have overlap in how it is constructed, including semantic meaning of certain tags.

The current pattern of having one distinct creation function in the EventCreating protocol per kind makes it difficult to promote code sharing in the implementation.

For the developer who would be using Nostr SDK, it may be difficult to use the SDK to create events. It may make it harder for them to write maintainable or DRY (don't repeat yourself) code.

Let's explore if it's possible to use a builder pattern to solve these problems.

Separate / allow for networking only

user story

As a nostr app dev who has strong preferences on app specific choices, I would love for nostr SDK to handle networking only, so that I can focus on app specific changes without having to worry about networking and compatibility with other clients & relays.

acceptance criteria

  1. Nostr SDK implements best practice (e.g. outbox model) network connectivity to relays

performance requirements for Damus

@jb55 to provide

builds on

Add outbox to NDK #146

Removing any relay in the demo app crashes the app

Thread 1: "Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (3) must be equal to the number of items contained in that section before the update (2), plus or minus the number of items inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out). Collection view: <SwiftUI.UpdateCoalescingCollectionView: 0x1050fc600; baseClass = UICollectionView; frame = (0 0; 393 852); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600000c9bd80>; backgroundColor = <UIDynamicSystemColor: 0x600001778bc0; name = systemGroupedBackgroundColor>; layer = <CALayer: 0x6000002814e0>; contentOffset: {0, -97.666666666666671}; contentSize: {393, 143}; adjustedContentInset: {97.666666666666657, 0, 34.000000000000114, 0}; layout: <UICollectionViewCompositionalLayout: 0x104619c60>; dataSource: <_TtGC7SwiftUI31UICollectionViewListCoordinatorGVS_28CollectionV"

Simulator Screenshot - iPhone 15 Pro - 2024-04-07 at 00 29 36 Medium

Create Structs and Parsing for Relay Message Types (Requests/Responses)

Message types

Client to Relay

type description NIP
AUTH used to send authentication events 42
CLOSE used to stop previous subscriptions 1
COUNT used to request event counts 45
EVENT used to publish events 1
REQ used to request events and subscribe to new updates 1

Relay to Client

type description NIP
AUTH used to send authentication challenges 42
COUNT used to send requested event counts to clients 45
EOSE used to notify clients all stored events have been sent 1
EVENT used to send events requested to clients 1
NOTICE used to send human-readable messages to clients 1
OK used to notify clients if an EVENT was successful 20

Progress

Client to Relay (RelayRequest)

  • AUTH // Requires signing
  • CLOSE #17
  • COUNT#17
  • EVENT #17
  • REQ #17

Relay to Client (RelayResponse)

Incoming event signature validation

Implement a way to validate signatures of incoming events. Maybe client applications can choose whether to validate incoming events or not.

Event signing

We need a way to create new Nostr events and sign them with a private key so that they can be sent to relays.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.