matter.js: Resuming a Session the second time fails
I’m using the ControllerNode class to resume a session to an already paired node (Hue bridge ). The pairing works correctly, and the 1st time we resume, this works correctly as well. Unfortunately, after resuming the first time, the CaseClient receives the sigma2resume message in a incompatible format here:
https://github.com/project-chip/matter.js/blob/f68c2a1760485c4da3f6c897fd56ceb4e08a5797/packages/matter.js/src/session/case/CaseClient.ts#L46
if i dump the sigma2resume message, it looks something like:
{"resumptionId":{"type":"Buffer","data":[161,2,101,132,250,185,175,4,185,69,179,75,60,143,34,190]},"resumeMic":{"type":"Buffer","data":[134,115,226,224,208,16,250,27,80,52,38,173,21,48,233,95]},"sessionId":18290}
I think the values should be Uint8Arrays, instead they look like raw Node.js Buffer objects. The client then persists these to storage, and the next time it goes to use them (so the second time we resume) we get a range error here when doing the ByteArray concat call: https://github.com/project-chip/matter.js/blob/f68c2a1760485c4da3f6c897fd56ceb4e08a5797/packages/matter.js/src/session/case/CaseClient.ts#L38
I tried hunting this down for a bit, but I can’t figure out why these raw buffer objects are returned, where everywhere else it seems to be fine?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (11 by maintainers)
Commits related to this issue
- Allows Node.js Buffer objects to be persisted to storage as a Uint8Arrays that they subclass Fixes #138 Signed-off-by: Dan Cunningham <dan@digitaldan.com> — committed to digitaldan/matter.js by digitaldan a year ago
- Allows Node.js Buffer objects to be persisted to storage as a Uint8Arrays that they subclass Fixes #138 Signed-off-by: Dan Cunningham <dan@digitaldan.com> — committed to digitaldan/matter.js by digitaldan a year ago
- Allows Node.js Buffer objects to be persisted to storage as a Uint8Arrays that they subclass (#159) * Allows Node.js Buffer objects to be persisted to storage as a Uint8Arrays that they subclass Fi... — committed to project-chip/matter.js by digitaldan a year ago
Let me play around with it a bit later