Debian Codegraph @

crypto/olm/olm.go

raw
1 package olm
2
3 // #cgo LDFLAGS: -lolm -lstdc++
4 // #include <olm/olm.h>
5 import "C"
6 import (
7 "encoding/base64"
8
9 "maunium.net/go/mautrix/id"
10 )
11
12 // Signatures is the data structure used to sign JSON objects.
13 type Signatures map[id.UserID]map[id.DeviceKeyID]string
14
15 // Version returns the version number of the olm library.
16 func Version() (major, minor, patch uint8) {
17 C.olm_get_library_version(
18 (*C.uint8_t)(&major),
19 (*C.uint8_t)(&minor),
20 (*C.uint8_t)(&patch))
21 return
22 }
23
24 // errorVal returns the value that olm functions return if there was an error.
25 func errorVal() C.size_t {
26 return C.olm_error()
27 }
28
29 var unpaddedBase64 = base64.StdEncoding.WithPadding(base64.NoPadding)
30
31 var pickleKey = []byte("maunium.net/go/mautrix/crypto/olm")
32
33 // SetPickleKey sets the global pickle key used when encoding structs with Gob or JSON.
34 func SetPickleKey(key []byte) {
35 pickleKey = key
36 }