Skip to content

Commit

Permalink
fix: Decrypting
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Feb 11, 2020
1 parent 20b70d9 commit db07fdb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/daf-did-comm/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export class ActionHandler extends AbstractActionHandler {
id: uuid.v4(),
data: data.jwt,
})
debug(dm)
body = await identity.encrypt(data.to, dm)
debug('Encrypted:', body)
} catch (e) {
console.log(e)
}
Expand Down
7 changes: 5 additions & 2 deletions packages/daf-did-comm/src/message-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ export class MessageValidator extends AbstractMessageValidator {
if (parsed.ciphertext && parsed.protected) {
const identities = await core.identityManager.getIdentities()
for (const identity of identities) {
const decrypted = await identity.decrypt(message.raw)
let decrypted
try {
decrypted = await identity.decrypt(message.raw)
} catch (e) {}
if (decrypted) {
debug('Decrypted for %s', identity.did)
debug(decrypted)
debug('Message:', decrypted)

try {
const json = JSON.parse(decrypted)
Expand Down

0 comments on commit db07fdb

Please sign in to comment.