@simplewebauthn/server
Advanced tools
Comparing version 0.9.1 to 0.10.0
/// <reference types="node" /> | ||
import type { PublicKeyCredentialRequestOptionsJSON, Base64URLString } from '@simplewebauthn/typescript-types'; | ||
import type { PublicKeyCredentialRequestOptionsJSON, PublicKeyCredentialDescriptorJSON } from '@simplewebauthn/typescript-types'; | ||
declare type Options = { | ||
allowedCredentialIDs: Base64URLString[]; | ||
allowCredentials: PublicKeyCredentialDescriptorJSON[]; | ||
challenge?: string | Buffer; | ||
suggestedTransports?: AuthenticatorTransport[]; | ||
timeout?: number; | ||
@@ -14,7 +13,6 @@ userVerification?: UserVerificationRequirement; | ||
* | ||
* @param allowedCredentialIDs Array of base64url-encoded authenticator IDs registered by the | ||
* @param allowCredentials Authenticators previously registered by the user | ||
* @param challenge Random value the authenticator needs to sign and pass back | ||
* user for assertion | ||
* @param timeout How long (in ms) the user can take to complete assertion | ||
* @param suggestedTransports Suggested types of authenticators for assertion | ||
* @param userVerification Set to `'discouraged'` when asserting as part of a 2FA flow, otherwise | ||
@@ -21,0 +19,0 @@ * set to `'preferred'` or `'required'` as desired. |
@@ -11,7 +11,6 @@ "use strict"; | ||
* | ||
* @param allowedCredentialIDs Array of base64url-encoded authenticator IDs registered by the | ||
* @param allowCredentials Authenticators previously registered by the user | ||
* @param challenge Random value the authenticator needs to sign and pass back | ||
* user for assertion | ||
* @param timeout How long (in ms) the user can take to complete assertion | ||
* @param suggestedTransports Suggested types of authenticators for assertion | ||
* @param userVerification Set to `'discouraged'` when asserting as part of a 2FA flow, otherwise | ||
@@ -22,10 +21,6 @@ * set to `'preferred'` or `'required'` as desired. | ||
function generateAssertionOptions(options) { | ||
const { allowedCredentialIDs, challenge = generateChallenge_1.default(), suggestedTransports = ['usb', 'ble', 'nfc', 'internal'], timeout = 60000, userVerification, extensions, } = options; | ||
const { allowCredentials, challenge = generateChallenge_1.default(), timeout = 60000, userVerification, extensions, } = options; | ||
return { | ||
challenge: base64url_1.default.encode(challenge), | ||
allowCredentials: allowedCredentialIDs.map(id => ({ | ||
id, | ||
type: 'public-key', | ||
transports: suggestedTransports, | ||
})), | ||
allowCredentials, | ||
timeout, | ||
@@ -32,0 +27,0 @@ userVerification, |
/// <reference types="node" /> | ||
import type { PublicKeyCredentialCreationOptionsJSON, Base64URLString } from '@simplewebauthn/typescript-types'; | ||
import type { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialDescriptorJSON } from '@simplewebauthn/typescript-types'; | ||
declare type Options = { | ||
@@ -12,4 +12,3 @@ rpName: string; | ||
attestationType?: AttestationConveyancePreference; | ||
excludedCredentialIDs?: Base64URLString[]; | ||
suggestedTransports?: AuthenticatorTransport[]; | ||
excludeCredentials?: PublicKeyCredentialDescriptorJSON[]; | ||
authenticatorSelection?: AuthenticatorSelectionCriteria; | ||
@@ -38,5 +37,4 @@ extensions?: AuthenticationExtensionsClientInputs; | ||
* @param attestationType Specific attestation statement | ||
* @param excludedCredentialIDs Array of base64url-encoded authenticator IDs registered by the | ||
* user so the user can't register the same credential multiple times | ||
* @param suggestedTransports Suggested types of authenticators for attestation | ||
* @param excludeCredentials Authenticators registered by the user so the user can't register the | ||
* same credential multiple times | ||
* @param authenticatorSelection Advanced criteria for restricting the types of authenticators that | ||
@@ -43,0 +41,0 @@ * may be used |
@@ -65,5 +65,4 @@ "use strict"; | ||
* @param attestationType Specific attestation statement | ||
* @param excludedCredentialIDs Array of base64url-encoded authenticator IDs registered by the | ||
* user so the user can't register the same credential multiple times | ||
* @param suggestedTransports Suggested types of authenticators for attestation | ||
* @param excludeCredentials Authenticators registered by the user so the user can't register the | ||
* same credential multiple times | ||
* @param authenticatorSelection Advanced criteria for restricting the types of authenticators that | ||
@@ -76,3 +75,3 @@ * may be used | ||
function generateAttestationOptions(options) { | ||
const { rpName, rpID, userID, userName, challenge = generateChallenge_1.default(), userDisplayName = userName, timeout = 60000, attestationType = 'none', excludedCredentialIDs = [], suggestedTransports = ['usb', 'ble', 'nfc', 'internal'], authenticatorSelection = defaultAuthenticatorSelection, extensions, supportedAlgorithmIDs = defaultSupportedAlgorithmIDs, } = options; | ||
const { rpName, rpID, userID, userName, challenge = generateChallenge_1.default(), userDisplayName = userName, timeout = 60000, attestationType = 'none', excludeCredentials = [], authenticatorSelection = defaultAuthenticatorSelection, extensions, supportedAlgorithmIDs = defaultSupportedAlgorithmIDs, } = options; | ||
/** | ||
@@ -99,7 +98,3 @@ * Prepare pubKeyCredParams from the array of algorithm ID's | ||
attestation: attestationType, | ||
excludeCredentials: excludedCredentialIDs.map(id => ({ | ||
id, | ||
type: 'public-key', | ||
transports: suggestedTransports, | ||
})), | ||
excludeCredentials, | ||
authenticatorSelection, | ||
@@ -106,0 +101,0 @@ extensions, |
@@ -38,2 +38,3 @@ "use strict"; | ||
const verifyAndroidKey_1 = __importDefault(require("./verifications/verifyAndroidKey")); | ||
const verifyApple_1 = __importDefault(require("./verifications/verifyApple")); | ||
/** | ||
@@ -179,2 +180,10 @@ * Verify that the user has legitimately completed the registration process | ||
} | ||
else if (fmt === decodeAttestationObject_1.ATTESTATION_FORMATS.APPLE) { | ||
verified = await verifyApple_1.default({ | ||
attStmt, | ||
authData, | ||
clientDataHash, | ||
credentialPublicKey, | ||
}); | ||
} | ||
else if (fmt === decodeAttestationObject_1.ATTESTATION_FORMATS.NONE) { | ||
@@ -181,0 +190,0 @@ if (Object.keys(attStmt).length > 0) { |
@@ -14,2 +14,3 @@ /// <reference types="node" /> | ||
TPM = "tpm", | ||
APPLE = "apple", | ||
NONE = "none" | ||
@@ -16,0 +17,0 @@ } |
@@ -27,4 +27,5 @@ "use strict"; | ||
ATTESTATION_FORMATS["TPM"] = "tpm"; | ||
ATTESTATION_FORMATS["APPLE"] = "apple"; | ||
ATTESTATION_FORMATS["NONE"] = "none"; | ||
})(ATTESTATION_FORMATS = exports.ATTESTATION_FORMATS || (exports.ATTESTATION_FORMATS = {})); | ||
//# sourceMappingURL=decodeAttestationObject.js.map |
{ | ||
"name": "@simplewebauthn/server", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"description": "SimpleWebAuthn for Servers", | ||
@@ -38,3 +38,3 @@ "main": "dist/index.js", | ||
"@peculiar/asn1-x509": "^2.0.10", | ||
"@simplewebauthn/typescript-types": "^0.9.0", | ||
"@simplewebauthn/typescript-types": "^0.10.0", | ||
"base64url": "^3.0.1", | ||
@@ -48,3 +48,3 @@ "cbor": "^5.0.2", | ||
}, | ||
"gitHead": "6e7ebe07c8ebb00b8fc68c8d9b37a853eb9696ad", | ||
"gitHead": "30839edf84a46e15b1e3c45dbe5f6bb940dfc86a", | ||
"devDependencies": { | ||
@@ -51,0 +51,0 @@ "@types/cbor": "^5.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
196901
103
3097
+ Added@simplewebauthn/typescript-types@0.10.5(transitive)
- Removed@simplewebauthn/typescript-types@0.9.0(transitive)