File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11import { createHmac } from "node:crypto" ;
22import type { AuthResponse } from "./bankid" ;
33
4- type QrCache = {
4+ interface QrCache {
55 startTime : number ;
66 qrStartToken : string ;
77 qrStartSecret : string ;
8- } ;
8+ }
99
1010interface QRGenerateOptions {
1111 /** max cycles */
@@ -14,10 +14,14 @@ interface QRGenerateOptions {
1414 timeout ?: number ;
1515}
1616
17+ export type MapCompatibleCache = Pick < typeof defaultCache , "get" | "delete" > & {
18+ set : ( key : string , value : QrCache ) => void ;
19+ } ;
20+
1721export type QrGeneratorOptions =
1822 | {
1923 /** Provide your own `Map`-compatible caching layer */
20- customCache : typeof defaultCache ;
24+ customCache : MapCompatibleCache ;
2125 }
2226 | {
2327 orderTTL : number ;
@@ -33,7 +37,7 @@ const defaultCache = new Map<string, QrCache>();
3337const TIMEOUT = 60 as const ;
3438
3539export class QrGenerator {
36- cache = defaultCache ;
40+ cache : MapCompatibleCache = defaultCache ;
3741
3842 static defaultOptions = { orderTTL : TIMEOUT } as const ;
3943
You can’t perform that action at this time.
0 commit comments