6989a98d75
- Arkitektur: docs/auth/passwordless-architecture.md - Backend: iom/quixzoom-auth-service/ (FastAPI + Redis) - Webb: quixzoom-market-pages/se/login/ (QR-kod + polling) - App: iom/quixzoom-app/src/features/auth/ (push + deep links) Flöde: QR-kod → app-godkännande → webb-inloggad
34 lines
797 B
JavaScript
34 lines
797 B
JavaScript
/* eslint-disable no-underscore-dangle */
|
|
|
|
import { Transform } from 'node:stream';
|
|
|
|
// This is a buffering parser, have a look at StreamingQuerystring.js for a streaming parser
|
|
class QuerystringParser extends Transform {
|
|
constructor(options = {}) {
|
|
super({ readableObjectMode: true });
|
|
this.globalOptions = { ...options };
|
|
this.buffer = '';
|
|
this.bufferLength = 0;
|
|
}
|
|
|
|
_transform(buffer, encoding, callback) {
|
|
this.buffer += buffer.toString('ascii');
|
|
this.bufferLength = this.buffer.length;
|
|
callback();
|
|
}
|
|
|
|
_flush(callback) {
|
|
const fields = new URLSearchParams(this.buffer);
|
|
for (const [key, value] of fields) {
|
|
this.push({
|
|
key,
|
|
value,
|
|
});
|
|
}
|
|
this.buffer = '';
|
|
callback();
|
|
}
|
|
}
|
|
|
|
export default QuerystringParser;
|