forked from dfinity/internet-identity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-setup.ts
42 lines (39 loc) · 1.14 KB
/
test-setup.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import crypto from "@trust/webcrypto";
import textEncoding from "text-encoding";
export type WebAuthnCredential = {
credentialId: string;
isResidentCredential: boolean;
privateKey: string;
signCount: number;
};
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace WebdriverIO {
interface Browser {
addVirtualWebAuth: (
protocol: string,
transport: string,
hasResidentKey: boolean,
isUserConsenting: boolean
) => Promise<string>;
removeVirtualWebAuth: (authenticatorId: string) => Promise<void>;
getWebauthnCredentials: (
authenticatorId: string
) => Promise<WebAuthnCredential[]>;
addWebauthnCredential: (
authenticatorId: string,
rpId: string,
credentialId: string,
isResidentCredential: boolean,
privateKey: string,
signCount: number,
userHandle?: string,
largeBlob?: string
) => Promise<void>;
}
}
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
global.crypto.subtle = crypto.subtle;
global.TextEncoder = textEncoding.TextEncoder;