-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sdk): User id as HexString
#2774
Conversation
7da176e
to
ef6f4f1
Compare
b64f7a3
to
9a5ad2c
Compare
…and StreamrClient#getAddress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to demand changes in this repo, but I don't really see what the point of breaking/removing the old function is, especially in cases where (currently) we only support authentication only with Ethereum keys (that will have a corresponding address). It doesn't feel like too much of a concession to leave the existing getAddress etc. methods that return the ID (if it's an address) or throw (if it's not). This wouldn't require so many changes from users, esp those who expect to be using Ethereum addresses only.
HexString
HexString
Re-added the The await stream.grantPermissions({
permissions: [StreamPermission.PUBLISH],
userId: await publisher.getUserId()
}) |
Summary
User id items are stored as arbitrary length
string
instead ofEthereumAddress
.Renamed
getAddess()
inStreamrClient
togetUserId()
. This is a breaking change.This is a preparation PR for #2780. This PR doesn't doesn't contain any changes to contract / The Graph interaction and therefore any user ids which are not exactly 20 bytes long don't work yet. (We should merge this PR to
main
just before that PR, or implement the contract interactions in a PR which has this PR as a base branch.)Changes
The
UserID
helper type if now a a separateBrandedString
. Additionally there is a new helper typeUserIDRaw
, and helper functionstoUserId
andtoUserIdRaw
. There is also theHexString
helper type which is an alias tostring
.In the API all user id inputs and outputs are
HexString
values. This is not a breaking change as earlier the inputs and outputs were eitherstring
orEthereumAddress
values. (TheEthereumAddress
is a branded string, and it was used only in outputs, i.e. in the API all of these were juststring
values.)In
Message
:publisherId
In
StreamrClient
:getUserId()
,UserPermissionQuery#user
hasPermission()
UserPermissionAssignment#user
getPermissions()
,grantPermissions()
,revokePermissions()
andsetPermissions()
getStreamPublishers()
andgetStreamSubscribers()
isStreamPublisher()
,isStreamSubscriber()
SearchStreamsPermissionFilter#user
searchStreams()
ResendFromOptions#publisherId
andResendRangeOptions#publisherId
resend()
addEncryptionKey()
In
Stream
:hasPermission()
,getPermissions()
,grantPermissions()
,revokePermissions()
andsetPermissions()
Internal
In
StreamMessage
thepublisherId
field type isUserID
(i.e. the branded string) as we don't consider that class to be a part part of the public API. Also the related user id types inMessageID
/GroupKeyRequest
/GroupKeyResponse
areUserID
strings.Future improvements
EthereumAddress
outputs toHexString
outputs (e.g.getStorageNodes()
) to unify the APIuser
field ofUserPermissionAssignment#user
andSearchStreamsPermissionFilter#user
touserId
to unify the API (we have typically the ID suffix in these, e.g.streamId
andpublisherId
)randomUserId
instead offastWallet
/ether
'sWallet