Skip to content

Commit 832d30f

Browse files
committed
Add manual trimming
1 parent 21cd69b commit 832d30f

File tree

1 file changed

+6
-2
lines changed
  • packages/rules-unit-testing/src/api

1 file changed

+6
-2
lines changed

packages/rules-unit-testing/src/api/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ export type FirebaseEmulatorOptions = {
158158
};
159159
};
160160

161+
function trimmedBase64Encode(val: string): string {
162+
return base64Encode(val).split("=")[0];
163+
}
164+
161165
function createUnsecuredJwt(token: TokenOptions, projectId?: string): string {
162166
// Unsecured JWTs use "none" as the algorithm.
163167
const header = {
@@ -199,8 +203,8 @@ function createUnsecuredJwt(token: TokenOptions, projectId?: string): string {
199203
// Unsecured JWTs use the empty string as a signature.
200204
const signature = '';
201205
return [
202-
base64Encode(JSON.stringify(header)),
203-
base64Encode(JSON.stringify(payload)),
206+
trimmedBase64Encode(JSON.stringify(header)),
207+
trimmedBase64Encode(JSON.stringify(payload)),
204208
signature
205209
].join('.');
206210
}

0 commit comments

Comments
 (0)