-
Notifications
You must be signed in to change notification settings - Fork 31
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: Uptake public key hash changes #1440
base: trunk
Are you sure you want to change the base?
Conversation
…icKeyHash changes
…into 1417-uptake-pubkeyhash-changes
// AtConstants.sharedWithPublicKeyHash. Therefore, check for null. | ||
if (json['metadata'][AtConstants.sharedWithPublicKeyHash] != null) { | ||
// AtConstants.sharedWithPublicKeyHash. Therefore, check for null String. | ||
if (json['metadata'][AtConstants.sharedWithPublicKeyHash] != "null") { |
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.
This seems bad
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.
Sure Gary, will revisit the code and modify the IF condition.
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.
In the MonitorVerbHandler.dart
file of at_secondary_server
, the pubKeyHash
object is converted into a JSON-encoded string and sent to the client. When the pubKeyHash value is null, the jsonEncode method returns a string with the value "null", which causes metadata.pubKeyHash to be set to "null"
instead of null
.
Code snippet from MonitorVerbHandler.dart:
"pubKeyHash": jsonEncode(atNotification.atMetadata?.pubKeyHash?.toJson())
To ensure that metadata.publicKeyHash contains a null object on the client side, modify the code in MonitorVerbHandler.dart
as follows:
notification.metadata?.putIfAbsent(
"pubKeyHash",
() => (atNotification.atMetadata?.pubKeyHash != null)
? jsonEncode(atNotification.atMetadata?.pubKeyHash?.toJson())
: null);
@gkc : Let me know if this approach looks good or suggest an alternate approach please.
- What I did
- How to verify it
- Description for the changelog
Note: In the pubspec.yaml, the at_persistence_secondary_server is set to "2121-uptake-public-key-hash-at-persistence_secondary-server" branch to consume the public key hash changes. Once the PR in at_server is merged, will replace with the hosted version.