@turnkey/http 0.17.1 → 0.18.0
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 +7 -0
- package/dist/__generated__/services/coordinator/public/v1/public_api.fetcher.d.ts +2593 -528
- 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 +372 -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 +331 -43
- package/dist/__generated__/services/coordinator/public/v1/public_api.types.d.ts +181 -10
- 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
package/dist/config.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConfig = exports.init = void 0;
|
|
3
|
+
exports.getBrowserConfig = exports.getConfig = exports.init = exports.browserInit = void 0;
|
|
4
4
|
const config = {
|
|
5
5
|
apiPublicKey: null,
|
|
6
6
|
apiPrivateKey: null,
|
|
7
7
|
baseUrl: null,
|
|
8
8
|
};
|
|
9
|
+
const browserConfig = {
|
|
10
|
+
baseUrl: null,
|
|
11
|
+
};
|
|
12
|
+
function browserInit(value) {
|
|
13
|
+
browserConfig.baseUrl = assertNonEmptyString(value.baseUrl, "baseUrl");
|
|
14
|
+
}
|
|
15
|
+
exports.browserInit = browserInit;
|
|
9
16
|
function init(value) {
|
|
10
17
|
config.apiPublicKey = assertNonEmptyString(value.apiPublicKey, "apiPublicKey");
|
|
11
18
|
config.apiPrivateKey = assertNonEmptyString(value.apiPrivateKey, "apiPrivateKey");
|
|
@@ -20,6 +27,12 @@ function getConfig() {
|
|
|
20
27
|
};
|
|
21
28
|
}
|
|
22
29
|
exports.getConfig = getConfig;
|
|
30
|
+
function getBrowserConfig() {
|
|
31
|
+
return {
|
|
32
|
+
baseUrl: assertNonEmptyString(browserConfig.baseUrl, "baseUrl"),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.getBrowserConfig = getBrowserConfig;
|
|
23
36
|
function assertNonEmptyString(input, name) {
|
|
24
37
|
if (typeof input !== "string" || !input) {
|
|
25
38
|
throw new Error(`"${name}" must be a non-empty string`);
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAwBA,MAAM,MAAM,GAAuB;IACjC,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,MAAM,aAAa,GAA8B;IAC/C,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,SAAgB,WAAW,CAAC,KAAqB;IAC/C,aAAa,CAAC,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACzE,CAAC;AAFD,kCAEC;AAED,SAAgB,IAAI,CAAC,KAAc;IACjC,MAAM,CAAC,YAAY,GAAG,oBAAoB,CACxC,KAAK,CAAC,YAAY,EAClB,cAAc,CACf,CAAC;IAEF,MAAM,CAAC,aAAa,GAAG,oBAAoB,CACzC,KAAK,CAAC,aAAa,EACnB,eAAe,CAChB,CAAC;IACF,MAAM,CAAC,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC;AAXD,oBAWC;AAED,SAAgB,SAAS;IACvB,OAAO;QACL,YAAY,EAAE,oBAAoB,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC;QACvE,aAAa,EAAE,oBAAoB,CAAC,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC;QAC1E,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;KACzD,CAAC;AACJ,CAAC;AAND,8BAMC;AAED,SAAgB,gBAAgB;IAC9B,OAAO;QACL,OAAO,EAAE,oBAAoB,CAAC,aAAa,CAAC,OAAO,EAAE,SAAS,CAAC;KAChE,CAAC;AACJ,CAAC;AAJD,4CAIC;AAED,SAAS,oBAAoB,CAAC,KAAc,EAAE,IAAY;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,8BAA8B,CAAC,CAAC;KACzD;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/encoding.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code modified from https://github.com/github/webauthn-json/blob/e932b3585fa70b0bd5b5a4012ba7dbad7b0a0d0f/src/webauthn-json/base64url.ts#L23
|
|
3
3
|
*/
|
|
4
4
|
export declare function stringToBase64urlString(input: string): string;
|
|
5
|
+
export declare function base64StringToBase64UrlEncodedString(input: string): string;
|
|
5
6
|
export declare function uint8ArrayToHexString(input: Uint8Array): string;
|
|
6
7
|
export declare function convertTurnkeyApiKeyToJwk(input: {
|
|
7
8
|
uncompressedPrivateKeyHex: string;
|
package/dist/encoding.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK7D;AAED,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAK/D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,yBAAyB,EAAE,MAAM,CAAC;IAClC,sBAAsB,EAAE,MAAM,CAAC;CAChC,GAAG,UAAU,CAQb"}
|
package/dist/encoding.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertTurnkeyApiKeyToJwk = exports.uint8ArrayToHexString = exports.stringToBase64urlString = void 0;
|
|
3
|
+
exports.convertTurnkeyApiKeyToJwk = exports.uint8ArrayToHexString = exports.base64StringToBase64UrlEncodedString = exports.stringToBase64urlString = void 0;
|
|
4
4
|
const elliptic_curves_1 = require("./tink/elliptic_curves");
|
|
5
5
|
/**
|
|
6
6
|
* Code modified from https://github.com/github/webauthn-json/blob/e932b3585fa70b0bd5b5a4012ba7dbad7b0a0d0f/src/webauthn-json/base64url.ts#L23
|
|
@@ -8,15 +8,13 @@ const elliptic_curves_1 = require("./tink/elliptic_curves");
|
|
|
8
8
|
function stringToBase64urlString(input) {
|
|
9
9
|
// string to base64
|
|
10
10
|
const base64String = btoa(input);
|
|
11
|
-
|
|
12
|
-
// We assume that the base64url string is well-formed.
|
|
13
|
-
const base64urlString = base64String
|
|
14
|
-
.replace(/\+/g, "-")
|
|
15
|
-
.replace(/\//g, "_")
|
|
16
|
-
.replace(/=/g, "");
|
|
17
|
-
return base64urlString;
|
|
11
|
+
return base64StringToBase64UrlEncodedString(base64String);
|
|
18
12
|
}
|
|
19
13
|
exports.stringToBase64urlString = stringToBase64urlString;
|
|
14
|
+
function base64StringToBase64UrlEncodedString(input) {
|
|
15
|
+
return input.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
16
|
+
}
|
|
17
|
+
exports.base64StringToBase64UrlEncodedString = base64StringToBase64UrlEncodedString;
|
|
20
18
|
function uint8ArrayToHexString(input) {
|
|
21
19
|
return input.reduce((result, x) => result + x.toString(16).padStart(2, "0"), "");
|
|
22
20
|
}
|
package/dist/encoding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":";;;AAAA,4DAAqD;AAErD;;GAEG;AACH,SAAgB,uBAAuB,CAAC,KAAa;IACnD,mBAAmB;IACnB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAEjC,
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":";;;AAAA,4DAAqD;AAErD;;GAEG;AACH,SAAgB,uBAAuB,CAAC,KAAa;IACnD,mBAAmB;IACnB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAEjC,OAAO,oCAAoC,CAAC,YAAY,CAAC,CAAC;AAC5D,CAAC;AALD,0DAKC;AAED,SAAgB,oCAAoC,CAAC,KAAa;IAChE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACzE,CAAC;AAFD,oFAEC;AAED,SAAgB,qBAAqB,CAAC,KAAiB;IACrD,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EACvD,EAAE,CACH,CAAC;AACJ,CAAC;AALD,sDAKC;AAED,SAAgB,yBAAyB,CAAC,KAGzC;IACC,MAAM,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,GAAG,KAAK,CAAC;IAEpE,MAAM,GAAG,GAAG,IAAA,6BAAW,EAAC,qBAAqB,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAEvE,GAAG,CAAC,CAAC,GAAG,0BAA0B,CAAC,yBAAyB,CAAC,CAAC;IAE9D,OAAO,GAAG,CAAC;AACb,CAAC;AAXD,8DAWC;AAED,SAAS,qBAAqB,CAAC,KAAa;IAC1C,IACE,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC;QACtB,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAC3B;QACA,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACjE;IAED,OAAO,UAAU,CAAC,IAAI,CACpB,KAAK;SACF,KAAK,CACJ,OAAO,CAAC,uCAAuC;KAC/C;SACD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CACrC,CAAC;AACJ,CAAC;AAED,SAAS,0BAA0B,CAAC,KAAa;IAC/C,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,uBAAuB,CAC5B,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClE,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { PublicApiService as TurnkeyApi } from "./__generated__/barrel";
|
|
2
|
-
export {
|
|
2
|
+
export type { definitions as TurnkeyApiTypes } from "./__generated__/services/coordinator/public/v1/public_api.types";
|
|
3
|
+
export { init, browserInit } from "./config";
|
|
3
4
|
export { TurnkeyActivityError, TurnkeyRequestError } from "./shared";
|
|
5
|
+
export type { FederatedRequest } from "./shared";
|
|
6
|
+
export { getWebAuthnAttestation } from "./webauthn";
|
|
4
7
|
export { withAsyncPolling } from "./async";
|
|
5
8
|
export { TurnkeyApi };
|
|
6
9
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACxE,YAAY,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,iEAAiE,CAAC;AACtH,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB;;GAEG;AACH,QAAA,MAAM,gBAAgB,mBAAa,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.init = void 0;
|
|
3
|
+
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.getWebAuthnAttestation = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.browserInit = exports.init = void 0;
|
|
4
4
|
const barrel_1 = require("./__generated__/barrel");
|
|
5
5
|
Object.defineProperty(exports, "TurnkeyApi", { enumerable: true, get: function () { return barrel_1.PublicApiService; } });
|
|
6
6
|
var config_1 = require("./config");
|
|
7
7
|
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return config_1.init; } });
|
|
8
|
+
Object.defineProperty(exports, "browserInit", { enumerable: true, get: function () { return config_1.browserInit; } });
|
|
8
9
|
var shared_1 = require("./shared");
|
|
9
10
|
Object.defineProperty(exports, "TurnkeyActivityError", { enumerable: true, get: function () { return shared_1.TurnkeyActivityError; } });
|
|
10
11
|
Object.defineProperty(exports, "TurnkeyRequestError", { enumerable: true, get: function () { return shared_1.TurnkeyRequestError; } });
|
|
12
|
+
var webauthn_1 = require("./webauthn");
|
|
13
|
+
Object.defineProperty(exports, "getWebAuthnAttestation", { enumerable: true, get: function () { return webauthn_1.getWebAuthnAttestation; } });
|
|
11
14
|
var async_1 = require("./async");
|
|
12
15
|
Object.defineProperty(exports, "withAsyncPolling", { enumerable: true, get: function () { return async_1.withAsyncPolling; } });
|
|
13
16
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAwE;AAU/D,2FAVoB,yBAAU,OAUpB;AARnB,mCAA6C;AAApC,8FAAA,IAAI,OAAA;AAAE,qGAAA,WAAW,OAAA;AAE1B,mCAAqE;AAA5D,8GAAA,oBAAoB,OAAA;AAAE,6GA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AK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;QACrB,UAAU,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;QAChC,cAAc,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;QACxC,YAAY,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;KACrC;CAUF;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,KAAK,OAAO,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;gBAED,KAAK,EAAE,UAAU;CAa9B;AAID,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CredentialCreationOptionsJSON, CredentialRequestOptionsJSON, PublicKeyCredentialWithAssertionJSON, PublicKeyCredentialWithAttestationJSON } from "./json";
|
|
2
|
+
export declare function createRequestFromJSON(requestJSON: CredentialCreationOptionsJSON): CredentialCreationOptions;
|
|
3
|
+
export declare function createResponseToJSON(credential: PublicKeyCredential): PublicKeyCredentialWithAttestationJSON;
|
|
4
|
+
export declare function create(requestJSON: CredentialCreationOptionsJSON): Promise<PublicKeyCredentialWithAttestationJSON>;
|
|
5
|
+
export declare function getRequestFromJSON(requestJSON: CredentialRequestOptionsJSON): CredentialRequestOptions;
|
|
6
|
+
export declare function getResponseToJSON(credential: PublicKeyCredential): PublicKeyCredentialWithAssertionJSON;
|
|
7
|
+
export declare function get(requestJSON: CredentialRequestOptionsJSON): Promise<PublicKeyCredentialWithAssertionJSON>;
|
|
8
|
+
declare global {
|
|
9
|
+
interface Window {
|
|
10
|
+
PublicKeyCredential: PublicKeyCredential | undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/webauthn-json/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,oCAAoC,EACpC,sCAAsC,EACvC,MAAM,QAAQ,CAAC;AAQhB,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,6BAA6B,GACzC,yBAAyB,CAE3B;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,mBAAmB,GAC9B,sCAAsC,CAMxC;AAED,wBAAsB,MAAM,CAC1B,WAAW,EAAE,6BAA6B,GACzC,OAAO,CAAC,sCAAsC,CAAC,CAKjD;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,4BAA4B,GACxC,wBAAwB,CAE1B;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,mBAAmB,GAC9B,oCAAoC,CAMtC;AAED,wBAAsB,GAAG,CACvB,WAAW,EAAE,4BAA4B,GACxC,OAAO,CAAC,oCAAoC,CAAC,CAK/C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAC;KACtD;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get = exports.getResponseToJSON = exports.getRequestFromJSON = exports.create = exports.createResponseToJSON = exports.createRequestFromJSON = void 0;
|
|
4
|
+
const base64url_1 = require("./base64url");
|
|
5
|
+
const convert_1 = require("./convert");
|
|
6
|
+
const schema_1 = require("./schema");
|
|
7
|
+
function createRequestFromJSON(requestJSON) {
|
|
8
|
+
return (0, convert_1.convert)(base64url_1.base64urlToBuffer, schema_1.credentialCreationOptions, requestJSON);
|
|
9
|
+
}
|
|
10
|
+
exports.createRequestFromJSON = createRequestFromJSON;
|
|
11
|
+
function createResponseToJSON(credential) {
|
|
12
|
+
return (0, convert_1.convert)(base64url_1.bufferToBase64url, schema_1.publicKeyCredentialWithAttestation, credential);
|
|
13
|
+
}
|
|
14
|
+
exports.createResponseToJSON = createResponseToJSON;
|
|
15
|
+
async function create(requestJSON) {
|
|
16
|
+
const credential = (await navigator.credentials.create(createRequestFromJSON(requestJSON)));
|
|
17
|
+
return createResponseToJSON(credential);
|
|
18
|
+
}
|
|
19
|
+
exports.create = create;
|
|
20
|
+
function getRequestFromJSON(requestJSON) {
|
|
21
|
+
return (0, convert_1.convert)(base64url_1.base64urlToBuffer, schema_1.credentialRequestOptions, requestJSON);
|
|
22
|
+
}
|
|
23
|
+
exports.getRequestFromJSON = getRequestFromJSON;
|
|
24
|
+
function getResponseToJSON(credential) {
|
|
25
|
+
return (0, convert_1.convert)(base64url_1.bufferToBase64url, schema_1.publicKeyCredentialWithAssertion, credential);
|
|
26
|
+
}
|
|
27
|
+
exports.getResponseToJSON = getResponseToJSON;
|
|
28
|
+
async function get(requestJSON) {
|
|
29
|
+
const credential = (await navigator.credentials.get(getRequestFromJSON(requestJSON)));
|
|
30
|
+
return getResponseToJSON(credential);
|
|
31
|
+
}
|
|
32
|
+
exports.get = get;
|
|
33
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/webauthn-json/api.ts"],"names":[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gB,iBAAiB,CAC/B,eAAe,EAAE,eAAe,GAC/B,WAAW,CAgBb;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAkBtE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bufferToBase64url = exports.base64urlToBuffer = void 0;
|
|
4
|
+
function base64urlToBuffer(baseurl64String) {
|
|
5
|
+
// Base64url to Base64
|
|
6
|
+
const padding = "==".slice(0, (4 - (baseurl64String.length % 4)) % 4);
|
|
7
|
+
const base64String = baseurl64String.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
8
|
+
// Base64 to binary string
|
|
9
|
+
const str = atob(base64String);
|
|
10
|
+
// Binary string to buffer
|
|
11
|
+
const buffer = new ArrayBuffer(str.length);
|
|
12
|
+
const byteView = new Uint8Array(buffer);
|
|
13
|
+
for (let i = 0; i < str.length; i++) {
|
|
14
|
+
byteView[i] = str.charCodeAt(i);
|
|
15
|
+
}
|
|
16
|
+
return buffer;
|
|
17
|
+
}
|
|
18
|
+
exports.base64urlToBuffer = base64urlToBuffer;
|
|
19
|
+
function bufferToBase64url(buffer) {
|
|
20
|
+
// Buffer to binary string
|
|
21
|
+
const byteView = new Uint8Array(buffer);
|
|
22
|
+
let str = "";
|
|
23
|
+
for (const charCode of byteView) {
|
|
24
|
+
str += String.fromCharCode(charCode);
|
|
25
|
+
}
|
|
26
|
+
// Binary string to base64
|
|
27
|
+
const base64String = btoa(str);
|
|
28
|
+
// Base64 to base64url
|
|
29
|
+
// We assume that the base64url string is well-formed.
|
|
30
|
+
const base64urlString = base64String
|
|
31
|
+
.replace(/\+/g, "-")
|
|
32
|
+
.replace(/\//g, "_")
|
|
33
|
+
.replace(/=/g, "");
|
|
34
|
+
return base64urlString;
|
|
35
|
+
}
|
|
36
|
+
exports.bufferToBase64url = bufferToBase64url;
|
|
37
|
+
//# sourceMappingURL=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C;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,iDAAiD;AACpC,QAAA,SAAS,GAAG,MAAM,CAAC;AACnB,QAAA,YAAY,GAAG,SAAS,CAAC;AAEtC,SAAgB,OAAO,CACrB,YAA6B,EAC7B,MAAc,EACd,KAAU;IAEV,IAAI,MAAM,KAAK,iBAAS,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,MAAM,KAAK,oBAAY,EAAE;QAC3B,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;KAC5B;IACD,IAAI,MAAM,YAAY,KAAK,EAAE;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,OAAO,CAAW,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC7E;IACD,IAAI,MAAM,YAAY,MAAM,EAAE;QAC5B,MAAM,MAAM,GAAQ,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACvD,IAAI,WAAW,CAAC,MAAM,EAAE;gBACtB,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpC,IAAI,CAAC,KAAK,SAAS,EAAE;oBACnB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;iBAChB;aACF;YAED,IAAI,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,EAAE;gBACnB,IAAI,WAAW,CAAC,QAAQ,EAAE;oBACxB,MAAM,IAAI,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;iBACxC;gBACD,SAAS;aACV;YACD,oEAAoE;YACpE,8DAA8D;YAC9D,uEAAuE;YACvE,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE;gBACtB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACnB,SAAS;aACV;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,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":["../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CAAqC,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"}
|