Skip to content

Commit f0ebfc3

Browse files
committed
feat(spec,hashing-algorithm): limit algorithm? contract, export struct contracts
Signed-off-by: Kaiyang Wu <[email protected]>
1 parent cc4f89f commit f0ebfc3

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

aosc/private/hashing-algorithm.rkt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#lang racket/base
2+
3+
(require racket/contract)
4+
5+
(provide (all-defined-out))
6+
7+
(define/contract (algorithm? sym)
8+
(-> symbol? boolean?)
9+
(if (member sym '(md2 md5 sha1 sha256 sha224 sha384 sha512 blake2b blake2s
10+
sha3_224 sha3_256 sha3_384 sha3_512))
11+
#t
12+
#f))

aosc/private/spec.rkt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
racket/contract
55
racket/string
66
net/url
7+
"hashing-algorithm.rkt"
78
"arch.rkt"
89
"utils.rkt")
910

10-
(provide branch
11+
(provide src-option?
12+
branch
1113
commit
1214
rename
1315
submodule
1416
copy-repo?
17+
src?
1518
git
1619
tbl
20+
chksum?
1721
skip
1822
checksum
1923
anitya
@@ -108,7 +112,7 @@
108112
(struct chksum (type value) #:transparent)
109113

110114
(define/contract (checksum algorithm value)
111-
(-> symbol? string? chksum?)
115+
(-> algorithm? string? chksum?)
112116
(chksum algorithm value))
113117

114118
(define/contract (skip)

0 commit comments

Comments
 (0)