Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Conversation

@teogeb
Copy link
Contributor

@teogeb teogeb commented May 17, 2021

The id parameter of client.createStream can be a path (or full stream id, as previously). It will be prefixed with a lowercased Ethereum address derived from user's private key.

E.g.

client.createStream({
    id: '/foo/bar'
})
// -> creates 0xabcdeabcde123456789012345678901234567890/foo/bar

@linear
Copy link

linear bot commented May 17, 2021

NET-236 Support for entering streamId in streamr-client-javascript

  • End user can give streamId with convenience and ease
  • Either raw, untamed full streamId
  • Or just the path -part, in which case the domain will be determined automatically by the Ethereum address of which the client is aware of. In this case, the Ethereum address should be lowercased by the library.

@teogeb teogeb requested a review from timoxley May 17, 2021 11:59
Copy link
Contributor

@timoxley timoxley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels weird to pass in an id and get back an object with a different id but I guess the client itself does the same thing.

I added a test to check it wasn't possible to create a stream with another user's address as the prefix, it passed though perhaps client could detect this before it hits the backend and give a nicer error, maybe:
ffbb273

@teogeb
Copy link
Contributor Author

teogeb commented May 17, 2021

feels weird to pass in an id and get back an object with a different id but I guess the client itself does the same thing.

I added a test to check it wasn't possible to create a stream with another user's address as the prefix, it passed though perhaps client could detect this before it hits the backend and give a nicer error, maybe:
ffbb273

Agree. Alternatively we could use something like createStream({ id: createStreamId('/foo/bar') } but it wouldn't be very readable. Maybe this is a good compromise. Backend validation is fine, but maybe error messages could be better.

@teogeb teogeb merged commit c1d72c3 into master May 17, 2021
@teogeb teogeb deleted the NET-236-stream-id branch May 17, 2021 16:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants