diff --git a/format.js b/format.js index f997fde..0916ec1 100644 --- a/format.js +++ b/format.js @@ -280,7 +280,7 @@ function makeEncryptionFormat() { return dmEncryptionKey(opts.keys, recp) } else if (isGroupId(recp) && keyring.group.has(recp)) { return keyring.group.get(recp).writeKey - } else if (isPoBoxId(recp) && keyring.poBox.has(recp)) { + } else if (isPoBoxId(recp)) { return easyPoBoxKey(recp) } else throw new Error('Unsupported recipient: ' + recp) }) diff --git a/test/pobox.js b/test/pobox.js index 0bf235d..e9e6dbc 100644 --- a/test/pobox.js +++ b/test/pobox.js @@ -84,3 +84,22 @@ test('pobox functions', async (t) => { await tearDown() }) + +test("can encrypt to a pobox we haven't added", t => { + setup() + + const opts = { + keys, + content: { type: 'post', text: 'super secret post to strange pobox' }, + encryptionFormat: 'box2', + recps: [poBoxId], + } + + sbot.db.create(opts, (err, privateMsg) => { + t.error(err, 'no err') + + t.equal(typeof privateMsg.value.content, 'string') + + tearDown(t.end) + }) +}) \ No newline at end of file