-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
33 lines (28 loc) · 923 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
'use strict'
var binding = require('./build/Release/binding.node')
function Message (key, ts, previous, author, sequence, timestamp, hash, content, signature) {
this.key = key
this.value = new Value(previous, author, sequence, timestamp, hash, content, signature)
this.timestamp = ts
}
function Value (previous, author, sequence, timestamp, hash, content, signature) {
this.previous = previous
this.author = author
this.sequence = sequence
this.timestamp = timestamp
this.hash = hash
this.content = content
this.signature = signature
}
module.exports = {
parseJsonWithConstructor: function(string) {
return binding.parseJsonWithConstructor(string, Message)
},
parseCborWithConstructor: function(string) {
return binding.parseCborWithConstructor(string, Message)
},
parseJson: binding.parseJson,
parseCbor: binding.parseCbor,
toCbor: binding.toCbor,
toJson: binding.toJson
}