blob: b3094dbd22d27acd3a4d05f33e4844b68e527d33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import base64url from 'base64url';
/**
* Decode an authenticator's base64url-encoded clientDataJSON to JSON
*/
export function decodeClientDataJSON(data: string): ClientDataJSON {
const toString = base64url.decode(data);
const clientData: ClientDataJSON = JSON.parse(toString);
return clientData;
}
export type ClientDataJSON = {
type: string;
challenge: string;
origin: string;
crossOrigin?: boolean;
tokenBinding?: {
id?: string;
status: 'present' | 'supported' | 'not-supported';
};
};
|