@@ -21,7 +21,7 @@ export class RecordEnvelope implements Envelope {
21
21
/**
22
22
* Unmarshal a serialized Envelope protobuf message
23
23
*/
24
- static createFromProtobuf = async ( data : Uint8Array | Uint8ArrayList ) => {
24
+ static createFromProtobuf = async ( data : Uint8Array | Uint8ArrayList ) : Promise < RecordEnvelope > => {
25
25
const envelopeData = Protobuf . decode ( data )
26
26
const peerId = await peerIdFromKeys ( envelopeData . publicKey )
27
27
@@ -37,7 +37,7 @@ export class RecordEnvelope implements Envelope {
37
37
* Seal marshals the given Record, places the marshaled bytes inside an Envelope
38
38
* and signs it with the given peerId's private key
39
39
*/
40
- static seal = async ( record : Record , peerId : PeerId ) => {
40
+ static seal = async ( record : Record , peerId : PeerId ) : Promise < RecordEnvelope > => {
41
41
if ( peerId . privateKey == null ) {
42
42
throw new Error ( 'Missing private key' )
43
43
}
@@ -61,7 +61,7 @@ export class RecordEnvelope implements Envelope {
61
61
* Open and certify a given marshalled envelope.
62
62
* Data is unmarshalled and the signature validated for the given domain.
63
63
*/
64
- static openAndCertify = async ( data : Uint8Array | Uint8ArrayList , domain : string ) => {
64
+ static openAndCertify = async ( data : Uint8Array | Uint8ArrayList , domain : string ) : Promise < RecordEnvelope > => {
65
65
const envelope = await RecordEnvelope . createFromProtobuf ( data )
66
66
const valid = await envelope . validate ( domain )
67
67
@@ -114,14 +114,14 @@ export class RecordEnvelope implements Envelope {
114
114
/**
115
115
* Verifies if the other Envelope is identical to this one
116
116
*/
117
- equals ( other : Envelope ) {
117
+ equals ( other : Envelope ) : boolean {
118
118
return uint8ArrayEquals ( this . marshal ( ) , other . marshal ( ) )
119
119
}
120
120
121
121
/**
122
122
* Validate envelope data signature for the given domain
123
123
*/
124
- async validate ( domain : string ) {
124
+ async validate ( domain : string ) : Promise < boolean > {
125
125
const signData = formatSignaturePayload ( domain , this . payloadType , this . payload )
126
126
127
127
if ( this . peerId . publicKey == null ) {
0 commit comments