File tree 8 files changed +26
-31
lines changed
8 files changed +26
-31
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,15 @@ depends: [
15
15
"lwt_ssl" {>= "1.1.3"}
16
16
"ssl" {= "0.5.9"}
17
17
"stdio" {>= "v0.14.0"}
18
- "hex " {>= "1.4 .0"}
19
- "mirage-crypto" {>= "0.8.7 "}
18
+ "ohex " {>= "0.2 .0"}
19
+ "mirage-crypto" {>= "1.0.0 "}
20
20
"eqaf" {>= "0.7"}
21
21
"yojson" {>= "1.7.0"}
22
22
"graphql_ppx" {>= "1.2.0"}
23
- "x509" {>= "0.11.2"}
24
- "cstruct" {>= "5.0.0"}
23
+ "x509" {>= "1.0.0"}
25
24
"ISO8601" {>= "0.2.0"}
26
25
"camlzip" {>= "1.08"}
26
+ "digestif" {>= "1.2.0"}
27
27
"odoc" {>= "1.5.2" & with-doc}
28
28
]
29
29
build: [
Original file line number Diff line number Diff line change @@ -10,11 +10,10 @@ let github_headers token =
10
10
; (" authorization" , " Bearer " ^ token) ]
11
11
12
12
let rs256_sign ~key ~data =
13
- (* Taken from https://github.com/mmaker/ocaml-letsencrypt *)
14
- let data = Cstruct. of_string data in
15
- let h = Mirage_crypto.Hash.SHA256. digest data in
13
+ (* Taken from https://github.com/robur-coop/ocaml-letsencrypt *)
14
+ let h = Digestif.SHA256. (to_raw_string (digest_string data)) in
16
15
let pkcs1_digest = X509.Certificate. encode_pkcs1_digest_info (`SHA256 , h) in
17
- Mirage_crypto_pk.Rsa.PKCS1. sig_encode ~key pkcs1_digest |> Cstruct. to_string
16
+ Mirage_crypto_pk.Rsa.PKCS1. sig_encode ~key pkcs1_digest
18
17
19
18
let base64 = Base64. encode ~pad: false ~alphabet: Base64. uri_safe_alphabet
20
19
Original file line number Diff line number Diff line change @@ -240,9 +240,8 @@ let receive_github ~secret headers body =
240
240
match Header. get headers " X-Hub-Signature" with
241
241
| Some signature ->
242
242
let expected =
243
- Mirage_crypto.Hash.SHA1. hmac ~key: (Cstruct. of_string secret)
244
- (Cstruct. of_string body)
245
- |> Hex. of_cstruct |> Hex. show |> f " sha1=%s"
243
+ Digestif.SHA1. (to_raw_string (hmac_string ~key: secret body))
244
+ |> Ohex. encode |> f " sha1=%s"
246
245
in
247
246
if Eqaf. equal signature expected then Ok (Some install_id)
248
247
else Error " Webhook signed but with wrong signature."
Original file line number Diff line number Diff line change 1
1
(library
2
2
(name Bot_components)
3
3
(public_name bot-components)
4
- (libraries base camlzip cohttp-lwt-unix cstruct eqaf hex mirage-crypto stdio
5
- str x509 yojson ISO8601)
4
+ (libraries base camlzip cohttp-lwt-unix eqaf ohex mirage-crypto stdio str
5
+ x509 yojson ISO8601 digestif )
6
6
(private_modules GraphQL_query GitHub_GraphQL Utils)
7
7
(modules_without_implementation GitHub_types GitLab_types)
8
8
(preprocess
Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ depends: [
15
15
"cohttp-lwt-unix" {>= "2.5.4"}
16
16
"lwt_ssl" {>= "1.1.3"}
17
17
"ssl" {>= "0.5.9"}
18
- "mirage-crypto" {>= "0.11 .0"}
19
- "mirage-crypto-rng" {>= "0.11 .0"}
20
- "mirage-crypto-rng-lwt" {>= "0.11 .0"}
18
+ "mirage-crypto" {>= "1.0 .0"}
19
+ "mirage-crypto-rng" {>= "1.0 .0"}
20
+ "mirage-crypto-rng-lwt" {>= "1.0 .0"}
21
21
"stdio" {>= "v0.14.0"}
22
22
"yojson" {>= "1.7.0"}
23
23
"bot-components" {dev}
Original file line number Diff line number Diff line change 1
1
{ pkgs ? import ( fetchTarball {
2
- url = "https://github.com/NixOS/nixpkgs/archive/280db3decab4cbeb22a4599bd472229ab74d25e1 .tar.gz" ;
3
- sha256 = "sha256:17n9wji64l7d16s8r100ypwlxkmwrypll4q3wkkfjswbilxkqjr6 " ;
2
+ url = "https://github.com/NixOS/nixpkgs/archive/5ea573ca476915e0ccefb99be5687e4150fa049b .tar.gz" ;
3
+ sha256 = "0hsg6xjj4iclfrvplsf0rd9xiwkaazvmlp609qiwka65v7wcjja2 " ;
4
4
} ) { } } :
5
5
6
6
pkgs . stdenv . mkDerivation rec {
@@ -22,7 +22,7 @@ pkgs.stdenv.mkDerivation rec {
22
22
camlzip
23
23
cohttp
24
24
cohttp-lwt-unix
25
- hex
25
+ ohex
26
26
iso8601
27
27
mirage-crypto
28
28
mirage-crypto-rng-lwt
@@ -31,7 +31,7 @@ pkgs.stdenv.mkDerivation rec {
31
31
toml
32
32
eqaf
33
33
x509
34
- cstruct
34
+ digestif
35
35
ppx_expect
36
36
odoc
37
37
] ;
Original file line number Diff line number Diff line change 20
20
( cohttp-lwt-unix ( >= 2 .5.4) )
21
21
( lwt_ssl ( >= 1 .1.3) )
22
22
( ssl ( >= 0 .5.9) )
23
- ( mirage-crypto ( >= 0 .11 .0) )
24
- ( mirage-crypto-rng ( >= 0 .11 .0) )
25
- ( mirage-crypto-rng-lwt ( >= 0 .11 .0) )
23
+ ( mirage-crypto ( >= 1 .0 .0) )
24
+ ( mirage-crypto-rng ( >= 1 .0 .0) )
25
+ ( mirage-crypto-rng-lwt ( >= 1 .0 .0) )
26
26
( stdio ( >= v0.14.0) )
27
27
( yojson ( >= 1 .7.0) )
28
28
( bot-components :dev )
42
42
( lwt_ssl ( >= 1 .1.3) )
43
43
( ssl ( = 0 .5.9) )
44
44
( stdio ( >= v0.14.0) )
45
- ( hex ( >= 1 .4 .0) )
46
- ( mirage-crypto ( >= 0 .8.7 ) )
45
+ ( ohex ( >= 0 .2 .0) )
46
+ ( mirage-crypto ( >= 1 .0.0 ) )
47
47
( eqaf ( >= 0 .7) )
48
48
( yojson ( >= 1 .7.0) )
49
49
( graphql_ppx ( >= 1 .2.0) )
50
- ( x509 ( >= 0 .11.2) )
51
- ( cstruct ( >= 5 .0.0) )
50
+ ( x509 ( >= 1 .0.0) )
52
51
( ISO8601 ( >= 0 .2.0) )
53
52
( camlzip ( >= 1 .08) )
53
+ ( digestif ( >= 1 .2.0) )
54
54
( odoc ( and ( >= 1 .5.2) :with -doc) ) )
55
55
)
Original file line number Diff line number Diff line change @@ -123,10 +123,7 @@ let github_app_id toml_data =
123
123
124
124
let github_private_key () =
125
125
(* string_of_file_path "./github.private-key.pem"*)
126
- match
127
- Sys. getenv_exn " GITHUB_PRIVATE_KEY"
128
- |> Cstruct. of_string |> X509.Private_key. decode_pem
129
- with
126
+ match Sys. getenv_exn " GITHUB_PRIVATE_KEY" |> X509.Private_key. decode_pem with
130
127
| Ok (`RSA priv ) ->
131
128
priv
132
129
| Ok _ ->
You can’t perform that action at this time.
0 commit comments