Skip to content

Commit

Permalink
Update to mirage-crypto-rng 1.0 API
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Nov 28, 2024
1 parent fcf4449 commit f7c4bcd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
os:
- ubuntu-latest
ocaml-version:
- 4.07.0
- 4.13.0

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
uses: avsm/setup-ocaml@v3
with:
ocaml-version: ${{ matrix.ocaml-version }}
ocaml-compiler: ${{ matrix.ocaml-version }}

- name: Deps
run: |
Expand All @@ -42,21 +42,19 @@ jobs:
os:
- ubuntu-latest
ocaml-version:
- 4.08.1
- 4.10.2
- 4.11.2
- 4.12.0
- 4.14.0
- 5

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
uses: avsm/setup-ocaml@v3
with:
ocaml-version: ${{ matrix.ocaml-version }}
ocaml-compiler: ${{ matrix.ocaml-version }}

- name: Deps
run: |
Expand Down
2 changes: 1 addition & 1 deletion backends/postgresql/session_postgresql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let connect ?host ?hostaddr ?port ?dbname ?user ?password ?options ?tty ?require
new Postgresql.connection ?host ?hostaddr ?port ?dbname ?user ?password ?options ?tty ?requiressl ?conninfo ?startonly ()

let gensym () =
Base64.encode_string (Cstruct.to_string (Mirage_crypto_rng.generate 30))
Base64.encode_string (Mirage_crypto_rng.generate 30)

let now () =
Int64.of_float (Unix.time ())
Expand Down
2 changes: 1 addition & 1 deletion backends/redis/lwt/session_redis_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ let _default_period =
Int64.of_int (60 * 60 * 24 * 7)

let gensym () =
Base64.encode_string (Cstruct.to_string (Mirage_crypto_rng.generate 30))
Base64.encode_string (Mirage_crypto_rng.generate 30)

let redis_key k = "session:" ^ k

Expand Down
2 changes: 1 addition & 1 deletion lib/memory.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type t =
; mutable default_period : period }

let gensym () =
Base64.encode_string (Cstruct.to_string (Mirage_crypto_rng.generate 30))
Base64.encode_string (Mirage_crypto_rng.generate 30)

let create () =
{ store = Hashtbl.create 10
Expand Down
2 changes: 1 addition & 1 deletion lib_test/memory/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module Backend = struct
let name = "memory"
end

let () = Mirage_crypto_rng_unix.initialize ()
let () = Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna)
module Test = Test_session.Make(Backend)
3 changes: 1 addition & 2 deletions session.opam
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ depends: [
"ocaml" {>= "4.07.0"}
"base-unix"
"dune" {>= "1.0"}
"mirage-crypto"
"mirage-crypto-rng"
"mirage-crypto-rng" {>= "1.0.0"}
"base64"
"ounit" {with-test & >= "1.0.2"}
]
Expand Down

0 comments on commit f7c4bcd

Please sign in to comment.