Skip to content

Commit f5820dd

Browse files
committed
feat(crypto): add some new Hash module functions.
- updateString - updateStringWithEncoding - digestWithEncoding NOTE: The second parameter of `digestWithEncoding` brings a new type `BinaryToTextEncodingThe.t`.
1 parent c198733 commit f5820dd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Crypto.res

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ 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+
}
41+
3442
module PivateKey = {
3543
include KeyObject.Impl
3644
type kind = [KeyObject.privateKey]
@@ -60,6 +68,9 @@ module Hash = {
6068
@send external copy: t => t = "copy"
6169
@send external digest: t => Buffer.t = "digest"
6270
@send external update: (t, Buffer.t) => unit = "update"
71+
@send external updateString: (t, string) => t = "update"
72+
@send external updateStringWithEncoding: (t, string, NodeJs.StringEncoding.t) => t = "update"
73+
@send external digestWithEncoding: (t, BinaryToTextEncoding.t) => string = "digest"
6374
}
6475
include Impl
6576
}

0 commit comments

Comments
 (0)