Skip to content

Commit

Permalink
fix: 🐛 Fixes base64 iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorlarsson committed Sep 10, 2021
1 parent 5017295 commit 52d7341
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"x-xsrf-token": "SfONpuvKXD1XHML3Kelvm3easB6Xn3xtbVPG52jdpc3Q7sRxJv7_6wfjo1qS3NOQWkfCvfPkJpJg0QIBmo358o7FdQY2aWvUOxA9MU2Fl0E1",
"y-xsrf-token11": "FyXUbtZUE2iT09J7FOLTpfZ_onjbj3WEIO6jOY9B1KaZzMrAs4WS03AuWbQhmKyCEX2inTPVDzyPc58tN2EM4L1vYD6aH_zhlc7gVo9jaPdLKQc4qnE6ue184cSamKE0",
"topology-key": "mettle ohmmeter alible camper stultify sap sunbeam pussy tithable colorant scleroma trireme niggard heather wacke abide rustic armature selfheal gyrus|",
"topology-short-key": "nancyzymosiszygosis"
"topology-short-key": "nancyzymosiszygosis",
"topology-base64-iterations": "8"
},
"referrer": "https://etjanst.stockholm.se/",
"referrerPolicy": "strict-origin-when-cross-origin",
Expand Down
9 changes: 7 additions & 2 deletions lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ export class Api extends EventEmitter {
let topo = `${config.headers['topology-key']}${currentTime}`

const secretNumberString = `${config.headers['topology-short-key']}`
const numberOfBase64Iterations = 9

let numberOfBase64Iterations = 0;

if(config.headers['topology-base64-iterations']) {
numberOfBase64Iterations = parseInt(config.headers['topology-base64-iterations']);
}

for (let i = 0; i < numberOfBase64Iterations; i += 1) {
topo = base64.encode(topo)
Expand All @@ -336,7 +341,7 @@ export class Api extends EventEmitter {
return finalTopology
}

public async getChildren(): Promise<EtjanstChild[]> {
public async async async getChildren(): Promise<EtjanstChild[]> {
if (this.isFake) return fakeResponse(fake.children())

// const cdnUrl = await this.retrieveCdnUrl()
Expand Down

0 comments on commit 52d7341

Please sign in to comment.