@simplewebauthn/browser 7.1.0 → 7.4.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/dist/bundle/index.es5.umd.min.js +2 -2
- package/dist/bundle/index.js +120 -32
- package/dist/bundle/index.umd.min.js +2 -2
- package/dist/types/helpers/identifyAuthenticationError.d.ts +1 -1
- package/dist/types/helpers/identifyRegistrationError.d.ts +1 -1
- package/dist/types/helpers/webAuthnError.d.ts +10 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -3
- package/dist/types/helpers/structs.d.ts +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* [@simplewebauthn/browser@7.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SimpleWebAuthnBrowser={})}(this,(function(e){"use strict";var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function l(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,l)}u((n=n.apply(e,t||[])).next())}))}function o(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function i(e){var t,r,n=new Uint8Array(e),o="";try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(n),a=i.next();!a.done;a=i.next()){var l=a.value;o+=String.fromCharCode(l)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function a(e){for(var t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,n=t.padEnd(t.length+r,"="),o=atob(n),i=new ArrayBuffer(o.length),a=new Uint8Array(i),l=0;l<o.length;l++)a[l]=o.charCodeAt(l);return i}function l(){return void 0!==(null===window||void 0===window?void 0:window.PublicKeyCredential)&&"function"==typeof window.PublicKeyCredential}function u(e){var t=e.id;return r(r({},e),{id:a(t),transports:e.transports})}function s(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}var c=function(e){function r(t,r){void 0===r&&(r="WebAuthnError");var n=e.call(this,t)||this;return n.name=r,n}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}(r,e),r}(Error);var d=new(function(){function e(){}return e.prototype.createNewAbortSignal=function(){this.controller&&this.controller.abort("Cancelling existing WebAuthn API call for new one");var e=new AbortController;return this.controller=e,e.signal},e}()),f=["cross-platform","platform"];function p(e){if(e&&!(f.indexOf(e)<0))return e}function h(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){return[2,void 0!==(e=window.PublicKeyCredential).isConditionalMediationAvailable&&e.isConditionalMediationAvailable()]}))}))}e.browserSupportsWebAuthn=l,e.browserSupportsWebAuthnAutofill=h,e.platformAuthenticatorIsAvailable=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){return l()?[2,PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()]:[2,!1]}))}))},e.startAuthentication=function(e,t){var f,w;return void 0===t&&(t=!1),n(this,void 0,void 0,(function(){var n,b,y,v,g,m,E,A,S;return o(this,(function(o){switch(o.label){case 0:if(!l())throw new Error("WebAuthn is not supported in this browser");return 0!==(null===(f=e.allowCredentials)||void 0===f?void 0:f.length)&&(n=null===(w=e.allowCredentials)||void 0===w?void 0:w.map(u)),b=r(r({},e),{challenge:a(e.challenge),allowCredentials:n}),y={},t?[4,h()]:[3,2];case 1:if(!o.sent())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete*='webauthn']").length<1)throw Error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected');y.mediation="conditional",b.allowCredentials=[],o.label=2;case 2:y.publicKey=b,y.signal=d.createNewAbortSignal(),o.label=3;case 3:return o.trys.push([3,5,,6]),[4,navigator.credentials.get(y)];case 4:return v=o.sent(),[3,6];case 5:throw function(e){var t=e.error,r=e.options,n=r.publicKey;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===t.name){if(r.signal===(new AbortController).signal)return new c("Authentication ceremony was sent an abort signal","AbortError")}else if("NotAllowedError"===t.name);else if("SecurityError"===t.name){var o=window.location.hostname;if(!s(o))return new c("".concat(window.location.hostname," is an invalid domain"),"SecurityError");if(n.rpId!==o)return new c('The RP ID "'.concat(n.rpId,'" is invalid for this domain'),"SecurityError")}else if("UnknownError"===t.name)return new c("The authenticator was unable to process the specified options, or could not create a new assertion signature","UnknownError");return t}({error:o.sent(),options:y});case 6:if(!v)throw new Error("Authentication was not completed");return g=v.id,m=v.rawId,E=v.response,A=v.type,S=void 0,E.userHandle&&(C=E.userHandle,S=new TextDecoder("utf-8").decode(C)),[2,{id:g,rawId:i(m),response:{authenticatorData:i(E.authenticatorData),clientDataJSON:i(E.clientDataJSON),signature:i(E.signature),userHandle:S},type:A,clientExtensionResults:v.getClientExtensionResults(),authenticatorAttachment:p(v.authenticatorAttachment)}]}var C}))}))},e.startRegistration=function(e){var t;return n(this,void 0,void 0,(function(){var n,f,h,w,b,y,v,g;return o(this,(function(o){switch(o.label){case 0:if(!l())throw new Error("WebAuthn is not supported in this browser");n=r(r({},e),{challenge:a(e.challenge),user:r(r({},e.user),{id:(m=e.user.id,(new TextEncoder).encode(m))}),excludeCredentials:null===(t=e.excludeCredentials)||void 0===t?void 0:t.map(u)}),(f={publicKey:n}).signal=d.createNewAbortSignal(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,navigator.credentials.create(f)];case 2:return h=o.sent(),[3,4];case 3:throw function(e){var t,r,n=e.error,o=e.options,i=o.publicKey;if(!i)throw Error("options was missing required publicKey property");if("AbortError"===n.name){if(o.signal===(new AbortController).signal)return new c("Registration ceremony was sent an abort signal","AbortError")}else if("ConstraintError"===n.name){if(!0===(null===(t=i.authenticatorSelection)||void 0===t?void 0:t.requireResidentKey))return new c("Discoverable credentials were required but no available authenticator supported it","ConstraintError");if("required"===(null===(r=i.authenticatorSelection)||void 0===r?void 0:r.userVerification))return new c("User verification was required but no available authenticator supported it","ConstraintError")}else{if("InvalidStateError"===n.name)return new c("The authenticator was previously registered","InvalidStateError");if("NotAllowedError"===n.name);else{if("NotSupportedError"===n.name)return 0===i.pubKeyCredParams.filter((function(e){return"public-key"===e.type})).length?new c('No entry in pubKeyCredParams was of type "public-key"',"NotSupportedError"):new c("No available authenticator supported any of the specified pubKeyCredParams algorithms","NotSupportedError");if("SecurityError"===n.name){var a=window.location.hostname;if(!s(a))return new c("".concat(window.location.hostname," is an invalid domain"),"SecurityError");if(i.rp.id!==a)return new c('The RP ID "'.concat(i.rp.id,'" is invalid for this domain'),"SecurityError")}else if("TypeError"===n.name){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new c("User ID was not between 1 and 64 characters","TypeError")}else if("UnknownError"===n.name)return new c("The authenticator was unable to process the specified options, or could not create a new credential","UnknownError")}}return n}({error:o.sent(),options:f});case 4:if(!h)throw new Error("Registration was not completed");return w=h.id,b=h.rawId,y=h.response,v=h.type,g=void 0,"function"==typeof y.getTransports&&(g=y.getTransports()),[2,{id:w,rawId:i(b),response:{attestationObject:i(y.attestationObject),clientDataJSON:i(y.clientDataJSON),transports:g},type:v,clientExtensionResults:h.getClientExtensionResults(),authenticatorAttachment:p(h.authenticatorAttachment)}]}var m}))}))},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
/* [@simplewebauthn/browser@7.4.0] */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SimpleWebAuthnBrowser={})}(this,(function(e){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function o(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function i(e){var t,n,r=new Uint8Array(e),o="";try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(r),a=i.next();!a.done;a=i.next()){var s=a.value;o+=String.fromCharCode(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function a(e){for(var t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,"="),o=atob(r),i=new ArrayBuffer(o.length),a=new Uint8Array(i),s=0;s<o.length;s++)a[s]=o.charCodeAt(s);return i}function s(){return void 0!==(null===window||void 0===window?void 0:window.PublicKeyCredential)&&"function"==typeof window.PublicKeyCredential}function u(e){var t=e.id;return n(n({},e),{id:a(t),transports:e.transports})}function c(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}var l=function(e){function n(t){var n=t.message,r=t.code,o=t.cause,i=t.name,a=e.call(this,n,{cause:o})||this;return a.name=null!=i?i:o.name,a.code=r,a}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,e),n}(Error);var d=new(function(){function e(){}return e.prototype.createNewAbortSignal=function(){if(this.controller){var e=new Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}var t=new AbortController;return this.controller=t,t.signal},e}()),f=["cross-platform","platform"];function p(e){if(e&&!(f.indexOf(e)<0))return e}function h(){return r(this,void 0,void 0,(function(){var e;return o(this,(function(t){return[2,void 0!==(e=window.PublicKeyCredential).isConditionalMediationAvailable&&e.isConditionalMediationAvailable()]}))}))}e.browserSupportsWebAuthn=s,e.browserSupportsWebAuthnAutofill=h,e.platformAuthenticatorIsAvailable=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return s()?[2,PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()]:[2,!1]}))}))},e.startAuthentication=function(e,t){var f,w;return void 0===t&&(t=!1),r(this,void 0,void 0,(function(){var r,b,R,y,E,g,v,m,A;return o(this,(function(o){switch(o.label){case 0:if(!s())throw new Error("WebAuthn is not supported in this browser");return 0!==(null===(f=e.allowCredentials)||void 0===f?void 0:f.length)&&(r=null===(w=e.allowCredentials)||void 0===w?void 0:w.map(u)),b=n(n({},e),{challenge:a(e.challenge),allowCredentials:r}),R={},t?[4,h()]:[3,2];case 1:if(!o.sent())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete*='webauthn']").length<1)throw Error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected');R.mediation="conditional",b.allowCredentials=[],o.label=2;case 2:R.publicKey=b,R.signal=d.createNewAbortSignal(),o.label=3;case 3:return o.trys.push([3,5,,6]),[4,navigator.credentials.get(R)];case 4:return y=o.sent(),[3,6];case 5:throw function(e){var t=e.error,n=e.options,r=n.publicKey;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===t.name){if(n.signal instanceof AbortSignal)return new l({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if("NotAllowedError"===t.name)return new l({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if("SecurityError"===t.name){var o=window.location.hostname;if(!c(o))return new l({message:"".concat(window.location.hostname," is an invalid domain"),code:"ERROR_INVALID_DOMAIN",cause:t});if(r.rpId!==o)return new l({message:'The RP ID "'.concat(r.rpId,'" is invalid for this domain'),code:"ERROR_INVALID_RP_ID",cause:t})}else if("UnknownError"===t.name)return new l({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return t}({error:o.sent(),options:R});case 6:if(!y)throw new Error("Authentication was not completed");return E=y.id,g=y.rawId,v=y.response,m=y.type,A=void 0,v.userHandle&&(_=v.userHandle,A=new TextDecoder("utf-8").decode(_)),[2,{id:E,rawId:i(g),response:{authenticatorData:i(v.authenticatorData),clientDataJSON:i(v.clientDataJSON),signature:i(v.signature),userHandle:A},type:m,clientExtensionResults:y.getClientExtensionResults(),authenticatorAttachment:p(y.authenticatorAttachment)}]}var _}))}))},e.startRegistration=function(e){var t;return r(this,void 0,void 0,(function(){var r,f,h,w,b,R,y,E,g,v,m,A;return o(this,(function(o){switch(o.label){case 0:if(!s())throw new Error("WebAuthn is not supported in this browser");r=n(n({},e),{challenge:a(e.challenge),user:n(n({},e.user),{id:(_=e.user.id,(new TextEncoder).encode(_))}),excludeCredentials:null===(t=e.excludeCredentials)||void 0===t?void 0:t.map(u)}),(f={publicKey:r}).signal=d.createNewAbortSignal(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,navigator.credentials.create(f)];case 2:return h=o.sent(),[3,4];case 3:throw function(e){var t,n,r=e.error,o=e.options,i=o.publicKey;if(!i)throw Error("options was missing required publicKey property");if("AbortError"===r.name){if(o.signal instanceof AbortSignal)return new l({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:r})}else if("ConstraintError"===r.name){if(!0===(null===(t=i.authenticatorSelection)||void 0===t?void 0:t.requireResidentKey))return new l({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:r});if("required"===(null===(n=i.authenticatorSelection)||void 0===n?void 0:n.userVerification))return new l({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:r})}else{if("InvalidStateError"===r.name)return new l({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:r});if("NotAllowedError"===r.name)return new l({message:r.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r});if("NotSupportedError"===r.name)return 0===i.pubKeyCredParams.filter((function(e){return"public-key"===e.type})).length?new l({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:r}):new l({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:r});if("SecurityError"===r.name){var a=window.location.hostname;if(!c(a))return new l({message:"".concat(window.location.hostname," is an invalid domain"),code:"ERROR_INVALID_DOMAIN",cause:r});if(i.rp.id!==a)return new l({message:'The RP ID "'.concat(i.rp.id,'" is invalid for this domain'),code:"ERROR_INVALID_RP_ID",cause:r})}else if("TypeError"===r.name){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new l({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:r})}else if("UnknownError"===r.name)return new l({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:r})}return r}({error:o.sent(),options:f});case 4:if(!h)throw new Error("Registration was not completed");return w=h.id,b=h.rawId,R=h.response,y=h.type,E=void 0,"function"==typeof R.getTransports&&(E=R.getTransports()),g=void 0,"function"==typeof R.getPublicKeyAlgorithm&&(g=R.getPublicKeyAlgorithm()),v=void 0,"function"==typeof R.getPublicKey&&null!==(m=R.getPublicKey())&&(v=i(m)),"function"==typeof R.getAuthenticatorData&&(A=i(R.getAuthenticatorData())),[2,{id:w,rawId:i(b),response:{attestationObject:i(R.attestationObject),clientDataJSON:i(R.clientDataJSON),transports:E,publicKeyAlgorithm:g,publicKey:v,authenticatorData:A},type:y,clientExtensionResults:h.getClientExtensionResults(),authenticatorAttachment:p(h.authenticatorAttachment)}]}var _}))}))},Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* [@simplewebauthn/browser@7.
|
|
1
|
+
/* [@simplewebauthn/browser@7.4.0] */
|
|
2
2
|
function utf8StringToBuffer(value) {
|
|
3
3
|
return new TextEncoder().encode(value);
|
|
4
4
|
}
|
|
@@ -27,7 +27,7 @@ function base64URLStringToBuffer(base64URLString) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function browserSupportsWebAuthn() {
|
|
30
|
-
return (
|
|
30
|
+
return (window?.PublicKeyCredential !== undefined && typeof window.PublicKeyCredential === 'function');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function toPublicKeyCredentialDescriptor(descriptor) {
|
|
@@ -44,66 +44,116 @@ function isValidDomain(hostname) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
class WebAuthnError extends Error {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
code;
|
|
48
|
+
constructor({ message, code, cause, name, }) {
|
|
49
|
+
super(message, { cause });
|
|
50
|
+
this.name = name ?? cause.name;
|
|
51
|
+
this.code = code;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
function identifyRegistrationError({ error, options, }) {
|
|
54
|
-
var _a, _b;
|
|
55
56
|
const { publicKey } = options;
|
|
56
57
|
if (!publicKey) {
|
|
57
58
|
throw Error('options was missing required publicKey property');
|
|
58
59
|
}
|
|
59
60
|
if (error.name === 'AbortError') {
|
|
60
|
-
if (options.signal
|
|
61
|
-
return new WebAuthnError(
|
|
61
|
+
if (options.signal instanceof AbortSignal) {
|
|
62
|
+
return new WebAuthnError({
|
|
63
|
+
message: 'Registration ceremony was sent an abort signal',
|
|
64
|
+
code: 'ERROR_CEREMONY_ABORTED',
|
|
65
|
+
cause: error,
|
|
66
|
+
});
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
else if (error.name === 'ConstraintError') {
|
|
65
|
-
if (
|
|
66
|
-
return new WebAuthnError(
|
|
70
|
+
if (publicKey.authenticatorSelection?.requireResidentKey === true) {
|
|
71
|
+
return new WebAuthnError({
|
|
72
|
+
message: 'Discoverable credentials were required but no available authenticator supported it',
|
|
73
|
+
code: 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',
|
|
74
|
+
cause: error,
|
|
75
|
+
});
|
|
67
76
|
}
|
|
68
|
-
else if (
|
|
69
|
-
return new WebAuthnError(
|
|
77
|
+
else if (publicKey.authenticatorSelection?.userVerification === 'required') {
|
|
78
|
+
return new WebAuthnError({
|
|
79
|
+
message: 'User verification was required but no available authenticator supported it',
|
|
80
|
+
code: 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',
|
|
81
|
+
cause: error,
|
|
82
|
+
});
|
|
70
83
|
}
|
|
71
84
|
}
|
|
72
85
|
else if (error.name === 'InvalidStateError') {
|
|
73
|
-
return new WebAuthnError(
|
|
86
|
+
return new WebAuthnError({
|
|
87
|
+
message: 'The authenticator was previously registered',
|
|
88
|
+
code: 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',
|
|
89
|
+
cause: error
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else if (error.name === 'NotAllowedError') {
|
|
93
|
+
return new WebAuthnError({
|
|
94
|
+
message: error.message,
|
|
95
|
+
code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',
|
|
96
|
+
cause: error,
|
|
97
|
+
});
|
|
74
98
|
}
|
|
75
|
-
else if (error.name === 'NotAllowedError') ;
|
|
76
99
|
else if (error.name === 'NotSupportedError') {
|
|
77
100
|
const validPubKeyCredParams = publicKey.pubKeyCredParams.filter(param => param.type === 'public-key');
|
|
78
101
|
if (validPubKeyCredParams.length === 0) {
|
|
79
|
-
return new WebAuthnError(
|
|
102
|
+
return new WebAuthnError({
|
|
103
|
+
message: 'No entry in pubKeyCredParams was of type "public-key"',
|
|
104
|
+
code: 'ERROR_MALFORMED_PUBKEYCREDPARAMS',
|
|
105
|
+
cause: error,
|
|
106
|
+
});
|
|
80
107
|
}
|
|
81
|
-
return new WebAuthnError(
|
|
108
|
+
return new WebAuthnError({
|
|
109
|
+
message: 'No available authenticator supported any of the specified pubKeyCredParams algorithms',
|
|
110
|
+
code: 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',
|
|
111
|
+
cause: error,
|
|
112
|
+
});
|
|
82
113
|
}
|
|
83
114
|
else if (error.name === 'SecurityError') {
|
|
84
115
|
const effectiveDomain = window.location.hostname;
|
|
85
116
|
if (!isValidDomain(effectiveDomain)) {
|
|
86
|
-
return new WebAuthnError(
|
|
117
|
+
return new WebAuthnError({
|
|
118
|
+
message: `${window.location.hostname} is an invalid domain`,
|
|
119
|
+
code: 'ERROR_INVALID_DOMAIN',
|
|
120
|
+
cause: error
|
|
121
|
+
});
|
|
87
122
|
}
|
|
88
123
|
else if (publicKey.rp.id !== effectiveDomain) {
|
|
89
|
-
return new WebAuthnError(
|
|
124
|
+
return new WebAuthnError({
|
|
125
|
+
message: `The RP ID "${publicKey.rp.id}" is invalid for this domain`,
|
|
126
|
+
code: 'ERROR_INVALID_RP_ID',
|
|
127
|
+
cause: error,
|
|
128
|
+
});
|
|
90
129
|
}
|
|
91
130
|
}
|
|
92
131
|
else if (error.name === 'TypeError') {
|
|
93
132
|
if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) {
|
|
94
|
-
return new WebAuthnError(
|
|
133
|
+
return new WebAuthnError({
|
|
134
|
+
message: 'User ID was not between 1 and 64 characters',
|
|
135
|
+
code: 'ERROR_INVALID_USER_ID_LENGTH',
|
|
136
|
+
cause: error,
|
|
137
|
+
});
|
|
95
138
|
}
|
|
96
139
|
}
|
|
97
140
|
else if (error.name === 'UnknownError') {
|
|
98
|
-
return new WebAuthnError(
|
|
141
|
+
return new WebAuthnError({
|
|
142
|
+
message: 'The authenticator was unable to process the specified options, or could not create a new credential',
|
|
143
|
+
code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',
|
|
144
|
+
cause: error,
|
|
145
|
+
});
|
|
99
146
|
}
|
|
100
147
|
return error;
|
|
101
148
|
}
|
|
102
149
|
|
|
103
150
|
class WebAuthnAbortService {
|
|
151
|
+
controller;
|
|
104
152
|
createNewAbortSignal() {
|
|
105
153
|
if (this.controller) {
|
|
106
|
-
|
|
154
|
+
const abortError = new Error('Cancelling existing WebAuthn API call for new one');
|
|
155
|
+
abortError.name = 'AbortError';
|
|
156
|
+
this.controller.abort(abortError);
|
|
107
157
|
}
|
|
108
158
|
const newController = new AbortController();
|
|
109
159
|
this.controller = newController;
|
|
@@ -124,7 +174,6 @@ function toAuthenticatorAttachment(attachment) {
|
|
|
124
174
|
}
|
|
125
175
|
|
|
126
176
|
async function startRegistration(creationOptionsJSON) {
|
|
127
|
-
var _a;
|
|
128
177
|
if (!browserSupportsWebAuthn()) {
|
|
129
178
|
throw new Error('WebAuthn is not supported in this browser');
|
|
130
179
|
}
|
|
@@ -135,7 +184,7 @@ async function startRegistration(creationOptionsJSON) {
|
|
|
135
184
|
...creationOptionsJSON.user,
|
|
136
185
|
id: utf8StringToBuffer(creationOptionsJSON.user.id),
|
|
137
186
|
},
|
|
138
|
-
excludeCredentials:
|
|
187
|
+
excludeCredentials: creationOptionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor),
|
|
139
188
|
};
|
|
140
189
|
const options = { publicKey };
|
|
141
190
|
options.signal = webauthnAbortService.createNewAbortSignal();
|
|
@@ -154,6 +203,21 @@ async function startRegistration(creationOptionsJSON) {
|
|
|
154
203
|
if (typeof response.getTransports === 'function') {
|
|
155
204
|
transports = response.getTransports();
|
|
156
205
|
}
|
|
206
|
+
let responsePublicKeyAlgorithm = undefined;
|
|
207
|
+
if (typeof response.getPublicKeyAlgorithm === 'function') {
|
|
208
|
+
responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();
|
|
209
|
+
}
|
|
210
|
+
let responsePublicKey = undefined;
|
|
211
|
+
if (typeof response.getPublicKey === 'function') {
|
|
212
|
+
const _publicKey = response.getPublicKey();
|
|
213
|
+
if (_publicKey !== null) {
|
|
214
|
+
responsePublicKey = bufferToBase64URLString(_publicKey);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
let responseAuthenticatorData;
|
|
218
|
+
if (typeof response.getAuthenticatorData === 'function') {
|
|
219
|
+
responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());
|
|
220
|
+
}
|
|
157
221
|
return {
|
|
158
222
|
id,
|
|
159
223
|
rawId: bufferToBase64URLString(rawId),
|
|
@@ -161,6 +225,9 @@ async function startRegistration(creationOptionsJSON) {
|
|
|
161
225
|
attestationObject: bufferToBase64URLString(response.attestationObject),
|
|
162
226
|
clientDataJSON: bufferToBase64URLString(response.clientDataJSON),
|
|
163
227
|
transports,
|
|
228
|
+
publicKeyAlgorithm: responsePublicKeyAlgorithm,
|
|
229
|
+
publicKey: responsePublicKey,
|
|
230
|
+
authenticatorData: responseAuthenticatorData,
|
|
164
231
|
},
|
|
165
232
|
type,
|
|
166
233
|
clientExtensionResults: credential.getClientExtensionResults(),
|
|
@@ -184,34 +251,55 @@ function identifyAuthenticationError({ error, options, }) {
|
|
|
184
251
|
throw Error('options was missing required publicKey property');
|
|
185
252
|
}
|
|
186
253
|
if (error.name === 'AbortError') {
|
|
187
|
-
if (options.signal
|
|
188
|
-
return new WebAuthnError(
|
|
254
|
+
if (options.signal instanceof AbortSignal) {
|
|
255
|
+
return new WebAuthnError({
|
|
256
|
+
message: 'Authentication ceremony was sent an abort signal',
|
|
257
|
+
code: 'ERROR_CEREMONY_ABORTED',
|
|
258
|
+
cause: error,
|
|
259
|
+
});
|
|
189
260
|
}
|
|
190
261
|
}
|
|
191
|
-
else if (error.name === 'NotAllowedError')
|
|
262
|
+
else if (error.name === 'NotAllowedError') {
|
|
263
|
+
return new WebAuthnError({
|
|
264
|
+
message: error.message,
|
|
265
|
+
code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',
|
|
266
|
+
cause: error,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
192
269
|
else if (error.name === 'SecurityError') {
|
|
193
270
|
const effectiveDomain = window.location.hostname;
|
|
194
271
|
if (!isValidDomain(effectiveDomain)) {
|
|
195
|
-
return new WebAuthnError(
|
|
272
|
+
return new WebAuthnError({
|
|
273
|
+
message: `${window.location.hostname} is an invalid domain`,
|
|
274
|
+
code: 'ERROR_INVALID_DOMAIN',
|
|
275
|
+
cause: error,
|
|
276
|
+
});
|
|
196
277
|
}
|
|
197
278
|
else if (publicKey.rpId !== effectiveDomain) {
|
|
198
|
-
return new WebAuthnError(
|
|
279
|
+
return new WebAuthnError({
|
|
280
|
+
message: `The RP ID "${publicKey.rpId}" is invalid for this domain`,
|
|
281
|
+
code: 'ERROR_INVALID_RP_ID',
|
|
282
|
+
cause: error,
|
|
283
|
+
});
|
|
199
284
|
}
|
|
200
285
|
}
|
|
201
286
|
else if (error.name === 'UnknownError') {
|
|
202
|
-
return new WebAuthnError(
|
|
287
|
+
return new WebAuthnError({
|
|
288
|
+
message: 'The authenticator was unable to process the specified options, or could not create a new assertion signature',
|
|
289
|
+
code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',
|
|
290
|
+
cause: error,
|
|
291
|
+
});
|
|
203
292
|
}
|
|
204
293
|
return error;
|
|
205
294
|
}
|
|
206
295
|
|
|
207
296
|
async function startAuthentication(requestOptionsJSON, useBrowserAutofill = false) {
|
|
208
|
-
var _a, _b;
|
|
209
297
|
if (!browserSupportsWebAuthn()) {
|
|
210
298
|
throw new Error('WebAuthn is not supported in this browser');
|
|
211
299
|
}
|
|
212
300
|
let allowCredentials;
|
|
213
|
-
if (
|
|
214
|
-
allowCredentials =
|
|
301
|
+
if (requestOptionsJSON.allowCredentials?.length !== 0) {
|
|
302
|
+
allowCredentials = requestOptionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor);
|
|
215
303
|
}
|
|
216
304
|
const publicKey = {
|
|
217
305
|
...requestOptionsJSON,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* [@simplewebauthn/browser@7.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SimpleWebAuthnBrowser={})}(this,(function(e){"use strict";function t(e){const t=new Uint8Array(e);let
|
|
1
|
+
/* [@simplewebauthn/browser@7.4.0] */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SimpleWebAuthnBrowser={})}(this,(function(e){"use strict";function t(e){const t=new Uint8Array(e);let n="";for(const e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function n(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,"="),o=atob(r),a=new ArrayBuffer(o.length),i=new Uint8Array(a);for(let e=0;e<o.length;e++)i[e]=o.charCodeAt(e);return a}function r(){return void 0!==window?.PublicKeyCredential&&"function"==typeof window.PublicKeyCredential}function o(e){const{id:t}=e;return{...e,id:n(t),transports:e.transports}}function a(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}class i extends Error{code;constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),this.name=r??n.name,this.code=t}}const s=new class{controller;createNewAbortSignal(){if(this.controller){const e=new Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}const e=new AbortController;return this.controller=e,e.signal}},c=["cross-platform","platform"];function l(e){if(e&&!(c.indexOf(e)<0))return e}async function u(){const e=window.PublicKeyCredential;return void 0!==e.isConditionalMediationAvailable&&e.isConditionalMediationAvailable()}e.browserSupportsWebAuthn=r,e.browserSupportsWebAuthnAutofill=u,e.platformAuthenticatorIsAvailable=async function(){return!!r()&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()},e.startAuthentication=async function(e,c=!1){if(!r())throw new Error("WebAuthn is not supported in this browser");let d;0!==e.allowCredentials?.length&&(d=e.allowCredentials?.map(o));const p={...e,challenge:n(e.challenge),allowCredentials:d},R={};if(c){if(!await u())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete*='webauthn']").length<1)throw Error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected');R.mediation="conditional",p.allowCredentials=[]}let f;R.publicKey=p,R.signal=s.createNewAbortSignal();try{f=await navigator.credentials.get(R)}catch(e){throw function({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new i({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if("NotAllowedError"===e.name)return new i({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("SecurityError"===e.name){const t=window.location.hostname;if(!a(t))return new i({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(n.rpId!==t)return new i({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new i({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}({error:e,options:R})}if(!f)throw new Error("Authentication was not completed");const{id:w,rawId:h,response:E,type:g}=f;let A;var m;return E.userHandle&&(m=E.userHandle,A=new TextDecoder("utf-8").decode(m)),{id:w,rawId:t(h),response:{authenticatorData:t(E.authenticatorData),clientDataJSON:t(E.clientDataJSON),signature:t(E.signature),userHandle:A},type:g,clientExtensionResults:f.getClientExtensionResults(),authenticatorAttachment:l(f.authenticatorAttachment)}},e.startRegistration=async function(e){if(!r())throw new Error("WebAuthn is not supported in this browser");var c;const u={publicKey:{...e,challenge:n(e.challenge),user:{...e.user,id:(c=e.user.id,(new TextEncoder).encode(c))},excludeCredentials:e.excludeCredentials?.map(o)}};let d;u.signal=s.createNewAbortSignal();try{d=await navigator.credentials.create(u)}catch(e){throw function({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new i({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(!0===n.authenticatorSelection?.requireResidentKey)return new i({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if("required"===n.authenticatorSelection?.userVerification)return new i({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if("InvalidStateError"===e.name)return new i({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if("NotAllowedError"===e.name)return new i({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("NotSupportedError"===e.name)return 0===n.pubKeyCredParams.filter((e=>"public-key"===e.type)).length?new i({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new i({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if("SecurityError"===e.name){const t=window.location.hostname;if(!a(t))return new i({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(n.rp.id!==t)return new i({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new i({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new i({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}({error:e,options:u})}if(!d)throw new Error("Registration was not completed");const{id:p,rawId:R,response:f,type:w}=d;let h,E,g,A;if("function"==typeof f.getTransports&&(h=f.getTransports()),"function"==typeof f.getPublicKeyAlgorithm&&(E=f.getPublicKeyAlgorithm()),"function"==typeof f.getPublicKey){const e=f.getPublicKey();null!==e&&(g=t(e))}return"function"==typeof f.getAuthenticatorData&&(A=t(f.getAuthenticatorData())),{id:p,rawId:t(R),response:{attestationObject:t(f.attestationObject),clientDataJSON:t(f.clientDataJSON),transports:h,publicKeyAlgorithm:E,publicKey:g,authenticatorData:A},type:w,clientExtensionResults:d.getClientExtensionResults(),authenticatorAttachment:l(d.authenticatorAttachment)}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class WebAuthnError extends Error {
|
|
2
|
+
code: WebAuthnErrorCode;
|
|
3
|
+
constructor({ message, code, cause, name, }: {
|
|
4
|
+
message: string;
|
|
5
|
+
code: WebAuthnErrorCode;
|
|
6
|
+
cause: Error;
|
|
7
|
+
name?: string;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export type WebAuthnErrorCode = 'ERROR_CEREMONY_ABORTED' | 'ERROR_INVALID_DOMAIN' | 'ERROR_INVALID_RP_ID' | 'ERROR_INVALID_USER_ID_LENGTH' | 'ERROR_MALFORMED_PUBKEYCREDPARAMS' | 'ERROR_AUTHENTICATOR_GENERAL_ERROR' | 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT' | 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT' | 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED' | 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG' | 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ import { browserSupportsWebAuthn } from './helpers/browserSupportsWebAuthn';
|
|
|
4
4
|
import { platformAuthenticatorIsAvailable } from './helpers/platformAuthenticatorIsAvailable';
|
|
5
5
|
import { browserSupportsWebAuthnAutofill } from './helpers/browserSupportsWebAuthnAutofill';
|
|
6
6
|
export { startRegistration, startAuthentication, browserSupportsWebAuthn, browserSupportsWebAuthnAutofill, platformAuthenticatorIsAvailable, };
|
|
7
|
+
export type { WebAuthnErrorCode } from './helpers/webAuthnError';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplewebauthn/browser",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "SimpleWebAuthn for Browsers",
|
|
5
5
|
"main": "dist/bundle/index.js",
|
|
6
6
|
"unpkg": "dist/bundle/index.umd.min.js",
|
|
@@ -30,14 +30,16 @@
|
|
|
30
30
|
"fido",
|
|
31
31
|
"umd"
|
|
32
32
|
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@simplewebauthn/typescript-types": "^7.4.0"
|
|
35
|
+
},
|
|
33
36
|
"devDependencies": {
|
|
34
37
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
35
38
|
"@rollup/plugin-typescript": "^8.2.1",
|
|
36
|
-
"@simplewebauthn/typescript-types": "*",
|
|
37
39
|
"rollup": "^2.52.1",
|
|
38
40
|
"rollup-plugin-terser": "^7.0.2",
|
|
39
41
|
"rollup-plugin-version-injector": "^1.3.3"
|
|
40
42
|
},
|
|
41
43
|
"type": "module",
|
|
42
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f21955a5947f575858db0cd9ee728abc6b5f4310"
|
|
43
45
|
}
|