MCPcopy Create free account
hub / github.com/CommE2E/comm / toBase64URL

Function toBase64URL

lib/utils/base64.js:6–16  ·  view source on GitHub ↗

* Converts a base64 string to base64url format specified in RFC 4648 § 5.

(
  base64String: string,
  stripPadding: boolean = true,
)

Source from the content-addressed store, hash-verified

4 * Converts a base64 string to base64url format specified in RFC 4648 § 5.
5 */
6function toBase64URL(
7 base64String: string,
8 stripPadding: boolean = true,
9): string {
10 const base64Url = base64String.replace(/\+/g, '-').replace(/\//g, '_');
11
12 if (!stripPadding) {
13 return base64Url;
14 }
15 return base64Url.replace(/=/g, '');
16}
17
18export { toBase64URL };

Callers 7

encryptBlobPayloadFunction · 0.90
generateBlobHolderFunction · 0.90
base64.test.jsFile · 0.90
prepareLargeNotifDataFunction · 0.90
blobServiceUploadFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected