<!-- .slide: data-background="https://backiee.com/static/wpdb/wallpapers/1920x1080/128268.jpg" -->

---
Protobuf management done right
<https://buf.build/>
---
<!-- .slide: data-background="https://getwallpapers.com/wallpaper/full/5/d/1/526263.jpg" -->
## Current state
----
One API publishing its interface
Or not
<!-- .element: class="fragment" -->
----
n consumers with their own toolchain
----
### Caveats
Need protobuf compilation
<!-- .element: class="fragment" -->
Needs the same `protoc` version
<!-- .element: class="fragment" -->
No standard distribution (aka. no metadata)
<!-- .element: class="fragment" -->
---
## Buf Promises
---
### Great documentation
<https://docs.buf.build/>
---
### Buf Schema Registry
<https://buf.build/explore>
----
Central repository like PyPI for protobufs
---
### Buf cli
----
Manage the entire lifecycle from a single cli
----
Plugin based
Build/generate stubs once for all consumers
<!-- .element: class="fragment" -->
Distribute standards pre-compiled packages
<!-- .element: class="fragment" -->
----
### Bonuses
Linter
<!-- .element: class="fragment" -->
Formatter
<!-- .element: class="fragment" -->
Breaking changes detection
<!-- .element: class="fragment" -->
BSR publication with doc generation
<!-- .element: class="fragment" -->
---
<!-- .slide: data-background="https://getwallpapers.com/wallpaper/full/5/d/1/526263.jpg" -->
### How ?
----
`buf.yaml`
The project descriptor
----
```yaml=
version: v1beta1
name: buf.build/LedgerHQ/bitcoin-keychain
build:
roots:
- .
lint:
use:
- DEFAULT
except:
- RPC_REQUEST_STANDARD_NAME
rpc_allow_google_protobuf_empty_requests: true
deps:
- buf.build/grpc-ecosystem/grpc-gateway
```
----
`buf.lock`
Dependencies are locked and build are reproducibles
<!-- .element: class="fragment" -->
----
`buf.gen.yaml`
The build/generation descriptor(s)
----
```yaml
version: v1
plugins:
- remote: buf.build/library/plugins/go:v1.27.1-1
out: pb
opt:
- module=github.com/ledgerhq/bitcoin-keychain/pb
- remote: buf.build/library/plugins/go-grpc:v1.1.0-2
out: pb
opt:
- module=github.com/ledgerhq/bitcoin-keychain/pb
```
----
`buf.work.yaml`
Make workspaces with multiple linked protobuf projects
<!-- .element: class="fragment" -->
---
<!-- .slide: data-background="https://getwallpapers.com/wallpaper/full/5/d/1/526263.jpg" -->
### Next steps ?
----
Proposal PR on `vault-protobufs`
<!-- .element: class="fragment" -->
Proposal PR merging `bitcoin-keychain` and `vault-keychain`
<!-- .element: class="fragment" -->
---
<!-- .slide: data-background="https://getwallpapers.com/wallpaper/full/5/d/1/526263.jpg" -->
### Questions ?
{"metaMigratedAt":"2023-06-17T16:51:52.095Z","metaMigratedFrom":"YAML","title":"buf.build","breaks":true,"image":"https://www.python.org/static/community_logos/python-logo-master-v3-TM.png","slideOptions":"{\"theme\":\"moon\"}","contributors":"[{\"id\":\"ccb66f62-527e-4f67-aebf-99b8ba78ddd3\",\"add\":3428,\"del\":361}]"}