Skip to content

Commit 71b525d

Browse files
committed
feat(crypto): Implementing binaryToTextEncoding using variant
1 parent f5820dd commit 71b525d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Crypto.res

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ KeyObject = {
3131
include Impl
3232
}
3333

34-
module BinaryToTextEncoding = {
35-
type t = string
36-
let base64: t = "base64"
37-
let base64url: t = "base64url"
38-
let hex: t = "hex"
39-
let binary: t = "binary"
40-
}
34+
type binaryToTextEncoding =
35+
| @as("base64") Base64
36+
| @as("base64url") Base64url
37+
| @as("hex") Hex
38+
| @as("binary") Binary
4139

4240
module PivateKey = {
4341
include KeyObject.Impl
@@ -70,7 +68,7 @@ module Hash = {
7068
@send external update: (t, Buffer.t) => unit = "update"
7169
@send external updateString: (t, string) => t = "update"
7270
@send external updateStringWithEncoding: (t, string, NodeJs.StringEncoding.t) => t = "update"
73-
@send external digestWithEncoding: (t, BinaryToTextEncoding.t) => string = "digest"
71+
@send external digestWithEncoding: (t, binaryToTextEncoding) => string = "digest"
7472
}
7573
include Impl
7674
}

0 commit comments

Comments
 (0)