init
This commit is contained in:
commit
d282e2bcae
3481 files changed
+568488
No files matched your search
+17
@@ -0,0 +1,17 @@
|
||||
import { DpopStorage } from './storage';
|
||||
import * as dpopUtils from './utils';
|
||||
export declare class Dpop {
|
||||
protected readonly storage: DpopStorage;
|
||||
constructor(clientId: string);
|
||||
getNonce(id?: string): Promise<string | undefined>;
|
||||
setNonce(nonce: string, id?: string): Promise<void>;
|
||||
protected getOrGenerateKeyPair(): Promise<dpopUtils.KeyPair>;
|
||||
generateProof(params: {
|
||||
url: string;
|
||||
method: string;
|
||||
nonce?: string;
|
||||
accessToken?: string;
|
||||
}): Promise<string>;
|
||||
calculateThumbprint(): Promise<string>;
|
||||
clear(): Promise<void>;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { type KeyPair } from './utils';
|
||||
declare const TABLES: {
|
||||
readonly NONCE: "nonce";
|
||||
readonly KEYPAIR: "keypair";
|
||||
};
|
||||
type Table = (typeof TABLES)[keyof typeof TABLES];
|
||||
export declare class DpopStorage {
|
||||
protected readonly clientId: string;
|
||||
protected dbHandle: IDBDatabase | undefined;
|
||||
constructor(clientId: string);
|
||||
protected getVersion(): number;
|
||||
protected createDbHandle(): Promise<IDBDatabase>;
|
||||
protected getDbHandle(): Promise<IDBDatabase>;
|
||||
protected executeDbRequest<T = unknown>(table: string, mode: IDBTransactionMode, requestFactory: (table: IDBObjectStore) => IDBRequest<T>): Promise<T>;
|
||||
protected buildKey(id?: string): string;
|
||||
setNonce(nonce: string, id?: string): Promise<void>;
|
||||
setKeyPair(keyPair: KeyPair): Promise<void>;
|
||||
protected save(table: Table, key: IDBValidKey, obj: unknown): Promise<void>;
|
||||
findNonce(id?: string): Promise<string | undefined>;
|
||||
findKeyPair(): Promise<KeyPair | undefined>;
|
||||
protected find<T = unknown>(table: Table, key: IDBValidKey): Promise<T | undefined>;
|
||||
protected deleteBy(table: Table, predicate: (key: IDBValidKey) => boolean): Promise<void>;
|
||||
protected deleteByClientId(table: Table, clientId: string): Promise<void>;
|
||||
clearNonces(): Promise<void>;
|
||||
clearKeyPairs(): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import * as dpopLib from 'dpop';
|
||||
export declare const DPOP_NONCE_HEADER = "dpop-nonce";
|
||||
export type KeyPair = Readonly<dpopLib.KeyPair>;
|
||||
type GenerateProofParams = {
|
||||
keyPair: KeyPair;
|
||||
url: string;
|
||||
method: string;
|
||||
nonce?: string;
|
||||
accessToken?: string;
|
||||
};
|
||||
export declare function generateKeyPair(): Promise<KeyPair>;
|
||||
export declare function calculateThumbprint(keyPair: Pick<KeyPair, 'publicKey'>): Promise<string>;
|
||||
export declare function generateProof({ keyPair, url, method, nonce, accessToken }: GenerateProofParams): Promise<string>;
|
||||
export declare function isGrantTypeSupported(grantType: string): boolean;
|
||||
export {};
|
||||
Reference in new issue
Block a user