Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for encrypting to unknown pobox #38

Merged
merged 8 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]
on: push
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why turn off CI for pull requests?

Other than that, PR looks good and can be merged IMO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staltz it's still gonna run on commits in PRs. i think that setting is just "only run on commits part of a PR" or something.

the improvement here is that it'll run on commits even before you've opened a PR. if you look at the first commit in this PR, it doesn't have this CI because it was using the old config

another problem with the old config is that it only ran on stuff pointing at master, so if there was a PR pointing at another PR, that PR wouldn't get any CI

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this only works for PRs created as branches in this repo. If an external contributor wants to send a PR, CI wouldn't run for those.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok there doesn't seem to be a good solution here which really sucks https://github.com/orgs/community/discussions/26276 why is github missing such a basic feature 😢

Anyway reverted this now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion format.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
19 changes: 19 additions & 0 deletions test/pobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
Loading