feat: cerified addressbook

This commit is contained in:
Vasco Santos
2020-06-21 19:33:58 +02:00
committed by Jacob Heun
parent b0a36ccbc8
commit 8f2e69048f
6 changed files with 404 additions and 21 deletions

View File

@ -112,11 +112,6 @@ const formatSignaturePayload = (domain, payloadType, payload) => {
])
}
/**
* Unmarshal a serialized Envelope protobuf message.
* @param {Buffer} data
* @return {Envelope}
*/
const unmarshalEnvelope = async (data) => {
const envelopeData = Protobuf.decode(data)
const peerId = await PeerId.createFromPubKey(envelopeData.public_key)
@ -129,6 +124,13 @@ const unmarshalEnvelope = async (data) => {
})
}
/**
* Unmarshal a serialized Envelope protobuf message.
* @param {Buffer} data
* @return {Promise<Envelope>}
*/
Envelope.createFromProtobuf = unmarshalEnvelope
/**
* Seal marshals the given Record, places the marshaled bytes inside an Envelope
* and signs it with the given peerId's private key.