keybase / client

Keybase Go Library, Client, Service, OS X, iOS, Android, Electron
BSD 3-Clause "New" or "Revised" License
8.9k stars 1.23k forks source link

proposal: split libkb into multiple packages #296

Closed patrickxb closed 8 years ago

patrickxb commented 9 years ago

libkb is getting unwieldy.

It would be advantageous for compile time, maintenance, namespaces, and testing to split it into several smaller, contained packages.

I went through the list and came up with the following idea...it's very rough and doesn't contain every file in libkb, but I do feel we should do something along these lines. It can be an incremental change, too.

config/
    home.go, config.go, userconfig.go

crypto/
    generickey.go

    nacl/
        naclgen, naclwrap
    pgp/
        pgpenc, pgpdec, pgpkey

engine/

errors/
    errors.go

gpg/
    gpg*

id/
    assertion*
    identify_*
    id_table.go
    track.go

kex/
    kex*

libkb/
    util.go, tablify.go

net/
    api.go, client.go http.go, post.go, socket.go

proof/
    proof*

sync/
    syncer.go
    sync_secret.go
    sync_trackers.go

user/
    user.go
    resolve.go
maxtaco commented 9 years ago

Would engine be at the same level?

patrickxb commented 9 years ago

yes, sorry, left it out...

maxtaco commented 9 years ago

Sounds good. But seems like a big project, no?

patrickxb commented 9 years ago

Don't have to do it all at once. And there are some tools like:

https://godoc.org/golang.org/x/tools/cmd/eg https://godoc.org/golang.org/x/tools/cmd/gorename https://godoc.org/golang.org/x/tools/cmd/gomvpkg

that would save some typing, sed work.

maxtaco commented 9 years ago

I keep wanting a self-contained library to handle sigchain playback and keyfamily reconstruction. That seems to be where the most interesting and bug-prone crypto is.

patrickxb commented 9 years ago

I'll go through this and come up with a plan to get started on this.

maxtaco commented 9 years ago

Does your experience with Android/iOS inform this at all?

patrickxb commented 9 years ago

Yes, definitely.