Skip to content

Commit 9b31eb3

Browse files
committed
service side crypto
1 parent 1f54b2d commit 9b31eb3

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/service/middleware/post/encrypt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = class Encrypt extends IMiddleware {
3737
const reply = new Message({msg: ctx.output})
3838
const sender = Identity.fromString(senderStr)
3939

40-
const payload = await reply.encrypt(ctx.party.privateIdentity, sender.key)
40+
const payload = (await reply.encrypt(ctx.party.privateIdentity, sender.key)).toJSON()
4141

4242
ctx.debug('setting payload', payload)
4343
ctx.setOutput(payload)

src/service/middleware/pre/decrypt.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ module.exports = class Decrypt extends IMiddleware {
3838
context.debug('input', context.input, typeof context.input)
3939

4040

41-
const msg = new Message(context.input)
41+
const msg = new Message()
42+
msg.fromJSON(context.input)
4243
context.debug('privateIdentity', context.party.privateIdentity.id)
4344

4445
const publicKeys = Routines.extractPublicKeys(msg.enc)

0 commit comments

Comments
 (0)