Closed danielgoncalves25 closed 2 years ago
@danielgoncalves25 sorry this is a little tricky and the error is not useful, we will raise a an enhancement ticket to make both of those a thing of the past...
But to the answer I will provide an example from one of my apps. In my case I am also adding some other metadata so the key times out after an hour..
The catch is that for public data you have to say isPublic, isEncrypted and share with null
Let us know if that fixes your problem...
var metaData = Metadata()
..isPublic = true
..isEncrypted = false
..namespaceAware = true
// // one minute
// ..ttl = 60000 ;
// One Hour
..ttl = 3600000;
var key = AtKey()
..key = 'public.' + hamradio.radioName
..sharedBy = currentAtsign
..sharedWith = null
..metadata = metaData;
await atClient.put(key, jsonEncode(publichamradio));
Also - you can remove isDedicated as it is being deprecated. /// Starting version 3.0.0 [isDedicated] is deprecated
Will categorize this as an enhancement request as follows: We should consider adding additional information for Invalid syntax errors.
1) isPublic and isEncrypted are effectively inverses of each other. We should change code to enforce that and deprecate one of them (I’d suggest deprecating isEncrypted - this is an implicit developer expectation that things are always encrypted unless isPublic is set) 2) sharedWith is fully irrelevant when isPublic is true. We should either (a) actively prevent that combination or (b) just silently set sharedWith to null when isPublic is true, and explain in documentation. (a) is cleaner but is a breaking change; so I suggest (b), with a WARNing logged also
@cconstab I put you on this issue card. Please update if I got it wrong. :)
Not something I was going to fix in the code but I did answer the original question. Jagan/Murali/GKC this needs you guys to agree an approach to make the enhancement.. Might be worth opening a new ticket if this one is too confusing..
Hi @danielgoncalves25 - see cconstab's suggestion above which should help you resolve your problem.
Have opened feature request #364 for a better API, and feature requests #365 and #366 for better guidance / protections when using the existing API
Describe the bug I am trying to store data within my atsign and make that data public for everyone. I am getting error code AT0003 Invalid syntax.
To Reproduce This is the code where im creating the AtKey object and setting its attributes.
Screenshots
Smartphone (please complete the following information):
Were you using an @application when the bug was found?
Additional context Data is successful stored but not whenever I set isPublic attribute to true.