Skip to content

Commit

Permalink
feat(spec,hashing-algorithm): limit algorithm? contract, export struc…
Browse files Browse the repository at this point in the history
…t contracts

Signed-off-by: Kaiyang Wu <[email protected]>
  • Loading branch information
OriginCode committed Jan 7, 2025
1 parent cc4f89f commit f0ebfc3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions aosc/private/hashing-algorithm.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#lang racket/base

(require racket/contract)

(provide (all-defined-out))

(define/contract (algorithm? sym)
(-> symbol? boolean?)
(if (member sym '(md2 md5 sha1 sha256 sha224 sha384 sha512 blake2b blake2s
sha3_224 sha3_256 sha3_384 sha3_512))
#t
#f))
8 changes: 6 additions & 2 deletions aosc/private/spec.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
racket/contract
racket/string
net/url
"hashing-algorithm.rkt"
"arch.rkt"
"utils.rkt")

(provide branch
(provide src-option?
branch
commit
rename
submodule
copy-repo?
src?
git
tbl
chksum?
skip
checksum
anitya
Expand Down Expand Up @@ -108,7 +112,7 @@
(struct chksum (type value) #:transparent)

(define/contract (checksum algorithm value)
(-> symbol? string? chksum?)
(-> algorithm? string? chksum?)
(chksum algorithm value))

(define/contract (skip)
Expand Down

0 comments on commit f0ebfc3

Please sign in to comment.