chore: use base64 url safe encoding for noise

This commit is contained in:
Richard Ramos 2023-02-20 12:10:47 -04:00
parent ad8035a012
commit c6febfcd14
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760

View File

@ -1,4 +1,4 @@
import { decode, encode, fromUint8Array, toUint8Array } from "js-base64"; import { decode, encodeURI, fromUint8Array, toUint8Array } from "js-base64";
import { bytes32 } from "./@types/basic.js"; import { bytes32 } from "./@types/basic.js";
@ -16,11 +16,11 @@ export class QR {
// Serializes input parameters to a base64 string for exposure through QR code (used by WakuPairing) // Serializes input parameters to a base64 string for exposure through QR code (used by WakuPairing)
toString(): string { toString(): string {
let qr = encode(this.applicationName) + ":"; let qr = encodeURI(this.applicationName) + ":";
qr += encode(this.applicationVersion) + ":"; qr += encodeURI(this.applicationVersion) + ":";
qr += encode(this.shardId) + ":"; qr += encodeURI(this.shardId) + ":";
qr += fromUint8Array(this.ephemeralKey) + ":"; qr += fromUint8Array(this.ephemeralKey, true) + ":";
qr += fromUint8Array(this.committedStaticKey); qr += fromUint8Array(this.committedStaticKey, true);
return qr; return qr;
} }