-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
35 lines (34 loc) · 932 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const v2 = require('./v2')
const v1 = require('./v1')
module.exports = {
pack: v2.pack,
unpack: function unpack (secret, version) {
switch (version) {
case '2.0.0': return v2.unpack(secret)
case '1.0.0': return v1.unpack(secret)
default: return false
}
},
share: v2.share,
combine: function combine (shards, version) {
switch (version) {
case '2.0.0': return v2.combine(shards)
case '1.0.0': return v1.combine(shards)
default: return false
}
},
verify: function verify (shards, version) {
switch (version) {
case '2.0.0': return v2.verify(shards)
case '1.0.0': return v1.verify(shards)
default: return false
}
},
validateShard: function validateShard (shard, version) {
switch (version) {
case '2.0.0': return v2.validateShard(shard)
case '1.0.0': return v1.validateShard(shard)
default: return false
}
}
}