nid-webauthn-emulator 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/spec/authenticator/authenticator-emulator.spec.d.ts +1 -0
- package/dist/spec/authenticator/authenticator-emulator.spec.js +18 -0
- package/dist/spec/authenticator/ctap-model.spec.d.ts +1 -0
- package/dist/spec/authenticator/ctap-model.spec.js +95 -0
- package/dist/spec/integration/integration.spec.d.ts +1 -0
- package/dist/spec/integration/integration.spec.js +32 -0
- package/dist/spec/integration/passkeys-api-client.d.ts +11 -0
- package/dist/spec/integration/passkeys-api-client.js +2 -0
- package/dist/spec/integration/webauthn-io.d.ts +32 -0
- package/dist/spec/integration/webauthn-io.js +100 -0
- package/dist/spec/libs/browser-injection.spec.d.ts +1 -0
- package/dist/spec/libs/browser-injection.spec.js +15 -0
- package/dist/spec/libs/cose-key.spec.d.ts +1 -0
- package/dist/spec/libs/cose-key.spec.js +47 -0
- package/dist/spec/repository/credential-repository.spec.d.ts +1 -0
- package/dist/spec/repository/credential-repository.spec.js +96 -0
- package/dist/spec/webauthn/cose-key.spec.d.ts +1 -0
- package/dist/spec/webauthn/cose-key.spec.js +74 -0
- package/dist/spec/webauthn/webauthn-emulator.spec.d.ts +1 -0
- package/dist/spec/webauthn/webauthn-emulator.spec.js +222 -0
- package/dist/spec/webauthn/webauthn-model-json.spec.d.ts +1 -0
- package/dist/spec/webauthn/webauthn-model-json.spec.js +103 -0
- package/dist/spec/webauthn/webauthn-model.spec.d.ts +1 -0
- package/dist/spec/webauthn/webauthn-model.spec.js +97 -0
- package/dist/spec/webauthn/webauthn-test-server.d.ts +15 -0
- package/dist/spec/webauthn/webauthn-test-server.js +87 -0
- package/dist/src/authenticator/authenticator-emulator.d.ts +68 -0
- package/dist/src/authenticator/authenticator-emulator.js +304 -0
- package/dist/src/authenticator/ctap-model.d.ts +107 -0
- package/dist/src/authenticator/ctap-model.js +202 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.js +34 -0
- package/dist/src/libs/encode-utils.d.ts +15 -0
- package/dist/src/libs/encode-utils.js +92 -0
- package/dist/src/repository/credentials-file-repository.d.ts +8 -0
- package/dist/src/repository/credentials-file-repository.js +62 -0
- package/dist/src/repository/credentials-memory-repository.d.ts +7 -0
- package/dist/src/repository/credentials-memory-repository.js +20 -0
- package/dist/src/repository/credentials-repository.d.ts +39 -0
- package/dist/src/repository/credentials-repository.js +46 -0
- package/dist/src/test-utils/browser-injection.d.ts +3 -0
- package/dist/src/test-utils/browser-injection.js +52 -0
- package/dist/src/webauthn/cose-key.d.ts +16 -0
- package/dist/src/webauthn/cose-key.js +151 -0
- package/dist/src/webauthn/webauthn-emulator.d.ts +30 -0
- package/dist/src/webauthn/webauthn-emulator.js +142 -0
- package/dist/src/webauthn/webauthn-model-json.d.ts +101 -0
- package/dist/src/webauthn/webauthn-model-json.js +187 -0
- package/dist/src/webauthn/webauthn-model.d.ts +68 -0
- package/dist/src/webauthn/webauthn-model.js +186 -0
- package/package.json +37 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CoseKey = void 0;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const encode_utils_1 = __importDefault(require("../libs/encode-utils"));
|
|
9
|
+
/** @see https://www.w3.org/TR/webauthn/#sctn-encoded-credPubKey-examples */
|
|
10
|
+
class CoseKey {
|
|
11
|
+
kty;
|
|
12
|
+
alg;
|
|
13
|
+
constructor(kty, alg) {
|
|
14
|
+
this.kty = kty;
|
|
15
|
+
this.alg = alg;
|
|
16
|
+
}
|
|
17
|
+
toKeyObject() {
|
|
18
|
+
return node_crypto_1.default.createPublicKey({ format: "jwk", key: this.toJwk() });
|
|
19
|
+
}
|
|
20
|
+
static fromKeyObject(keyObject) {
|
|
21
|
+
return CoseKey.fromJwk(keyObject.export({ format: "jwk" }));
|
|
22
|
+
}
|
|
23
|
+
toDer() {
|
|
24
|
+
return this.toKeyObject().export({ format: "der", type: "spki" });
|
|
25
|
+
}
|
|
26
|
+
static fromDer(der) {
|
|
27
|
+
return CoseKey.fromKeyObject(node_crypto_1.default.createPublicKey({ format: "der", type: "spki", key: Buffer.from(der) }));
|
|
28
|
+
}
|
|
29
|
+
equals(other) {
|
|
30
|
+
return this.toKeyObject().equals(other.toKeyObject());
|
|
31
|
+
}
|
|
32
|
+
static fromBytes(bytes) {
|
|
33
|
+
const coseKey = encode_utils_1.default.decodeCbor(bytes);
|
|
34
|
+
switch (coseKey[3]) {
|
|
35
|
+
case -7:
|
|
36
|
+
return CoseKeyP256.fromBytes(bytes);
|
|
37
|
+
case -8:
|
|
38
|
+
return CoseKeyEd25519.fromBytes(bytes);
|
|
39
|
+
case -257:
|
|
40
|
+
return CoseKeyRSA.fromBytes(bytes);
|
|
41
|
+
default:
|
|
42
|
+
throw new Error("Not supported key type");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static fromJwk(jwk) {
|
|
46
|
+
if (jwk.crv === "P-256")
|
|
47
|
+
return CoseKeyP256.fromJwk(jwk);
|
|
48
|
+
if (jwk.crv === "Ed25519")
|
|
49
|
+
return CoseKeyEd25519.fromJwk(jwk);
|
|
50
|
+
if (jwk.kty === "RSA")
|
|
51
|
+
return CoseKeyRSA.fromJwk(jwk);
|
|
52
|
+
throw new Error("Not supported key type");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.CoseKey = CoseKey;
|
|
56
|
+
class CoseKeyP256 extends CoseKey {
|
|
57
|
+
x;
|
|
58
|
+
y;
|
|
59
|
+
constructor(x, y) {
|
|
60
|
+
super(2, -7);
|
|
61
|
+
this.x = x;
|
|
62
|
+
this.y = y;
|
|
63
|
+
}
|
|
64
|
+
toBytes() {
|
|
65
|
+
const coseKey = {
|
|
66
|
+
1: this.kty,
|
|
67
|
+
3: this.alg,
|
|
68
|
+
[-1]: 1,
|
|
69
|
+
[-2]: this.x,
|
|
70
|
+
[-3]: this.y,
|
|
71
|
+
};
|
|
72
|
+
return encode_utils_1.default.encodeCbor(coseKey);
|
|
73
|
+
}
|
|
74
|
+
toJwk() {
|
|
75
|
+
return {
|
|
76
|
+
kty: "EC",
|
|
77
|
+
crv: "P-256",
|
|
78
|
+
x: encode_utils_1.default.encodeBase64Url(this.x),
|
|
79
|
+
y: encode_utils_1.default.encodeBase64Url(this.y),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
static fromBytes(bytes) {
|
|
83
|
+
const coseKey = encode_utils_1.default.decodeCbor(bytes);
|
|
84
|
+
return new CoseKeyP256(coseKey[-2], coseKey[-3]);
|
|
85
|
+
}
|
|
86
|
+
static fromJwk(jwk) {
|
|
87
|
+
return new CoseKeyP256(encode_utils_1.default.decodeBase64Url(jwk.x), encode_utils_1.default.decodeBase64Url(jwk.y));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
class CoseKeyEd25519 extends CoseKey {
|
|
91
|
+
x;
|
|
92
|
+
constructor(x) {
|
|
93
|
+
super(1, -8);
|
|
94
|
+
this.x = x;
|
|
95
|
+
}
|
|
96
|
+
toBytes() {
|
|
97
|
+
const coseKey = {
|
|
98
|
+
1: this.kty,
|
|
99
|
+
3: this.alg,
|
|
100
|
+
[-1]: 6,
|
|
101
|
+
[-2]: this.x,
|
|
102
|
+
};
|
|
103
|
+
return encode_utils_1.default.encodeCbor(coseKey);
|
|
104
|
+
}
|
|
105
|
+
toJwk() {
|
|
106
|
+
return {
|
|
107
|
+
kty: "OKP",
|
|
108
|
+
crv: "Ed25519",
|
|
109
|
+
x: encode_utils_1.default.encodeBase64Url(this.x),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
static fromBytes(bytes) {
|
|
113
|
+
const coseKey = encode_utils_1.default.decodeCbor(bytes);
|
|
114
|
+
return new CoseKeyEd25519(coseKey[-2]);
|
|
115
|
+
}
|
|
116
|
+
static fromJwk(jwk) {
|
|
117
|
+
return new CoseKeyEd25519(encode_utils_1.default.decodeBase64Url(jwk.x));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
class CoseKeyRSA extends CoseKey {
|
|
121
|
+
n;
|
|
122
|
+
e;
|
|
123
|
+
constructor(n, e) {
|
|
124
|
+
super(3, -257);
|
|
125
|
+
this.n = n;
|
|
126
|
+
this.e = e;
|
|
127
|
+
}
|
|
128
|
+
toBytes() {
|
|
129
|
+
const coseKey = {
|
|
130
|
+
1: this.kty,
|
|
131
|
+
3: this.alg,
|
|
132
|
+
[-1]: this.n,
|
|
133
|
+
[-2]: this.e,
|
|
134
|
+
};
|
|
135
|
+
return encode_utils_1.default.encodeCbor(coseKey);
|
|
136
|
+
}
|
|
137
|
+
toJwk() {
|
|
138
|
+
return {
|
|
139
|
+
kty: "RSA",
|
|
140
|
+
n: encode_utils_1.default.encodeBase64Url(this.n),
|
|
141
|
+
e: encode_utils_1.default.encodeBase64Url(this.e),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
static fromBytes(bytes) {
|
|
145
|
+
const coseKey = encode_utils_1.default.decodeCbor(bytes);
|
|
146
|
+
return new CoseKeyRSA(coseKey[-1], coseKey[-2]);
|
|
147
|
+
}
|
|
148
|
+
static fromJwk(jwk) {
|
|
149
|
+
return new CoseKeyRSA(encode_utils_1.default.decodeBase64Url(jwk.n), encode_utils_1.default.decodeBase64Url(jwk.e));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AuthenticatorEmulator } from "../authenticator/authenticator-emulator";
|
|
2
|
+
import { type AuthenticationResponseJSON, type CreatePublicKeyCredential, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RegistrationResponseJSON, type RequestPublicKeyCredential } from "./webauthn-model-json";
|
|
3
|
+
export type AuthenticatorInfo = {
|
|
4
|
+
version: string;
|
|
5
|
+
aaguid: string;
|
|
6
|
+
options: {
|
|
7
|
+
rk?: boolean;
|
|
8
|
+
uv?: boolean;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare class WebAuthnEmulatorError extends Error {
|
|
12
|
+
}
|
|
13
|
+
export declare class NoPublicKeyError extends WebAuthnEmulatorError {
|
|
14
|
+
}
|
|
15
|
+
export declare class InvalidRpIdError extends WebAuthnEmulatorError {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* WebAuthn emulator
|
|
19
|
+
*/
|
|
20
|
+
export declare class WebAuthnEmulator {
|
|
21
|
+
authenticator: AuthenticatorEmulator;
|
|
22
|
+
constructor(authenticator?: AuthenticatorEmulator);
|
|
23
|
+
getJSON(origin: string, optionsJSON: PublicKeyCredentialRequestOptionsJSON): AuthenticationResponseJSON;
|
|
24
|
+
createJSON(origin: string, optionsJSON: PublicKeyCredentialCreationOptionsJSON): RegistrationResponseJSON;
|
|
25
|
+
getAuthenticatorInfo(): AuthenticatorInfo;
|
|
26
|
+
/** @see https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get */
|
|
27
|
+
get(origin: string, options: CredentialRequestOptions): RequestPublicKeyCredential;
|
|
28
|
+
/** @see https://developer.mozilla.org/ja/docs/Web/API/CredentialsContainer/create */
|
|
29
|
+
create(origin: string, options: CredentialCreationOptions): CreatePublicKeyCredential;
|
|
30
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WebAuthnEmulator = exports.InvalidRpIdError = exports.NoPublicKeyError = exports.WebAuthnEmulatorError = void 0;
|
|
7
|
+
const authenticator_emulator_1 = require("../authenticator/authenticator-emulator");
|
|
8
|
+
const encode_utils_1 = __importDefault(require("../libs/encode-utils"));
|
|
9
|
+
const webauthn_model_json_1 = require("./webauthn-model-json");
|
|
10
|
+
const node_crypto_1 = require("node:crypto");
|
|
11
|
+
const ctap_model_1 = require("../authenticator/ctap-model");
|
|
12
|
+
const webauthn_model_1 = require("./webauthn-model");
|
|
13
|
+
class WebAuthnEmulatorError extends Error {
|
|
14
|
+
}
|
|
15
|
+
exports.WebAuthnEmulatorError = WebAuthnEmulatorError;
|
|
16
|
+
class NoPublicKeyError extends WebAuthnEmulatorError {
|
|
17
|
+
}
|
|
18
|
+
exports.NoPublicKeyError = NoPublicKeyError;
|
|
19
|
+
class InvalidRpIdError extends WebAuthnEmulatorError {
|
|
20
|
+
}
|
|
21
|
+
exports.InvalidRpIdError = InvalidRpIdError;
|
|
22
|
+
/**
|
|
23
|
+
* WebAuthn emulator
|
|
24
|
+
*/
|
|
25
|
+
class WebAuthnEmulator {
|
|
26
|
+
authenticator;
|
|
27
|
+
constructor(authenticator = new authenticator_emulator_1.AuthenticatorEmulator()) {
|
|
28
|
+
this.authenticator = authenticator;
|
|
29
|
+
}
|
|
30
|
+
getJSON(origin, optionsJSON) {
|
|
31
|
+
const options = (0, webauthn_model_json_1.parseRequestOptionsFromJSON)(optionsJSON);
|
|
32
|
+
const response = this.get(origin, { publicKey: options });
|
|
33
|
+
return response.toJSON();
|
|
34
|
+
}
|
|
35
|
+
createJSON(origin, optionsJSON) {
|
|
36
|
+
const options = (0, webauthn_model_json_1.parseCreationOptionsFromJSON)(optionsJSON);
|
|
37
|
+
const response = this.create(origin, { publicKey: options });
|
|
38
|
+
return response.toJSON();
|
|
39
|
+
}
|
|
40
|
+
getAuthenticatorInfo() {
|
|
41
|
+
const authenticatorInfo = (0, ctap_model_1.unpackGetInfoResponse)(this.authenticator.command({ command: ctap_model_1.CTAP_COMMAND.authenticatorGetInfo }));
|
|
42
|
+
return {
|
|
43
|
+
version: authenticatorInfo.versions.join(", "),
|
|
44
|
+
aaguid: encode_utils_1.default.encodeBase64Url(authenticatorInfo.aaguid),
|
|
45
|
+
options: {
|
|
46
|
+
rk: authenticatorInfo.options?.rk,
|
|
47
|
+
uv: authenticatorInfo.options?.uv,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** @see https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get */
|
|
52
|
+
get(origin, options) {
|
|
53
|
+
if (!options.publicKey)
|
|
54
|
+
throw new NoPublicKeyError("PublicKeyCredentialCreationOptions are required");
|
|
55
|
+
const rpId = new webauthn_model_1.RpId(options.publicKey.rpId ?? new URL(origin).hostname);
|
|
56
|
+
if (!rpId.validate(origin))
|
|
57
|
+
throw new InvalidRpIdError(`Invalid rpId: RP_ID=${rpId.value}, ORIGIN=${origin}`);
|
|
58
|
+
const clientData = {
|
|
59
|
+
type: "webauthn.get",
|
|
60
|
+
challenge: encode_utils_1.default.encodeBase64Url(options.publicKey.challenge),
|
|
61
|
+
origin,
|
|
62
|
+
crossOrigin: false,
|
|
63
|
+
};
|
|
64
|
+
const authenticatorRequest = (0, ctap_model_1.packGetAssertionRequest)({
|
|
65
|
+
rpId: rpId.value,
|
|
66
|
+
clientDataHash: (0, node_crypto_1.createHash)("sha256").update(JSON.stringify(clientData)).digest(),
|
|
67
|
+
allowList: options.publicKey.allowCredentials,
|
|
68
|
+
options: (0, webauthn_model_1.toFido2RequestOptions)(options.publicKey.userVerification),
|
|
69
|
+
});
|
|
70
|
+
const authenticatorResponse = (0, ctap_model_1.unpackGetAssertionResponse)(this.authenticator.command(authenticatorRequest));
|
|
71
|
+
const responseId = authenticatorResponse.credential?.id ?? options.publicKey.allowCredentials?.[0]?.id;
|
|
72
|
+
const authData = (0, webauthn_model_1.unpackAuthenticatorData)(authenticatorResponse.authData);
|
|
73
|
+
const rawId = encode_utils_1.default.bufferSourceToUint8Array(responseId);
|
|
74
|
+
const publicKeyCredential = {
|
|
75
|
+
id: encode_utils_1.default.encodeBase64Url(rawId),
|
|
76
|
+
type: "public-key",
|
|
77
|
+
rawId,
|
|
78
|
+
response: {
|
|
79
|
+
clientDataJSON: encode_utils_1.default.strToUint8Array(JSON.stringify(clientData)),
|
|
80
|
+
authenticatorData: (0, webauthn_model_1.packAuthenticatorData)(authData),
|
|
81
|
+
signature: authenticatorResponse.signature,
|
|
82
|
+
userHandle: authenticatorResponse.user
|
|
83
|
+
? encode_utils_1.default.bufferSourceToUint8Array(authenticatorResponse.user.id)
|
|
84
|
+
: null,
|
|
85
|
+
},
|
|
86
|
+
authenticatorAttachment: null,
|
|
87
|
+
getClientExtensionResults: () => ({ credProps: { rk: authenticatorResponse.user !== undefined } }),
|
|
88
|
+
toJSON: () => (0, webauthn_model_json_1.toAuthenticationResponseJSON)(publicKeyCredential),
|
|
89
|
+
};
|
|
90
|
+
return publicKeyCredential;
|
|
91
|
+
}
|
|
92
|
+
/** @see https://developer.mozilla.org/ja/docs/Web/API/CredentialsContainer/create */
|
|
93
|
+
create(origin, options) {
|
|
94
|
+
if (!options.publicKey)
|
|
95
|
+
throw new NoPublicKeyError("PublicKeyCredentialCreationOptions are required");
|
|
96
|
+
const rpId = new webauthn_model_1.RpId(options.publicKey.rp.id ?? new URL(origin).hostname);
|
|
97
|
+
if (!rpId.validate(origin))
|
|
98
|
+
throw new InvalidRpIdError(`Invalid rpId: RP_ID=${rpId.value}, ORIGIN=${origin}`);
|
|
99
|
+
const clientData = {
|
|
100
|
+
challenge: encode_utils_1.default.encodeBase64Url(options.publicKey.challenge),
|
|
101
|
+
origin,
|
|
102
|
+
type: "webauthn.create",
|
|
103
|
+
crossOrigin: false,
|
|
104
|
+
};
|
|
105
|
+
const clientDataJSON = JSON.stringify(clientData);
|
|
106
|
+
const authenticatorRequest = (0, ctap_model_1.packMakeCredentialRequest)({
|
|
107
|
+
clientDataHash: (0, node_crypto_1.createHash)("sha256").update(clientDataJSON).digest(),
|
|
108
|
+
rp: { name: options.publicKey.rp.name, id: rpId.value },
|
|
109
|
+
user: options.publicKey.user,
|
|
110
|
+
pubKeyCredParams: options.publicKey.pubKeyCredParams,
|
|
111
|
+
excludeList: options.publicKey.excludeCredentials,
|
|
112
|
+
options: (0, webauthn_model_1.toFido2CreateOptions)(options.publicKey.authenticatorSelection),
|
|
113
|
+
});
|
|
114
|
+
const authenticatorResponse = (0, ctap_model_1.unpackMakeCredentialResponse)(this.authenticator.command(authenticatorRequest));
|
|
115
|
+
const authData = (0, webauthn_model_1.unpackAuthenticatorData)(authenticatorResponse.authData);
|
|
116
|
+
const attestedCredentialData = authData.attestedCredentialData;
|
|
117
|
+
const attestationObject = {
|
|
118
|
+
fmt: "none",
|
|
119
|
+
attStmt: {},
|
|
120
|
+
authData,
|
|
121
|
+
};
|
|
122
|
+
const response = {
|
|
123
|
+
attestationObject: (0, webauthn_model_1.packAttestationObject)(attestationObject),
|
|
124
|
+
clientDataJSON: encode_utils_1.default.strToUint8Array(clientDataJSON),
|
|
125
|
+
getAuthenticatorData: () => (0, webauthn_model_1.packAuthenticatorData)(authData),
|
|
126
|
+
getPublicKey: () => attestedCredentialData.credentialPublicKey.toDer(),
|
|
127
|
+
getPublicKeyAlgorithm: () => attestedCredentialData.credentialPublicKey.alg,
|
|
128
|
+
getTransports: () => this.authenticator.params.transports,
|
|
129
|
+
};
|
|
130
|
+
const publicKeyCredential = {
|
|
131
|
+
id: encode_utils_1.default.encodeBase64Url(attestedCredentialData.credentialId),
|
|
132
|
+
type: "public-key",
|
|
133
|
+
rawId: attestedCredentialData.credentialId,
|
|
134
|
+
response,
|
|
135
|
+
authenticatorAttachment: null,
|
|
136
|
+
getClientExtensionResults: () => ({ credProps: { rk: true } }),
|
|
137
|
+
toJSON: () => (0, webauthn_model_json_1.toRegistrationResponseJSON)(publicKeyCredential),
|
|
138
|
+
};
|
|
139
|
+
return publicKeyCredential;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.WebAuthnEmulator = WebAuthnEmulator;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
type Base64urlString = string;
|
|
2
|
+
type AuthenticationExtensionsClientInputsJSON = object;
|
|
3
|
+
type AuthenticationExtensionsClientOutputsJSON = object;
|
|
4
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-publickeycredentialcreationoptionsjson */
|
|
5
|
+
export interface PublicKeyCredentialCreationOptionsJSON {
|
|
6
|
+
readonly rp: PublicKeyCredentialRpEntity;
|
|
7
|
+
readonly user: PublicKeyCredentialUserEntityJSON;
|
|
8
|
+
readonly challenge: Base64urlString;
|
|
9
|
+
readonly pubKeyCredParams: PublicKeyCredentialParameters[];
|
|
10
|
+
readonly timeout?: number;
|
|
11
|
+
readonly excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
12
|
+
readonly authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
13
|
+
readonly hints?: string[];
|
|
14
|
+
readonly attestation?: string;
|
|
15
|
+
readonly attestationFormats?: string[];
|
|
16
|
+
readonly extensions?: AuthenticationExtensionsClientInputsJSON;
|
|
17
|
+
}
|
|
18
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-publickeycredentialuserentityjson */
|
|
19
|
+
export interface PublicKeyCredentialUserEntityJSON {
|
|
20
|
+
readonly id: Base64urlString;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly displayName: string;
|
|
23
|
+
}
|
|
24
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-publickeycredentialdescriptorjson */
|
|
25
|
+
export interface PublicKeyCredentialDescriptorJSON {
|
|
26
|
+
readonly id: Base64urlString;
|
|
27
|
+
readonly type: string;
|
|
28
|
+
transports?: string[];
|
|
29
|
+
}
|
|
30
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-parseCreationOptionsFromJSON */
|
|
31
|
+
export declare function parseCreationOptionsFromJSON(optionsJSON: PublicKeyCredentialCreationOptionsJSON): PublicKeyCredentialCreationOptions;
|
|
32
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-publickeycredentialrequestoptionsjson */
|
|
33
|
+
export interface PublicKeyCredentialRequestOptionsJSON {
|
|
34
|
+
readonly challenge: Base64urlString;
|
|
35
|
+
readonly timeout?: number;
|
|
36
|
+
readonly rpId?: string;
|
|
37
|
+
readonly allowCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
38
|
+
readonly userVerification?: string;
|
|
39
|
+
readonly hints?: string[];
|
|
40
|
+
readonly attestation?: string;
|
|
41
|
+
readonly attestationFormats?: string[];
|
|
42
|
+
readonly extensions?: AuthenticationExtensionsClientInputsJSON;
|
|
43
|
+
}
|
|
44
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-parseRequestOptionsFromJSON */
|
|
45
|
+
export declare function parseRequestOptionsFromJSON(optionsJSON: PublicKeyCredentialRequestOptionsJSON): PublicKeyCredentialRequestOptions;
|
|
46
|
+
export interface CreatePublicKeyCredential extends PublicKeyCredential {
|
|
47
|
+
response: AuthenticatorAttestationResponse;
|
|
48
|
+
toJSON(): RegistrationResponseJSON;
|
|
49
|
+
}
|
|
50
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-registrationresponsejson */
|
|
51
|
+
export interface RegistrationResponseJSON {
|
|
52
|
+
readonly id: Base64urlString;
|
|
53
|
+
readonly rawId: Base64urlString;
|
|
54
|
+
readonly response: AuthenticatorAttestationResponseJSON;
|
|
55
|
+
readonly authenticatorAttachment?: AuthenticatorAttachment;
|
|
56
|
+
readonly clientExtensionResults: AuthenticationExtensionsClientOutputsJSON;
|
|
57
|
+
readonly type: PublicKeyCredentialType;
|
|
58
|
+
}
|
|
59
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-authenticatorattestationresponsejson */
|
|
60
|
+
interface AuthenticatorAttestationResponseJSON {
|
|
61
|
+
readonly clientDataJSON: Base64urlString;
|
|
62
|
+
readonly authenticatorData: Base64urlString;
|
|
63
|
+
readonly transports: AuthenticatorTransport[];
|
|
64
|
+
readonly publicKey?: Base64urlString;
|
|
65
|
+
readonly publicKeyAlgorithm?: number;
|
|
66
|
+
readonly attestationObject: Base64urlString;
|
|
67
|
+
}
|
|
68
|
+
export interface RequestPublicKeyCredential extends PublicKeyCredential {
|
|
69
|
+
response: AuthenticatorAssertionResponse;
|
|
70
|
+
toJSON(): AuthenticationResponseJSON;
|
|
71
|
+
}
|
|
72
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-authenticationresponsejson */
|
|
73
|
+
export interface AuthenticationResponseJSON {
|
|
74
|
+
readonly id: Base64urlString;
|
|
75
|
+
readonly rawId: Base64urlString;
|
|
76
|
+
readonly response: AuthenticatorAssertionResponseJSON;
|
|
77
|
+
readonly authenticatorAttachment?: AuthenticatorAttachment;
|
|
78
|
+
readonly clientExtensionResults: AuthenticationExtensionsClientOutputsJSON;
|
|
79
|
+
readonly type: PublicKeyCredentialType;
|
|
80
|
+
}
|
|
81
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictdef-authenticatorassertionresponsejson */
|
|
82
|
+
interface AuthenticatorAssertionResponseJSON {
|
|
83
|
+
readonly clientDataJSON: Base64urlString;
|
|
84
|
+
readonly authenticatorData: Base64urlString;
|
|
85
|
+
readonly signature: Base64urlString;
|
|
86
|
+
readonly userHandle?: Base64urlString;
|
|
87
|
+
readonly attestationObject?: Base64urlString;
|
|
88
|
+
}
|
|
89
|
+
export declare function toRegistrationResponseJSON(credential: PublicKeyCredential): RegistrationResponseJSON;
|
|
90
|
+
export declare function toAuthenticationResponseJSON(credential: PublicKeyCredential): AuthenticationResponseJSON;
|
|
91
|
+
export declare function toCreationOptionsJSON(options: PublicKeyCredentialCreationOptions): PublicKeyCredentialCreationOptionsJSON;
|
|
92
|
+
export declare function toRequestOptionsJSON(options: PublicKeyCredentialRequestOptions): PublicKeyCredentialRequestOptionsJSON;
|
|
93
|
+
export declare function parseRegistrationResponseFromJSON(options: RegistrationResponseJSON): CreatePublicKeyCredential;
|
|
94
|
+
export declare function parseAuthenticationResponseFromJSON(options: AuthenticationResponseJSON): RequestPublicKeyCredential;
|
|
95
|
+
export declare function toPublicKeyCredentialDescriptorJSON(credential: PublicKeyCredentialDescriptor): PublicKeyCredentialDescriptorJSON;
|
|
96
|
+
export declare function parsePublicKeyCredentialDescriptorFromJSON(credential: PublicKeyCredentialDescriptorJSON): PublicKeyCredentialDescriptor;
|
|
97
|
+
export declare function toPublicKeyCredentialUserEntityJSON(user: PublicKeyCredentialUserEntity): PublicKeyCredentialUserEntityJSON;
|
|
98
|
+
export declare function parsePublicKeyCredentialUserEntityFromJSON(user: PublicKeyCredentialUserEntityJSON): PublicKeyCredentialUserEntity;
|
|
99
|
+
export declare function encodeBase64Url(buffer: BufferSource): string;
|
|
100
|
+
export declare function decodeBase64Url(base64Url: string): ArrayBuffer;
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Do not import anything here, it should be a standalone file
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.parseCreationOptionsFromJSON = parseCreationOptionsFromJSON;
|
|
5
|
+
exports.parseRequestOptionsFromJSON = parseRequestOptionsFromJSON;
|
|
6
|
+
exports.toRegistrationResponseJSON = toRegistrationResponseJSON;
|
|
7
|
+
exports.toAuthenticationResponseJSON = toAuthenticationResponseJSON;
|
|
8
|
+
exports.toCreationOptionsJSON = toCreationOptionsJSON;
|
|
9
|
+
exports.toRequestOptionsJSON = toRequestOptionsJSON;
|
|
10
|
+
exports.parseRegistrationResponseFromJSON = parseRegistrationResponseFromJSON;
|
|
11
|
+
exports.parseAuthenticationResponseFromJSON = parseAuthenticationResponseFromJSON;
|
|
12
|
+
exports.toPublicKeyCredentialDescriptorJSON = toPublicKeyCredentialDescriptorJSON;
|
|
13
|
+
exports.parsePublicKeyCredentialDescriptorFromJSON = parsePublicKeyCredentialDescriptorFromJSON;
|
|
14
|
+
exports.toPublicKeyCredentialUserEntityJSON = toPublicKeyCredentialUserEntityJSON;
|
|
15
|
+
exports.parsePublicKeyCredentialUserEntityFromJSON = parsePublicKeyCredentialUserEntityFromJSON;
|
|
16
|
+
exports.encodeBase64Url = encodeBase64Url;
|
|
17
|
+
exports.decodeBase64Url = decodeBase64Url;
|
|
18
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-parseCreationOptionsFromJSON */
|
|
19
|
+
function parseCreationOptionsFromJSON(optionsJSON) {
|
|
20
|
+
return {
|
|
21
|
+
rp: optionsJSON.rp,
|
|
22
|
+
user: parsePublicKeyCredentialUserEntityFromJSON(optionsJSON.user),
|
|
23
|
+
challenge: decodeBase64Url(optionsJSON.challenge),
|
|
24
|
+
pubKeyCredParams: optionsJSON.pubKeyCredParams,
|
|
25
|
+
timeout: optionsJSON.timeout,
|
|
26
|
+
excludeCredentials: optionsJSON.excludeCredentials?.map(parsePublicKeyCredentialDescriptorFromJSON),
|
|
27
|
+
authenticatorSelection: optionsJSON.authenticatorSelection,
|
|
28
|
+
attestation: optionsJSON.attestation,
|
|
29
|
+
extensions: optionsJSON.extensions,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-parseRequestOptionsFromJSON */
|
|
33
|
+
function parseRequestOptionsFromJSON(optionsJSON) {
|
|
34
|
+
return {
|
|
35
|
+
challenge: decodeBase64Url(optionsJSON.challenge),
|
|
36
|
+
timeout: optionsJSON.timeout,
|
|
37
|
+
rpId: optionsJSON.rpId,
|
|
38
|
+
allowCredentials: optionsJSON.allowCredentials?.map(parsePublicKeyCredentialDescriptorFromJSON),
|
|
39
|
+
userVerification: optionsJSON.userVerification,
|
|
40
|
+
extensions: optionsJSON.extensions,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Not standard mapping functions
|
|
44
|
+
function toRegistrationResponseJSON(credential) {
|
|
45
|
+
const attestationResponse = credential.response;
|
|
46
|
+
const publicKey = attestationResponse.getPublicKey();
|
|
47
|
+
const algorithm = attestationResponse.getPublicKeyAlgorithm();
|
|
48
|
+
const responseJSON = {
|
|
49
|
+
clientDataJSON: encodeBase64Url(attestationResponse.clientDataJSON),
|
|
50
|
+
authenticatorData: encodeBase64Url(attestationResponse.getAuthenticatorData()),
|
|
51
|
+
transports: attestationResponse.getTransports(),
|
|
52
|
+
publicKey: publicKey ? encodeBase64Url(publicKey) : undefined,
|
|
53
|
+
publicKeyAlgorithm: algorithm === -1 ? undefined : algorithm,
|
|
54
|
+
attestationObject: encodeBase64Url(attestationResponse.attestationObject),
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
id: credential.id,
|
|
58
|
+
rawId: credential.id,
|
|
59
|
+
response: responseJSON,
|
|
60
|
+
authenticatorAttachment: credential.authenticatorAttachment === null
|
|
61
|
+
? undefined
|
|
62
|
+
: credential.authenticatorAttachment,
|
|
63
|
+
clientExtensionResults: credential.getClientExtensionResults(),
|
|
64
|
+
type: credential.type,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function toAuthenticationResponseJSON(credential) {
|
|
68
|
+
const assertionResponse = credential.response;
|
|
69
|
+
const responseJson = {
|
|
70
|
+
clientDataJSON: encodeBase64Url(assertionResponse.clientDataJSON),
|
|
71
|
+
authenticatorData: encodeBase64Url(assertionResponse.authenticatorData),
|
|
72
|
+
signature: encodeBase64Url(assertionResponse.signature),
|
|
73
|
+
userHandle: assertionResponse.userHandle ? encodeBase64Url(assertionResponse.userHandle) : undefined,
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
id: credential.id,
|
|
77
|
+
rawId: credential.id,
|
|
78
|
+
response: responseJson,
|
|
79
|
+
authenticatorAttachment: credential.authenticatorAttachment === null
|
|
80
|
+
? undefined
|
|
81
|
+
: credential.authenticatorAttachment,
|
|
82
|
+
clientExtensionResults: credential.getClientExtensionResults(),
|
|
83
|
+
type: credential.type,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function toCreationOptionsJSON(options) {
|
|
87
|
+
return {
|
|
88
|
+
rp: options.rp,
|
|
89
|
+
user: toPublicKeyCredentialUserEntityJSON(options.user),
|
|
90
|
+
challenge: encodeBase64Url(options.challenge),
|
|
91
|
+
pubKeyCredParams: options.pubKeyCredParams,
|
|
92
|
+
timeout: options.timeout,
|
|
93
|
+
excludeCredentials: options.excludeCredentials?.map(toPublicKeyCredentialDescriptorJSON),
|
|
94
|
+
authenticatorSelection: options.authenticatorSelection,
|
|
95
|
+
attestation: options.attestation,
|
|
96
|
+
extensions: options.extensions,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function toRequestOptionsJSON(options) {
|
|
100
|
+
return {
|
|
101
|
+
challenge: encodeBase64Url(options.challenge),
|
|
102
|
+
timeout: options.timeout,
|
|
103
|
+
rpId: options.rpId,
|
|
104
|
+
allowCredentials: options.allowCredentials?.map(toPublicKeyCredentialDescriptorJSON),
|
|
105
|
+
userVerification: options.userVerification,
|
|
106
|
+
extensions: options.extensions,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function parseRegistrationResponseFromJSON(options) {
|
|
110
|
+
return {
|
|
111
|
+
id: options.id,
|
|
112
|
+
rawId: decodeBase64Url(options.rawId),
|
|
113
|
+
response: {
|
|
114
|
+
clientDataJSON: decodeBase64Url(options.response.clientDataJSON),
|
|
115
|
+
getAuthenticatorData: () => decodeBase64Url(options.response.authenticatorData),
|
|
116
|
+
getTransports: () => options.response.transports,
|
|
117
|
+
getPublicKey: () => (options.response.publicKey ? decodeBase64Url(options.response.publicKey) : null),
|
|
118
|
+
getPublicKeyAlgorithm: () => options.response.publicKeyAlgorithm ?? -1,
|
|
119
|
+
attestationObject: decodeBase64Url(options.response.attestationObject),
|
|
120
|
+
},
|
|
121
|
+
authenticatorAttachment: options.authenticatorAttachment ?? null,
|
|
122
|
+
getClientExtensionResults: () => options.clientExtensionResults,
|
|
123
|
+
toJSON: () => options,
|
|
124
|
+
type: options.type,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function parseAuthenticationResponseFromJSON(options) {
|
|
128
|
+
return {
|
|
129
|
+
id: options.id,
|
|
130
|
+
rawId: decodeBase64Url(options.rawId),
|
|
131
|
+
response: {
|
|
132
|
+
clientDataJSON: decodeBase64Url(options.response.clientDataJSON),
|
|
133
|
+
authenticatorData: decodeBase64Url(options.response.authenticatorData),
|
|
134
|
+
signature: decodeBase64Url(options.response.signature),
|
|
135
|
+
userHandle: options.response.userHandle ? decodeBase64Url(options.response.userHandle) : null,
|
|
136
|
+
},
|
|
137
|
+
authenticatorAttachment: options.authenticatorAttachment ?? null,
|
|
138
|
+
getClientExtensionResults: () => options.clientExtensionResults,
|
|
139
|
+
toJSON: () => options,
|
|
140
|
+
type: options.type,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function toPublicKeyCredentialDescriptorJSON(credential) {
|
|
144
|
+
return {
|
|
145
|
+
id: encodeBase64Url(credential.id),
|
|
146
|
+
type: credential.type,
|
|
147
|
+
transports: credential.transports,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function parsePublicKeyCredentialDescriptorFromJSON(credential) {
|
|
151
|
+
return {
|
|
152
|
+
id: decodeBase64Url(credential.id),
|
|
153
|
+
type: credential.type,
|
|
154
|
+
transports: credential.transports,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function toPublicKeyCredentialUserEntityJSON(user) {
|
|
158
|
+
return { ...user, id: encodeBase64Url(user.id) };
|
|
159
|
+
}
|
|
160
|
+
function parsePublicKeyCredentialUserEntityFromJSON(user) {
|
|
161
|
+
return { ...user, id: decodeBase64Url(user.id) };
|
|
162
|
+
}
|
|
163
|
+
// Helper functions
|
|
164
|
+
function encodeBase64Url(buffer) {
|
|
165
|
+
const toArrayBuffer = (bufferSource) => {
|
|
166
|
+
if (bufferSource instanceof ArrayBuffer) {
|
|
167
|
+
return bufferSource;
|
|
168
|
+
}
|
|
169
|
+
return bufferSource.buffer.slice(bufferSource.byteOffset, bufferSource.byteOffset + bufferSource.byteLength);
|
|
170
|
+
};
|
|
171
|
+
return btoa(String.fromCharCode(...new Uint8Array(toArrayBuffer(buffer))))
|
|
172
|
+
.replace(/\+/g, "-")
|
|
173
|
+
.replace(/\//g, "_")
|
|
174
|
+
.replace(/=/g, "");
|
|
175
|
+
}
|
|
176
|
+
function decodeBase64Url(base64Url) {
|
|
177
|
+
const base64 = base64Url
|
|
178
|
+
.replace(/-/g, "+")
|
|
179
|
+
.replace(/_/g, "/")
|
|
180
|
+
.padEnd(base64Url.length + ((4 - (base64Url.length % 4)) % 4), "=");
|
|
181
|
+
const binaryString = atob(base64);
|
|
182
|
+
const byteArray = new Uint8Array(binaryString.length);
|
|
183
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
184
|
+
byteArray[i] = binaryString.charCodeAt(i);
|
|
185
|
+
}
|
|
186
|
+
return byteArray.buffer;
|
|
187
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AuthenticatorInteractionOptions, AuthenticatorOptions } from "../authenticator/ctap-model";
|
|
2
|
+
import { CoseKey } from "./cose-key";
|
|
3
|
+
export declare class RpId {
|
|
4
|
+
readonly value: string;
|
|
5
|
+
constructor(value: string);
|
|
6
|
+
get hash(): Uint8Array;
|
|
7
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-validating-origin */
|
|
8
|
+
validate(origin: string): boolean;
|
|
9
|
+
}
|
|
10
|
+
/** @see https://www.w3.org/TR/webauthn-3/#public-key-credential-source */
|
|
11
|
+
export type PublicKeyCredentialSource = {
|
|
12
|
+
type: "public-key";
|
|
13
|
+
id: Uint8Array;
|
|
14
|
+
privateKey: Uint8Array;
|
|
15
|
+
rpId: RpId;
|
|
16
|
+
userHandle?: Uint8Array;
|
|
17
|
+
};
|
|
18
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-attested-credential-data */
|
|
19
|
+
export type AttestedCredentialData = {
|
|
20
|
+
aaguid: Uint8Array;
|
|
21
|
+
credentialId: Uint8Array;
|
|
22
|
+
credentialPublicKey: CoseKey;
|
|
23
|
+
};
|
|
24
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-authenticator-data */
|
|
25
|
+
export type AuthenticatorData = {
|
|
26
|
+
rpIdHash: Uint8Array;
|
|
27
|
+
flags: {
|
|
28
|
+
userPresent?: boolean;
|
|
29
|
+
userVerified?: boolean;
|
|
30
|
+
backupEligibility?: boolean;
|
|
31
|
+
backupState?: boolean;
|
|
32
|
+
attestedCredentialData?: boolean;
|
|
33
|
+
extensionData?: boolean;
|
|
34
|
+
};
|
|
35
|
+
signCount: number;
|
|
36
|
+
attestedCredentialData?: AttestedCredentialData;
|
|
37
|
+
extensions?: object;
|
|
38
|
+
};
|
|
39
|
+
/** @see https://www.w3.org/TR/webauthn-3/#attestation-object */
|
|
40
|
+
export type AttestationObject = {
|
|
41
|
+
fmt: string;
|
|
42
|
+
attStmt: object;
|
|
43
|
+
authData: AuthenticatorData;
|
|
44
|
+
};
|
|
45
|
+
/** @see https://www.w3.org/TR/webauthn-3/#dictionary-client-data */
|
|
46
|
+
export type CollectedClientData = {
|
|
47
|
+
type: "webauthn.get" | "webauthn.create";
|
|
48
|
+
challenge: string;
|
|
49
|
+
origin: string;
|
|
50
|
+
crossOrigin: boolean;
|
|
51
|
+
};
|
|
52
|
+
export declare function packAttestationObject(attestationObject: AttestationObject): Uint8Array;
|
|
53
|
+
export declare function packAuthenticatorData(authData: AuthenticatorData): Uint8Array;
|
|
54
|
+
export declare function unpackAttestationObject(attestationObject: Uint8Array): AttestationObject;
|
|
55
|
+
export declare function unpackAuthenticatorData(authData: Uint8Array): AuthenticatorData;
|
|
56
|
+
export type PublicKeyCredentialSourceJSON = {
|
|
57
|
+
type: "public-key";
|
|
58
|
+
id: string;
|
|
59
|
+
privateKey: string;
|
|
60
|
+
rpId: string;
|
|
61
|
+
userHandle?: string;
|
|
62
|
+
};
|
|
63
|
+
export declare function toPublickeyCredentialSourceJSON(credentialSource: PublicKeyCredentialSource): PublicKeyCredentialSourceJSON;
|
|
64
|
+
export declare function parsePublicKeyCredentialSourceFromJSON(json: PublicKeyCredentialSourceJSON): PublicKeyCredentialSource;
|
|
65
|
+
/** @see https://www.w3.org/TR/webauthn-3/#CreateCred-async-loop */
|
|
66
|
+
export declare function toFido2CreateOptions(criteria?: AuthenticatorSelectionCriteria): AuthenticatorOptions;
|
|
67
|
+
/** @see https://www.w3.org/TR/webauthn-3/#sctn-issuing-cred-request-to-authenticator */
|
|
68
|
+
export declare function toFido2RequestOptions(require?: UserVerificationRequirement): AuthenticatorInteractionOptions;
|