wip: didcomm - #70
Conversation
|
|
||
| DidcommSignedMessage aliceSignedMessage = | ||
| await DidcommSignedMessage.fromPlaintext( | ||
| wallet: aliceWallet, keyId: alicePublicKey.id, message: message); |
There was a problem hiding this comment.
We have DidSigner to wrap the wallet and keyId for most simple sign operations.
Is passing the wallet strictly needed for DidcommSignedMessage.fromPlaintext?
There was a problem hiding this comment.
Thank you @cosminm-affnd. I somehow tried to avoid using DidSigner as it looked much more complex as a consumer to use. But trying it out again it makes the signing implementation much more easier and flexible within the DidcommSignedMessage class.
| DidcommPlaintextMessage message = DidcommPlaintextMessage( | ||
| id: '2fb19055-581d-488e-b357-9d026bee98fc', | ||
| to: [bobDidDoc.id], | ||
| from: aliceDidDoc.id, |
There was a problem hiding this comment.
minor: how do we keep the value here in sync with the key used to sign the message?
There was a problem hiding this comment.
I changed DidcommSignedMessage to set from value using DidSigner.did if not set on message before.
438d076 to
ec50724
Compare
| final bobsEncryptedMessage = await bobsSignedMessage.encrypt( | ||
| wallet: bobWallet, | ||
| keyId: bobKeyPair.id, | ||
| recipientPublicKeyJwks: [aliceJwk.toJson()]); |
There was a problem hiding this comment.
It is conventional in Dart to add , after the last parameter. Here is an example of another affinidi repo
There was a problem hiding this comment.
The example uses ,after last parameter for function definition. But when using a function it doesn't make use of a ,. As we already discussed, it would be nice if this will be done automatically by the linter.
| recipientPublicKeyJwks: [aliceJwk.toJson()]); | ||
|
|
||
| final getFromJson = | ||
| DidcommEncryptedMessage.fromJson(bobsEncryptedMessage.toJson()); |
There was a problem hiding this comment.
toJson and then fromJson - is it an attempt to clone an object? Could we have clone method for better clarity?
getFromJson - usually method names starts with get, but not object names
There was a problem hiding this comment.
This example just shows how to convert messages to and from json as you would do when you send it to the mediator. After integrating the mediator client we can combine these.
| this.lastmodTime, | ||
| this.byteCount}); | ||
|
|
||
| Attachment.fromJson(dynamic jsonData) { |
There was a problem hiding this comment.
It could be beneficial to use JsonSeriflized to reduce toJson and fromJson boilerplate
There was a problem hiding this comment.
Yes I agree. This is something that should be discussed with the SSI package team as it introduces another dependency.
| var splitted = jwtCompact.split('.'); | ||
| if (splitted.length != 3) { | ||
| throw FormatException( | ||
| 'compact serialization must consist of three parts separated by point(.).'); |
There was a problem hiding this comment.
Error should be sentence case, simior to another affinidi package
There was a problem hiding this comment.
I changed it. Is this what you would expect?
No description provided.