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

libp2p CafeService for thread backup and offline inboxing #300

Merged
merged 67 commits into from Oct 28, 2018
Merged
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
f8b35f8
feat(backup): add thread state to profile [skip ci]
sanderpick Oct 2, 2018
3a13df6
fix(tests): avatar tests
sanderpick Oct 3, 2018
6dfed04
feat(backup): update peer profile w/ thread changes
sanderpick Oct 8, 2018
ac4432a
chore(ipfs): update go-ipfs to 0.4.17 [skip ci]
sanderpick Oct 8, 2018
d7e464f
feat(services): modularize libp2p services [skip ci]
sanderpick Oct 10, 2018
000b3f3
feat(cafeservice): stub out cafe lip2p service
sanderpick Oct 10, 2018
0f9c869
feat(services): refactor p2p service rpc mechanism
sanderpick Oct 11, 2018
177e541
feat(cafeservice): fix up challenge request [skip ci]
sanderpick Oct 11, 2018
cb82bb5
feat(cafeservice): add nonce and account tables [skip ci]
sanderpick Oct 11, 2018
1827a06
feat(cafeservice): use new nonce table during challenge
sanderpick Oct 11, 2018
0e094d1
feat(cafeservice): add registration step [skip ci]
sanderpick Oct 11, 2018
8d368b3
feat(cafeservice): registration returns sesssion token [skip ci]
sanderpick Oct 12, 2018
904a2fa
feat(cafeservice): add store and block apis
sanderpick Oct 12, 2018
2e50f76
feat(cafeservice): add store block apis
sanderpick Oct 12, 2018
3cbff52
feat(cafeservice): add refresh token handling [skip ci]
sanderpick Oct 13, 2018
519dd5c
feat(cafeservice): refactor pinner to use cafe service [skip ci]
sanderpick Oct 13, 2018
6a60929
fix(cafeservice): store requests need compound index [skip ci]
sanderpick Oct 13, 2018
8567cf9
feat(cafeservice): thread backup apis [skip ci]
sanderpick Oct 16, 2018
8c2814f
feat(cafeservice): add thread backup handlers [skip ci]
sanderpick Oct 16, 2018
c682173
feat(cafeservice): upsert account threads [skip ci]
sanderpick Oct 17, 2018
6dace55
feat(cafeservice): verify token owner [skip ci]
sanderpick Oct 17, 2018
07d373a
fix(cafeservice): remove older methods [skip ci]
sanderpick Oct 17, 2018
71ee89b
fix(cafeservice): group queue req concurrency by recipient [skip ci]
sanderpick Oct 17, 2018
5880992
refactor(threads): use proper thread id not b64 encoded pk
sanderpick Oct 17, 2018
bd25998
refactor(cafe): rm cafe rest apis sans pin [skip ci]
sanderpick Oct 17, 2018
057735a
fix(cafeservice): use correct jwt pack [skip ci]
sanderpick Oct 17, 2018
3fbee6b
chore(cafe): more old cafe rest api cleanup [skip ci]
sanderpick Oct 18, 2018
db00e52
feat(cafeservice): add rm and ls commands [skip ci]
sanderpick Oct 18, 2018
0d88e92
feat(inbox): add cafe inbox message store [skip ci]
sanderpick Oct 18, 2018
0c2c604
refactor(service): cleanup service handler interface [skip ci]
sanderpick Oct 18, 2018
26401a9
refactor(tables): clean up table names and device refs [skip ci]
sanderpick Oct 18, 2018
600fa07
feat(cafeservice): add inbox methods [skip ci]
sanderpick Oct 18, 2018
5176b35
refactor(threads): refactor thread peers [skip ci]
sanderpick Oct 19, 2018
cec1e4e
feat(cafeservice): add inbox table [skip ci]
sanderpick Oct 19, 2018
e8debe4
refactor(threads): simplify thread configuration
sanderpick Oct 19, 2018
96fa5e7
refactor(threads): move to core package
sanderpick Oct 19, 2018
623cccb
refactor(service): service as own pack, services -> core [skip ci]
sanderpick Oct 19, 2018
05a269c
feat(threads): fully encrypt thread blocks [skip ci]
sanderpick Oct 22, 2018
8d9ece3
fix(cmd): fix up commands
sanderpick Oct 22, 2018
4f633bc
fix(photos): couple more fixes
sanderpick Oct 22, 2018
4961c9f
refactor(storage): remove old storage module
sanderpick Oct 22, 2018
6abe0a2
fix(mobile): fix up mobile package [skip ci]
sanderpick Oct 22, 2018
267947f
fix(cafeservice): fix up to match new service interface
sanderpick Oct 22, 2018
bd2ea91
fix(repo): fix up blocks [skip ci]
sanderpick Oct 22, 2018
8cdff15
feat(contacts): add contacts table [skip ci]
sanderpick Oct 22, 2018
c189de7
feat(devices): delete account peers [skip ci]
sanderpick Oct 22, 2018
093b4a7
refactor(joins): adds a welcomed col to thread peers [skip ci]
sanderpick Oct 23, 2018
c2e9754
feat(contacts): include inboxes in contacts [skip ci]
sanderpick Oct 23, 2018
bc0bfec
feat(threads): adds a threads message outbox [skip ci]
sanderpick Oct 23, 2018
49399a6
feat(cafeservice): handle inbox requests [skip ci]
sanderpick Oct 24, 2018
386b63c
fix(crypto): kill lazy ksuid usage in AES keys
sanderpick Oct 24, 2018
9469e12
feat(cafeservice): stub out check messages
sanderpick Oct 24, 2018
5c92145
feat(cafeservice): complete check messages round trip
sanderpick Oct 24, 2018
b3dfd58
feat(cafeservice): message inbox handling
sanderpick Oct 25, 2018
34ad741
feat(cafeservice): couple of fixes
sanderpick Oct 25, 2018
b7441b9
refactor(pins): re-enable pinning photos from non-mobile
sanderpick Oct 25, 2018
b1488d1
refactor(queues): flush cafe outbox on demand only
sanderpick Oct 25, 2018
e5b22ba
feat(cafeservice): register provides rest api address
sanderpick Oct 26, 2018
18ff352
fix(cafehttp): re-enable token auth on pin api
sanderpick Oct 26, 2018
5658983
fix(cafehttp): adds a refresh token method back to mobile
sanderpick Oct 26, 2018
f2074ef
feat(migrations): handle major migrations
sanderpick Oct 26, 2018
3e48457
feat(migration): collect default photos during migration
sanderpick Oct 26, 2018
fb83e24
feat(migrations): check file contents in migration005_test
sanderpick Oct 26, 2018
0c66c16
feat(migrations): add migrate method to cmd and mobile
sanderpick Oct 26, 2018
627aa7d
fix(tests): fix tests, mv cafe to core api package
sanderpick Oct 27, 2018
554f28f
fix(ci): no need to build during unit tests
sanderpick Oct 27, 2018
27d2b94
fix(profiles): re-enables peer profile publishing
sanderpick Oct 28, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

feat(threads): fully encrypt thread blocks [skip ci]

This is a major thread refactor which improves thread privacy. Previously, only critical bits of info like private keys where encrypted _within_ blocks. With the exception of merge blocks, which contain very little meta data, all thread history is now fully encrypted. This also removes the Envelope wrapper from what is persisted as a "block". Envelope is used only for wire transport, as should have always been the case.
  • Loading branch information...
sanderpick committed Oct 22, 2018
commit 05a269cd5dd72da224c4d2c472abad00a078d4ca
@@ -2,7 +2,10 @@ package core

import (
"errors"
"github.com/textileio/textile-go/crypto"
"github.com/textileio/textile-go/ipfs"
"github.com/textileio/textile-go/repo"
"strings"
)

// GetBlock searches for a local block associated with the given target
@@ -25,3 +28,29 @@ func (t *Textile) GetBlockByDataId(dataId string) (*repo.Block, error) {
}
return block, nil
}

// GetBlockData cats file data from ipfs and tries to decrypt it with the provided block
func (t *Textile) GetBlockData(path string, block *repo.Block) ([]byte, error) {
ciphertext, err := ipfs.GetDataAtPath(t.ipfs, path)
if err != nil {
// size migrations
parts := strings.Split(path, "/")
if len(parts) > 1 && strings.Contains(err.Error(), "no link named") {
switch parts[1] {
case "small":
parts[1] = "thumb"
case "medium":
parts[1] = "photo"
default:
return nil, err
}
ciphertext, err = ipfs.GetDataAtPath(t.ipfs, strings.Join(parts, "/"))
if err != nil {
return nil, err
}
} else {
return nil, err
}
}
return crypto.DecryptAES(ciphertext, []byte(block.DataKey))
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.