@turnkey/http 0.17.1 → 0.18.1
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/CHANGELOG.md +13 -0
- package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.d.ts +4776 -555
- package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.d.ts.map +1 -1
- package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.js +492 -1
- package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.js.map +1 -1
- package/dist/__generated__/services/coordinator/public/v1/public_api.swagger.json +822 -60
- package/dist/__generated__/services/coordinator/public/v1/public_api.types.d.ts +416 -13
- package/dist/__generated__/services/coordinator/public/v1/public_api.types.d.ts.map +1 -1
- package/dist/base.d.ts +10 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +29 -2
- package/dist/base.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -1
- package/dist/config.js.map +1 -1
- package/dist/encoding.d.ts +1 -0
- package/dist/encoding.d.ts.map +1 -1
- package/dist/encoding.js +6 -8
- package/dist/encoding.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/shared.d.ts +5 -0
- package/dist/shared.d.ts.map +1 -1
- package/dist/webauthn-json/api.d.ts +13 -0
- package/dist/webauthn-json/api.d.ts.map +1 -0
- package/dist/webauthn-json/api.js +33 -0
- package/dist/webauthn-json/api.js.map +1 -0
- package/dist/webauthn-json/base64url.d.ts +4 -0
- package/dist/webauthn-json/base64url.d.ts.map +1 -0
- package/dist/webauthn-json/base64url.js +37 -0
- package/dist/webauthn-json/base64url.js.map +1 -0
- package/dist/webauthn-json/convert.d.ts +8 -0
- package/dist/webauthn-json/convert.d.ts.map +1 -0
- package/dist/webauthn-json/convert.js +69 -0
- package/dist/webauthn-json/convert.js.map +1 -0
- package/dist/webauthn-json/index.d.ts +14 -0
- package/dist/webauthn-json/index.d.ts.map +1 -0
- package/dist/webauthn-json/index.js +19 -0
- package/dist/webauthn-json/index.js.map +1 -0
- package/dist/webauthn-json/json.d.ts +92 -0
- package/dist/webauthn-json/json.d.ts.map +1 -0
- package/dist/webauthn-json/json.js +3 -0
- package/dist/webauthn-json/json.js.map +1 -0
- package/dist/webauthn-json/schema-format.d.ts +13 -0
- package/dist/webauthn-json/schema-format.d.ts.map +1 -0
- package/dist/webauthn-json/schema-format.js +3 -0
- package/dist/webauthn-json/schema-format.js.map +1 -0
- package/dist/webauthn-json/schema.d.ts +9 -0
- package/dist/webauthn-json/schema.d.ts.map +1 -0
- package/dist/webauthn-json/schema.js +86 -0
- package/dist/webauthn-json/schema.js.map +1 -0
- package/dist/webauthn.d.ts +24 -0
- package/dist/webauthn.d.ts.map +1 -0
- package/dist/webauthn.js +82 -0
- package/dist/webauthn.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64url.js","sourceRoot":"","sources":["../../src/webauthn-json/base64url.ts"],"names":[],"mappings":";;;AAEA,SAAgB,iBAAiB,CAC/B,eAAgC;IAEhC,sBAAsB;IACtB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,MAAM,YAAY,GAChB,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;IAElE,0BAA0B;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;IAE/B,0BAA0B;IAC1B,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACjC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAlBD,8CAkBC;AAED,SAAgB,iBAAiB,CAAC,MAAmB;IACnD,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE;QAC/B,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;KACtC;IAED,0BAA0B;IAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/B,sBAAsB;IACtB,sDAAsD;IACtD,MAAM,eAAe,GAAG,YAAY;SACjC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACrB,OAAO,eAAe,CAAC;AACzB,CAAC;AAlBD,8CAkBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Schema, SchemaProperty } from "./schema-format";
|
|
2
|
+
export declare const copyValue = "copy";
|
|
3
|
+
export declare const convertValue = "convert";
|
|
4
|
+
export declare function convert<From, To>(conversionFn: (v: From) => To, schema: Schema, input: any): any;
|
|
5
|
+
export declare function derived(schema: Schema, derive: (v: any) => any): SchemaProperty;
|
|
6
|
+
export declare function required(schema: Schema): SchemaProperty;
|
|
7
|
+
export declare function optional(schema: Schema): SchemaProperty;
|
|
8
|
+
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/convert.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG9D,eAAO,MAAM,SAAS,SAAS,CAAC;AAChC,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,wBAAgB,OAAO,CAAC,IAAI,EAAE,EAAE,EAC9B,YAAY,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,EAAE,EAC7B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,GAAG,GACT,GAAG,CAyCL;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,GACtB,cAAc,CAMhB;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAKvD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAKvD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// We export these values in order so that they can be used to deduplicate
|
|
3
|
+
// schema definitions in minified JS code.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.optional = exports.required = exports.derived = exports.convert = exports.convertValue = exports.copyValue = void 0;
|
|
6
|
+
// TODO: Parcel isn't deduplicating these values.
|
|
7
|
+
exports.copyValue = "copy";
|
|
8
|
+
exports.convertValue = "convert";
|
|
9
|
+
function convert(conversionFn, schema, input) {
|
|
10
|
+
if (schema === exports.copyValue) {
|
|
11
|
+
return input;
|
|
12
|
+
}
|
|
13
|
+
if (schema === exports.convertValue) {
|
|
14
|
+
return conversionFn(input);
|
|
15
|
+
}
|
|
16
|
+
if (schema instanceof Array) {
|
|
17
|
+
return input.map((v) => convert(conversionFn, schema[0], v));
|
|
18
|
+
}
|
|
19
|
+
if (schema instanceof Object) {
|
|
20
|
+
const output = {};
|
|
21
|
+
for (const [key, schemaField] of Object.entries(schema)) {
|
|
22
|
+
if (schemaField.derive) {
|
|
23
|
+
const v = schemaField.derive(input);
|
|
24
|
+
if (v !== undefined) {
|
|
25
|
+
input[key] = v;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!(key in input)) {
|
|
29
|
+
if (schemaField.required) {
|
|
30
|
+
throw new Error(`Missing key: ${key}`);
|
|
31
|
+
}
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
// Fields can be null (rather than missing or `undefined`), e.g. the
|
|
35
|
+
// `userHandle` field of the `AuthenticatorAssertionResponse`:
|
|
36
|
+
// https://www.w3.org/TR/webauthn/#iface-authenticatorassertionresponse
|
|
37
|
+
if (input[key] == null) {
|
|
38
|
+
output[key] = null;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
output[key] = convert(conversionFn, schemaField.schema, input[key]);
|
|
42
|
+
}
|
|
43
|
+
return output;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.convert = convert;
|
|
47
|
+
function derived(schema, derive) {
|
|
48
|
+
return {
|
|
49
|
+
required: true,
|
|
50
|
+
schema,
|
|
51
|
+
derive,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.derived = derived;
|
|
55
|
+
function required(schema) {
|
|
56
|
+
return {
|
|
57
|
+
required: true,
|
|
58
|
+
schema,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.required = required;
|
|
62
|
+
function optional(schema) {
|
|
63
|
+
return {
|
|
64
|
+
required: false,
|
|
65
|
+
schema,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
exports.optional = optional;
|
|
69
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/webauthn-json/convert.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,0CAA0C;;;AAI1C,iDA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CACnB,YAAY,EACZ,WAAW,CAAC,MAAM,EAClB,KAAK,CAAC,GAAG,CAAC,CACX,CAAC;SACH;QACD,OAAO,MAAM,CAAC;KACf;AACH,CAAC;AA7CD,0BA6CC;AAED,SAAgB,OAAO,CACrB,MAAc,EACd,MAAuB;IAEvB,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,MAAM;QACN,MAAM;KACP,CAAC;AACJ,CAAC;AATD,0BASC;AAED,SAAgB,QAAQ,CAAC,MAAc;IACrC,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,MAAM;KACP,CAAC;AACJ,CAAC;AALD,4BAKC;AAED,SAAgB,QAAQ,CAAC,MAAc;IACrC,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,MAAM;KACP,CAAC;AACJ,CAAC;AALD,4BAKC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequestFromJSON as parseCreationOptionsFromJSON, getRequestFromJSON as parseRequestOptionsFromJSON } from "./api";
|
|
2
|
+
import type { CredentialCreationOptionsJSON, CredentialRequestOptionsJSON, PublicKeyCredentialWithAssertionJSON as AuthenticationResponseJSON, PublicKeyCredentialWithAttestationJSON as RegistrationResponseJSON } from "./json";
|
|
3
|
+
export type { PublicKeyCredentialWithAssertionJSON, PublicKeyCredentialWithAttestationJSON, } from "./json";
|
|
4
|
+
export { parseCreationOptionsFromJSON, parseRequestOptionsFromJSON };
|
|
5
|
+
export type { CredentialCreationOptionsJSON, CredentialRequestOptionsJSON, AuthenticationResponseJSON, RegistrationResponseJSON, };
|
|
6
|
+
export interface RegistrationPublicKeyCredential extends PublicKeyCredential {
|
|
7
|
+
toJSON(): RegistrationResponseJSON;
|
|
8
|
+
}
|
|
9
|
+
export declare function create(options: CredentialCreationOptions): Promise<RegistrationPublicKeyCredential>;
|
|
10
|
+
export interface AuthenticationPublicKeyCredential extends PublicKeyCredential {
|
|
11
|
+
toJSON(): AuthenticationResponseJSON;
|
|
12
|
+
}
|
|
13
|
+
export declare function get(options: CredentialRequestOptions): Promise<AuthenticationPublicKeyCredential>;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,4BAA4B,EAErD,kBAAkB,IAAI,2BAA2B,EAElD,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,oCAAoC,IAAI,0BAA0B,EAClE,sCAAsC,IAAI,wBAAwB,EACnE,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACV,oCAAoC,EACpC,sCAAsC,GACvC,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,CAAC;AACrE,YAAY,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,0BAA0B,EAC1B,wBAAwB,GACzB,CAAC;AAEF,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB;IAC1E,MAAM,IAAI,wBAAwB,CAAC;CACpC;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,+BAA+B,CAAC,CAM1C;AAED,MAAM,WAAW,iCAAkC,SAAQ,mBAAmB;IAC5E,MAAM,IAAI,0BAA0B,CAAC;CACtC;AAED,wBAAsB,GAAG,CACvB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iCAAiC,CAAC,CAM5C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get = exports.create = exports.parseRequestOptionsFromJSON = exports.parseCreationOptionsFromJSON = void 0;
|
|
4
|
+
const api_1 = require("./api");
|
|
5
|
+
Object.defineProperty(exports, "parseCreationOptionsFromJSON", { enumerable: true, get: function () { return api_1.createRequestFromJSON; } });
|
|
6
|
+
Object.defineProperty(exports, "parseRequestOptionsFromJSON", { enumerable: true, get: function () { return api_1.getRequestFromJSON; } });
|
|
7
|
+
async function create(options) {
|
|
8
|
+
const response = (await navigator.credentials.create(options));
|
|
9
|
+
response.toJSON = () => (0, api_1.createResponseToJSON)(response);
|
|
10
|
+
return response;
|
|
11
|
+
}
|
|
12
|
+
exports.create = create;
|
|
13
|
+
async function get(options) {
|
|
14
|
+
const response = (await navigator.credentials.get(options));
|
|
15
|
+
response.toJSON = () => (0, api_1.getResponseToJSON)(response);
|
|
16
|
+
return response;
|
|
17
|
+
}
|
|
18
|
+
exports.get = get;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webauthn-json/index.ts"],"names":[],"mappings":";;;AAAA,+BAKe;AAcN,6GAlBkB,2BAA4B,OAkBlB;AAAE,4GAhBf,wBAA2B,OAgBe;AAY3D,KAAK,UAAU,MAAM,CAC1B,OAAkC;IAElC,MAAM,QAAQ,GAAG,CAAC,MAAM,SAAS,CAAC,WAAW,CAAC,MAAM,CAClD,OAAO,CACR,CAAoC,CAAC;IACtC,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,0BAAoB,EAAC,QAAQ,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC;AARD,wBAQC;AAMM,KAAK,UAAU,GAAG,CACvB,OAAiC;IAEjC,MAAM,QAAQ,GAAG,CAAC,MAAM,SAAS,CAAC,WAAW,CAAC,GAAG,CAC/C,OAAO,CACR,CAAsC,CAAC;IACxC,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,uBAAiB,EAAC,QAAQ,CAAC,CAAC;IACpD,OAAO,QAAQ,CAAC;AAClB,CAAC;AARD,kBAQC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Base64urlString } from "./base64url";
|
|
2
|
+
interface CredPropsAuthenticationExtensionsClientOutputsJSON {
|
|
3
|
+
rk: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface AuthenticationExtensionsClientOutputsJSON extends AuthenticationExtensionsClientOutputs {
|
|
6
|
+
appidExclude?: boolean;
|
|
7
|
+
credProps?: CredPropsAuthenticationExtensionsClientOutputsJSON;
|
|
8
|
+
}
|
|
9
|
+
type PublicKeyCredentialWithOptionalAuthenticatorAttachment = Partial<PublicKeyCredential> & Omit<PublicKeyCredential, "authenticatorAttachment">;
|
|
10
|
+
export interface PublicKeyCredentialWithClientExtensionResults extends PublicKeyCredentialWithOptionalAuthenticatorAttachment {
|
|
11
|
+
authenticatorAttachment?: string | null;
|
|
12
|
+
clientExtensionResults?: AuthenticationExtensionsClientOutputsJSON;
|
|
13
|
+
}
|
|
14
|
+
type AuthenticatorTransportJSON = AuthenticatorTransport | "hybrid";
|
|
15
|
+
export interface PublicKeyCredentialDescriptorJSON {
|
|
16
|
+
type: PublicKeyCredentialType;
|
|
17
|
+
id: Base64urlString;
|
|
18
|
+
transports?: AuthenticatorTransportJSON[];
|
|
19
|
+
}
|
|
20
|
+
interface SimpleWebAuthnExtensionsJSON {
|
|
21
|
+
appid?: string;
|
|
22
|
+
appidExclude?: string;
|
|
23
|
+
credProps?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface SimpleClientExtensionResultsJSON {
|
|
26
|
+
appid?: boolean;
|
|
27
|
+
appidExclude?: boolean;
|
|
28
|
+
credProps?: CredPropsAuthenticationExtensionsClientOutputsJSON;
|
|
29
|
+
}
|
|
30
|
+
interface PublicKeyCredentialJSON {
|
|
31
|
+
id: string;
|
|
32
|
+
type: PublicKeyCredentialType;
|
|
33
|
+
rawId: Base64urlString;
|
|
34
|
+
authenticatorAttachment?: AuthenticatorAttachment | null;
|
|
35
|
+
}
|
|
36
|
+
interface PublicKeyCredentialUserEntityJSON extends PublicKeyCredentialEntity {
|
|
37
|
+
displayName: string;
|
|
38
|
+
id: Base64urlString;
|
|
39
|
+
}
|
|
40
|
+
type ResidentKeyRequirement = "discouraged" | "preferred" | "required";
|
|
41
|
+
interface AuthenticatorSelectionCriteriaJSON extends AuthenticatorSelectionCriteria {
|
|
42
|
+
residentKey?: ResidentKeyRequirement;
|
|
43
|
+
}
|
|
44
|
+
export interface PublicKeyCredentialCreationOptionsJSON {
|
|
45
|
+
rp: PublicKeyCredentialRpEntity;
|
|
46
|
+
user: PublicKeyCredentialUserEntityJSON;
|
|
47
|
+
challenge: Base64urlString;
|
|
48
|
+
pubKeyCredParams: PublicKeyCredentialParameters[];
|
|
49
|
+
timeout?: number;
|
|
50
|
+
excludeCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
51
|
+
authenticatorSelection?: AuthenticatorSelectionCriteriaJSON;
|
|
52
|
+
attestation?: AttestationConveyancePreference;
|
|
53
|
+
extensions?: SimpleWebAuthnExtensionsJSON;
|
|
54
|
+
}
|
|
55
|
+
export interface CredentialCreationOptionsJSON {
|
|
56
|
+
publicKey: PublicKeyCredentialCreationOptionsJSON;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
}
|
|
59
|
+
export interface AuthenticatorAttestationResponseJSON {
|
|
60
|
+
clientDataJSON: Base64urlString;
|
|
61
|
+
attestationObject: Base64urlString;
|
|
62
|
+
transports: AuthenticatorTransportJSON[];
|
|
63
|
+
}
|
|
64
|
+
export interface PublicKeyCredentialWithAttestationJSON extends PublicKeyCredentialJSON {
|
|
65
|
+
response: AuthenticatorAttestationResponseJSON;
|
|
66
|
+
clientExtensionResults: SimpleClientExtensionResultsJSON;
|
|
67
|
+
}
|
|
68
|
+
export interface PublicKeyCredentialRequestOptionsJSON {
|
|
69
|
+
challenge: Base64urlString;
|
|
70
|
+
timeout?: number;
|
|
71
|
+
rpId?: string;
|
|
72
|
+
allowCredentials?: PublicKeyCredentialDescriptorJSON[];
|
|
73
|
+
userVerification?: UserVerificationRequirement;
|
|
74
|
+
extensions?: SimpleWebAuthnExtensionsJSON;
|
|
75
|
+
}
|
|
76
|
+
export interface CredentialRequestOptionsJSON {
|
|
77
|
+
mediation?: CredentialMediationRequirement;
|
|
78
|
+
publicKey?: PublicKeyCredentialRequestOptionsJSON;
|
|
79
|
+
signal?: AbortSignal;
|
|
80
|
+
}
|
|
81
|
+
interface AuthenticatorAssertionResponseJSON {
|
|
82
|
+
clientDataJSON: Base64urlString;
|
|
83
|
+
authenticatorData: Base64urlString;
|
|
84
|
+
signature: Base64urlString;
|
|
85
|
+
userHandle: Base64urlString | null;
|
|
86
|
+
}
|
|
87
|
+
export interface PublicKeyCredentialWithAssertionJSON extends PublicKeyCredentialJSON {
|
|
88
|
+
response: AuthenticatorAssertionResponseJSON;
|
|
89
|
+
clientExtensionResults: SimpleClientExtensionResultsJSON;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,UAAU,kDAAkD;IAC1D,EAAE,EAAE,OAAO,CAAC;CACb;AAED,UAAU,yCACR,SAAQ,qCAAqC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,kDAAkD,CAAC;CAChE;AAED,KAAK,sDAAsD,GACzD,OAAO,CAAC,mBAAmB,CAAC,GAC1B,IAAI,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC;AAEzD,MAAM,WAAW,6CACf,SAAQ,sDAAsD;IAC9D,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,sBAAsB,CAAC,EAAE,yCAAyC,CAAC;CACpE;AAID,KAAK,0BAA0B,GAAG,sBAAsB,GAAG,QAAQ,CAAC;AAEpE,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,uBAAuB,CAAC;IAC9B,EAAE,EAAE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AM,WAAW,oCAAoC;IACnD,cAAc,EAAE,eAAe,CAAC;IAChC,iBAAiB,EAAE,eAAe,CAAC;IACnC,UAAU,EAAE,0BAA0B,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,sCACf,SAAQ,uBAAuB;IAC/B,QAAQ,EAAE,oCAAoC,CAAC;IAC/C,sBAAsB,EAAE,gCAAgC,CAAC;CAC1D;AAID,MAAM,WAAW,qCAAqC;IACpD,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,iCAAiC,EAAE,CAAC;IACvD,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;IAC/C,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,CAAC,EAAE,8BAA8B,CAAC;IAC3C,SAAS,CAAC,EAAE,qCAAqC,CAAC;IAClD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAID,UAAU,kCAAkC;IAC1C,cAAc,EAAE,eAAe,CAAC;IAChC,iBAAiB,EAAE,eAAe,CAAC;IACnC,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,oCACf,SAAQ,uBAAuB;IAC/B,QAAQ,EAAE,kCAAkC,CAAC;IAC7C,sBAAsB,EAAE,gCAAgC,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/webauthn-json/json.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type SchemaLeaf = "copy" | "convert";
|
|
2
|
+
export interface SchemaProperty {
|
|
3
|
+
required: boolean;
|
|
4
|
+
schema: Schema;
|
|
5
|
+
derive?: (v: any) => any;
|
|
6
|
+
}
|
|
7
|
+
interface SchemaObject {
|
|
8
|
+
[property: string]: SchemaProperty;
|
|
9
|
+
}
|
|
10
|
+
type SchemaArray = [SchemaObject] | [SchemaLeaf];
|
|
11
|
+
export type Schema = SchemaLeaf | SchemaArray | SchemaObject;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=schema-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-format.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/schema-format.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AACrC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;CAC1B;AACD,UAAU,YAAY;IACpB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC;CACpC;AACD,KAAK,WAAW,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAEjD,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-format.js","sourceRoot":"","sources":["../../src/webauthn-json/schema-format.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Schema } from "./schema-format";
|
|
2
|
+
export declare const credentialCreationOptions: Schema;
|
|
3
|
+
export declare const publicKeyCredentialWithAttestation: Schema;
|
|
4
|
+
export declare const credentialRequestOptions: Schema;
|
|
5
|
+
export declare const publicKeyCredentialWithAssertion: Schema;
|
|
6
|
+
export declare const schema: {
|
|
7
|
+
[s: string]: Schema;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA+B9C,eAAO,MAAM,yBAAyB,EAAE,MAmBvC,CAAC;AAIF,eAAO,MAAM,kCAAkC,EAAE,MAiBhD,CAAC;AAIF,eAAO,MAAM,wBAAwB,EAAE,MAWtC,CAAC;AAIF,eAAO,MAAM,gCAAgC,EAAE,MAe9C,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAKzC,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.publicKeyCredentialWithAssertion = exports.credentialRequestOptions = exports.publicKeyCredentialWithAttestation = exports.credentialCreationOptions = void 0;
|
|
4
|
+
const convert_1 = require("./convert");
|
|
5
|
+
// Shared by `create()` and `get()`.
|
|
6
|
+
const publicKeyCredentialDescriptorSchema = {
|
|
7
|
+
type: (0, convert_1.required)(convert_1.copyValue),
|
|
8
|
+
id: (0, convert_1.required)(convert_1.convertValue),
|
|
9
|
+
transports: (0, convert_1.optional)(convert_1.copyValue),
|
|
10
|
+
};
|
|
11
|
+
const simplifiedExtensionsSchema = {
|
|
12
|
+
appid: (0, convert_1.optional)(convert_1.copyValue),
|
|
13
|
+
appidExclude: (0, convert_1.optional)(convert_1.copyValue),
|
|
14
|
+
credProps: (0, convert_1.optional)(convert_1.copyValue),
|
|
15
|
+
};
|
|
16
|
+
const simplifiedClientExtensionResultsSchema = {
|
|
17
|
+
appid: (0, convert_1.optional)(convert_1.copyValue),
|
|
18
|
+
appidExclude: (0, convert_1.optional)(convert_1.copyValue),
|
|
19
|
+
credProps: (0, convert_1.optional)(convert_1.copyValue),
|
|
20
|
+
};
|
|
21
|
+
// `navigator.create()` request
|
|
22
|
+
exports.credentialCreationOptions = {
|
|
23
|
+
publicKey: (0, convert_1.required)({
|
|
24
|
+
rp: (0, convert_1.required)(convert_1.copyValue),
|
|
25
|
+
user: (0, convert_1.required)({
|
|
26
|
+
id: (0, convert_1.required)(convert_1.convertValue),
|
|
27
|
+
name: (0, convert_1.required)(convert_1.copyValue),
|
|
28
|
+
displayName: (0, convert_1.required)(convert_1.copyValue),
|
|
29
|
+
}),
|
|
30
|
+
challenge: (0, convert_1.required)(convert_1.convertValue),
|
|
31
|
+
pubKeyCredParams: (0, convert_1.required)(convert_1.copyValue),
|
|
32
|
+
timeout: (0, convert_1.optional)(convert_1.copyValue),
|
|
33
|
+
excludeCredentials: (0, convert_1.optional)([publicKeyCredentialDescriptorSchema]),
|
|
34
|
+
authenticatorSelection: (0, convert_1.optional)(convert_1.copyValue),
|
|
35
|
+
attestation: (0, convert_1.optional)(convert_1.copyValue),
|
|
36
|
+
extensions: (0, convert_1.optional)(simplifiedExtensionsSchema),
|
|
37
|
+
}),
|
|
38
|
+
signal: (0, convert_1.optional)(convert_1.copyValue),
|
|
39
|
+
};
|
|
40
|
+
// `navigator.create()` response
|
|
41
|
+
exports.publicKeyCredentialWithAttestation = {
|
|
42
|
+
type: (0, convert_1.required)(convert_1.copyValue),
|
|
43
|
+
id: (0, convert_1.required)(convert_1.copyValue),
|
|
44
|
+
rawId: (0, convert_1.required)(convert_1.convertValue),
|
|
45
|
+
authenticatorAttachment: (0, convert_1.optional)(convert_1.copyValue),
|
|
46
|
+
response: (0, convert_1.required)({
|
|
47
|
+
clientDataJSON: (0, convert_1.required)(convert_1.convertValue),
|
|
48
|
+
attestationObject: (0, convert_1.required)(convert_1.convertValue),
|
|
49
|
+
transports: (0, convert_1.derived)(convert_1.copyValue, (response) => response.getTransports?.() || []),
|
|
50
|
+
}),
|
|
51
|
+
clientExtensionResults: (0, convert_1.derived)(simplifiedClientExtensionResultsSchema, (pkc) => pkc.getClientExtensionResults()),
|
|
52
|
+
};
|
|
53
|
+
// `navigator.get()` request
|
|
54
|
+
exports.credentialRequestOptions = {
|
|
55
|
+
mediation: (0, convert_1.optional)(convert_1.copyValue),
|
|
56
|
+
publicKey: (0, convert_1.required)({
|
|
57
|
+
challenge: (0, convert_1.required)(convert_1.convertValue),
|
|
58
|
+
timeout: (0, convert_1.optional)(convert_1.copyValue),
|
|
59
|
+
rpId: (0, convert_1.optional)(convert_1.copyValue),
|
|
60
|
+
allowCredentials: (0, convert_1.optional)([publicKeyCredentialDescriptorSchema]),
|
|
61
|
+
userVerification: (0, convert_1.optional)(convert_1.copyValue),
|
|
62
|
+
extensions: (0, convert_1.optional)(simplifiedExtensionsSchema),
|
|
63
|
+
}),
|
|
64
|
+
signal: (0, convert_1.optional)(convert_1.copyValue),
|
|
65
|
+
};
|
|
66
|
+
// `navigator.get()` response
|
|
67
|
+
exports.publicKeyCredentialWithAssertion = {
|
|
68
|
+
type: (0, convert_1.required)(convert_1.copyValue),
|
|
69
|
+
id: (0, convert_1.required)(convert_1.copyValue),
|
|
70
|
+
rawId: (0, convert_1.required)(convert_1.convertValue),
|
|
71
|
+
authenticatorAttachment: (0, convert_1.optional)(convert_1.copyValue),
|
|
72
|
+
response: (0, convert_1.required)({
|
|
73
|
+
clientDataJSON: (0, convert_1.required)(convert_1.convertValue),
|
|
74
|
+
authenticatorData: (0, convert_1.required)(convert_1.convertValue),
|
|
75
|
+
signature: (0, convert_1.required)(convert_1.convertValue),
|
|
76
|
+
userHandle: (0, convert_1.required)(convert_1.convertValue),
|
|
77
|
+
}),
|
|
78
|
+
clientExtensionResults: (0, convert_1.derived)(simplifiedClientExtensionResultsSchema, (pkc) => pkc.getClientExtensionResults()),
|
|
79
|
+
};
|
|
80
|
+
exports.schema = {
|
|
81
|
+
credentialCreationOptions: exports.credentialCreationOptions,
|
|
82
|
+
publicKeyCredentialWithAttestation: exports.publicKeyCredentialWithAttestation,
|
|
83
|
+
credentialRequestOptions: exports.credentialRequestOptions,
|
|
84
|
+
publicKeyCredentialWithAssertion: exports.publicKeyCredentialWithAssertion,
|
|
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AI,CAAC;QACvB,IAAI,EAAE,IAAA,kBAAQ,EAAC,mBAAI,CAAC;QACpB,gBAAgB,EAAE,IAAA,kBAAQ,EAAC,CAAC,mCAAmC,CAAC,CAAC;QACjE,gBAAgB,EAAE,IAAA,kBAAQ,EAAC,mBAAI,CAAC;QAChC,UAAU,EAAE,IAAA,kBAAQ,EAAC,0BAA0B,CAAC;KACjD,CAAC;IACF,MAAM,EAAE,IAAA,kBAAQ,EAAC,mBAAI,CAAC;CACvB,CAAC;AAEF,6BAA6B;AAEhB,QAAA,gCAAgC,GAAW;IACtD,IAAI,EAAE,IAAA,kBAAQ,EAAC,mBAAI,CAAC;IACpB,EAAE,EAAE,IAAA,kBAAQ,EAAC,mBAAI,CAAC;IAClB,KAAK,EAAE,IAAA,kBAAQ,EAAC,sBAAO,CAAC;IACxB,uBAAuB,EAAE,IAAA,kBAAQ,EAAC,mBAAI,CAAC;IACvC,QAAQ,EAAE,IAAA,kBAAQ,EAAC;QACjB,cAAc,EAAE,IAAA,kBAAQ,EAAC,sBAAO,CAAC;QACjC,iBAAiB,EAAE,IAAA,kBAAQ,EAAC,sBAAO,CAAC;QACpC,SAAS,EAAE,IAAA,kBAAQ,EAAC,sBAAO,CAAC;QAC5B,UAAU,EAAE,IAAA,kBAAQ,EAAC,sBAAO,CAAC;KAC9B,CAAC;IACF,sBAAsB,EAAE,IAAA,iBAAO,EAC7B,sCAAsC,EACtC,CAAC,GAAwB,EAAE,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAC9D;CACF,CAAC;AAEW,QAAA,MAAM,GAA4B;IAC7C,yBAAyB,EAAzB,iCAAyB;IACzB,kCAAkC,EAAlC,0CAAkC;IAClC,wBAAwB,EAAxB,gCAAwB;IACxB,gCAAgC,EAAhC,wCAAgC;CACjC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { definitions } from "./__generated__/services/coordinator/public/v1/public_api.types";
|
|
2
|
+
type TAttestation = definitions["v1Attestation"];
|
|
3
|
+
type ExternalAuthenticatorTransports = AuthenticatorTransport | "hybrid";
|
|
4
|
+
type InternalAuthenticatorTransports = definitions["externaldatav1AuthenticatorTransport"];
|
|
5
|
+
export type TurnkeyPublicKeyCredentialRequestOptions = {
|
|
6
|
+
timeout?: number;
|
|
7
|
+
rpId?: string;
|
|
8
|
+
allowCredentials?: PublicKeyCredentialDescriptor[];
|
|
9
|
+
userVerification?: UserVerificationRequirement;
|
|
10
|
+
extensions?: AuthenticationExtensionsClientInputs;
|
|
11
|
+
};
|
|
12
|
+
export type TurnkeyCredentialRequestOptions = {
|
|
13
|
+
mediation?: CredentialMediationRequirement;
|
|
14
|
+
publicKey: TurnkeyPublicKeyCredentialRequestOptions;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
password?: boolean;
|
|
17
|
+
unmediated?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type TurnkeyCredentialCreationOptions = CredentialCreationOptions;
|
|
20
|
+
export type { TurnkeyCredentialCreationOptions };
|
|
21
|
+
export declare function protocolTransportEnumToInternalEnum(protocolEnum: ExternalAuthenticatorTransports): InternalAuthenticatorTransports;
|
|
22
|
+
export declare function getWebAuthnAssertion(payload: string, options?: TurnkeyCredentialRequestOptions): Promise<string>;
|
|
23
|
+
export declare function getWebAuthnAttestation(options: TurnkeyCredentialCreationOptions): Promise<TAttestation>;
|
|
24
|
+
//# sourceMappingURL=webauthn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn.d.ts","sourceRoot":"","sources":["../src/webauthn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iEAAiE,CAAC;AAQnG,KAAK,YAAY,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAGjD,KAAK,+BAA+B,GAAG,sBAAsB,GAAG,QAAQ,CAAC;AACzE,KAAK,+BAA+B,GAClC,WAAW,CAAC,sCAAsC,CAAC,CAAC;AAMtD,MAAM,MAAM,wCAAwC,GAAG;IAErD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,6BAA6B,EAAE,CAAC;IACnD,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;IAC/C,UAAU,CAAC,EAAE,oCAAoC,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,SAAS,CAAC,EAAE,8BAA8B,CAAC;IAC3C,SAAS,EAAE,wCAAwC,CAAC;IACpD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,gCAAgC,GAAG,yBAAyB,CAAC;AAElE,YAAY,EAAE,gCAAgC,EAAE,CAAC;AAoCjD,wBAAgB,mCAAmC,CACjD,YAAY,EAAE,+BAA+B,GAC5C,+BAA+B,CAqBjC;AAeD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,+BAA+B,GACxC,OAAO,CAAC,MAAM,CAAC,CAajB;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
package/dist/webauthn.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWebAuthnAttestation = exports.getWebAuthnAssertion = exports.protocolTransportEnumToInternalEnum = void 0;
|
|
4
|
+
const webauthn_json_1 = require("./webauthn-json");
|
|
5
|
+
const defaultTimeout = 5 * 60 * 1000; // five minutes
|
|
6
|
+
const defaultUserVerification = "preferred";
|
|
7
|
+
const defaultSigningOptions = {
|
|
8
|
+
publicKey: {
|
|
9
|
+
timeout: defaultTimeout,
|
|
10
|
+
userVerification: defaultUserVerification,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
async function getCredentialRequestOptions(payload, tkSigningOptions = defaultSigningOptions) {
|
|
14
|
+
const challenge = await getChallengeFromPayload(payload);
|
|
15
|
+
const signingOptions = {
|
|
16
|
+
...tkSigningOptions,
|
|
17
|
+
publicKey: {
|
|
18
|
+
...defaultSigningOptions.publicKey,
|
|
19
|
+
...tkSigningOptions.publicKey,
|
|
20
|
+
challenge,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
return signingOptions;
|
|
24
|
+
}
|
|
25
|
+
async function getChallengeFromPayload(payload) {
|
|
26
|
+
const messageBuffer = new TextEncoder().encode(payload);
|
|
27
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", messageBuffer);
|
|
28
|
+
const hexString = Buffer.from(hashBuffer).toString("hex");
|
|
29
|
+
const hexBuffer = Buffer.from(hexString, "utf8");
|
|
30
|
+
return new Uint8Array(hexBuffer);
|
|
31
|
+
}
|
|
32
|
+
/* Pulled from https://www.w3.org/TR/webauthn-2/#enum-transport */
|
|
33
|
+
function protocolTransportEnumToInternalEnum(protocolEnum) {
|
|
34
|
+
switch (protocolEnum) {
|
|
35
|
+
case "internal": {
|
|
36
|
+
return "AUTHENTICATOR_TRANSPORT_INTERNAL";
|
|
37
|
+
}
|
|
38
|
+
case "usb": {
|
|
39
|
+
return "AUTHENTICATOR_TRANSPORT_USB";
|
|
40
|
+
}
|
|
41
|
+
case "nfc": {
|
|
42
|
+
return "AUTHENTICATOR_TRANSPORT_NFC";
|
|
43
|
+
}
|
|
44
|
+
case "ble": {
|
|
45
|
+
return "AUTHENTICATOR_TRANSPORT_BLE";
|
|
46
|
+
}
|
|
47
|
+
case "hybrid": {
|
|
48
|
+
return "AUTHENTICATOR_TRANSPORT_HYBRID";
|
|
49
|
+
}
|
|
50
|
+
default: {
|
|
51
|
+
throw new Error("unsupported transport format");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.protocolTransportEnumToInternalEnum = protocolTransportEnumToInternalEnum;
|
|
56
|
+
function toInternalAttestation(attestation) {
|
|
57
|
+
return {
|
|
58
|
+
credentialId: attestation.rawId,
|
|
59
|
+
attestationObject: attestation.response.attestationObject,
|
|
60
|
+
clientDataJson: attestation.response.clientDataJSON,
|
|
61
|
+
transports: attestation.response.transports.map(protocolTransportEnumToInternalEnum),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async function getWebAuthnAssertion(payload, options) {
|
|
65
|
+
const signingOptions = await getCredentialRequestOptions(payload, options);
|
|
66
|
+
const clientGetResult = await (0, webauthn_json_1.get)(signingOptions);
|
|
67
|
+
const assertion = clientGetResult.toJSON();
|
|
68
|
+
const stamp = {
|
|
69
|
+
authenticatorData: assertion.response.authenticatorData,
|
|
70
|
+
clientDataJson: assertion.response.clientDataJSON,
|
|
71
|
+
credentialId: assertion.id,
|
|
72
|
+
signature: assertion.response.signature,
|
|
73
|
+
};
|
|
74
|
+
return JSON.stringify(stamp);
|
|
75
|
+
}
|
|
76
|
+
exports.getWebAuthnAssertion = getWebAuthnAssertion;
|
|
77
|
+
async function getWebAuthnAttestation(options) {
|
|
78
|
+
const res = await (0, webauthn_json_1.create)(options);
|
|
79
|
+
return toInternalAttestation(res.toJSON());
|
|
80
|
+
}
|
|
81
|
+
exports.getWebAuthnAttestation = getWebAuthnAttestation;
|
|
82
|
+
//# sourceMappingURL=webauthn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn.js","sourceRoot":"","sources":["../src/webauthn.ts"],"names":[],"mappings":";;;AAEA,mDAGyB;AAUzB,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,eAAe;AACrD,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAwB5C,MAAM,qBAAqB,GAAoC;IAC7D,SAAS,EAAE;QACT,OAAO,EAAE,cAAc;QACvB,gBAAgB,EAAE,uBAAuB;KAC1C;CACF,CAAC;AAEF,KAAK,UAA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