mirror of https://github.com/waku-org/js-waku.git
Extract is message signed logic
This commit is contained in:
parent
bd9d592fda
commit
5648f72d3d
|
@ -98,7 +98,7 @@ export function clearDecode(
|
|||
start += sizeOfPayloadSizeField;
|
||||
const payload = buf.slice(start, start + payloadSize);
|
||||
|
||||
const isSigned = (buf.readUIntLE(0, 1) & IsSignedMask) == IsSignedMask;
|
||||
const isSigned = isMessageSigned(buf);
|
||||
if (isSigned) {
|
||||
const signature = getSignature(buf);
|
||||
const hash = getHash(buf, isSigned);
|
||||
|
@ -131,6 +131,10 @@ function getPayloadSize(
|
|||
return payloadSizeDataView.getInt32(0, true);
|
||||
}
|
||||
|
||||
function isMessageSigned(message: Buffer): boolean {
|
||||
return (message.readUIntLE(0, 1) & IsSignedMask) == IsSignedMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Proceed with Asymmetric encryption of the data as per [26/WAKU-PAYLOAD](https://rfc.vac.dev/spec/26/).
|
||||
* The data MUST be flags | payload-length | payload | [signature].
|
||||
|
|
Loading…
Reference in New Issue