Skip to content

Commit f8fd111

Browse files
Merge pull request bitmark-inc#9 from danielrbrowne/tech/refactor-api
API refactor
2 parents 0503d16 + 5af1242 commit f8fd111

File tree

6 files changed

+161
-124
lines changed

6 files changed

+161
-124
lines changed

Sources/TweetNacl/Constant.swift

+33-17
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,36 @@
66
// Copyright © 2016 Bitmark. All rights reserved.
77
//
88

9-
internal let crypto_secretbox_KEYBYTES = 32
10-
internal let crypto_secretbox_NONCEBYTES = 24
11-
internal let crypto_secretbox_ZEROBYTES = 32
12-
internal let crypto_secretbox_BOXZEROBYTES = 16
13-
internal let crypto_scalarmult_BYTES = 32
14-
internal let crypto_scalarmult_SCALARBYTES = 32
15-
internal let crypto_box_PUBLICKEYBYTES = 32
16-
internal let crypto_box_SECRETKEYBYTES = 32
17-
internal let crypto_box_BEFORENMBYTES = 32
18-
internal let crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES
19-
internal let crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES
20-
internal let crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES
21-
internal let crypto_sign_BYTES = 64
22-
internal let crypto_sign_PUBLICKEYBYTES = 32
23-
internal let crypto_sign_SECRETKEYBYTES = 64
24-
internal let crypto_sign_SEEDBYTES = 32
25-
internal let crypto_hash_BYTES = 64
9+
struct Constants {
10+
struct Box {
11+
static let publicKeyBytes = 32
12+
static let secretKeyBytes = 32
13+
static let beforeNMBytes = 32
14+
static let nonceBytes = Secretbox.nonceBytes
15+
static let zeroBytes = Secretbox.zeroBytes
16+
static let boxZeroBytes = Secretbox.boxZeroBytes
17+
}
18+
19+
struct Hash {
20+
static let bytes = 64
21+
}
22+
23+
struct Scalarmult {
24+
static let bytes = 32
25+
static let scalarBytes = 32
26+
}
27+
28+
struct Secretbox {
29+
static let keyBytes = 32
30+
static let nonceBytes = 24
31+
static let zeroBytes = 32
32+
static let boxZeroBytes = 16
33+
}
34+
35+
struct Sign {
36+
static let bytes = 64
37+
static let publicKeyBytes = 32
38+
static let secretKeyBytes = 64
39+
static let seedBytes = 32
40+
}
41+
}

0 commit comments

Comments
 (0)