Skip to content

Commit be3f01b

Browse files
JamesCullumgithub-actions[bot]
authored andcommitted
[skip_ci] v3.3.0: Build artifacts for Deno
1 parent f6d237d commit be3f01b

File tree

2 files changed

+1108
-488
lines changed

2 files changed

+1108
-488
lines changed

dist/main.cjs

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,17 @@ class PublicKey {
10051005

10061006
let parsedCose;
10071007
try {
1008-
parsedCose = cborX__namespace.decode(new Uint8Array(cose));
1008+
// In the current state, the "cose" parameter can contain not only the actual cose (= public key) but also extensions.
1009+
// Both are CBOR encoded entries, so you can treat and evaluate the "cose" parameter accordingly.
1010+
// "fromCose" is called from a context that contains an active AT flag (attestation), so the first CBOR entry is the actual cose.
1011+
// "tools.cbor.decode" will fail when multiple entries are provided (e.g. cose + at least one extension), so "decodeMultiple" is the sollution.
1012+
cborX__namespace.decodeMultiple(
1013+
new Uint8Array(cose),
1014+
cborObject => {
1015+
parsedCose = cborObject;
1016+
return false;
1017+
}
1018+
);
10091019
} catch (err) {
10101020
throw new Error(
10111021
"couldn't parse authenticator.authData.attestationData CBOR: " +
@@ -2895,15 +2905,25 @@ async function parseAuthenticatorData(authnrDataArrayBuffer) {
28952905
authnrDataBuf.buffer.slice(offset, authnrDataBuf.buffer.byteLength),
28962906
);
28972907

2908+
// TODO: does not only contain the COSE if the buffer contains extensions
28982909
ret.set("credentialPublicKeyCose", await publicKey.toCose());
28992910
ret.set("credentialPublicKeyJwk", await publicKey.toJwk());
29002911
ret.set("credentialPublicKeyPem", await publicKey.toPem());
29012912
}
29022913

2903-
// TODO: parse extensions
29042914
if (extensions) {
2905-
// extensionStart = offset
2906-
throw new Error("authenticator extensions not supported");
2915+
const cborObjects = cborX__namespace.decodeMultiple(new Uint8Array(authnrDataBuf.buffer.slice(offset, authnrDataBuf.buffer.byteLength)));
2916+
2917+
// skip publicKey if present
2918+
if (attestation) {
2919+
cborObjects.shift();
2920+
}
2921+
2922+
if (cborObjects.length === 0) {
2923+
throw new Error("extensions missing");
2924+
}
2925+
2926+
ret.set("webAuthnExtensions", cborObjects);
29072927
}
29082928

29092929
return ret;
@@ -4955,7 +4975,7 @@ class Fido2Lib {
49554975
* @param {String} [opts.rpName="Anonymous Service"] The name of the server
49564976
* @param {String} [opts.rpIcon] A URL for the service's icon. Can be a [RFC 2397]{@link https://tools.ietf.org/html/rfc2397} data URL.
49574977
* @param {Number} [opts.challengeSize=64] The number of bytes to use for the challenge
4958-
* @param {Object} [opts.authenticatorSelectionCriteria] An object describing what types of authenticators are allowed to register with the service.
4978+
* @param {Object} [opts.authenticatorSelection] An object describing what types of authenticators are allowed to register with the service.
49594979
* See [AuthenticatorSelectionCriteria]{@link https://w3.org/TR/webauthn/#authenticatorSelection} in the WebAuthn spec for details.
49604980
* @param {String} [opts.authenticatorAttachment] Indicates whether authenticators should be part of the OS ("platform"), or can be roaming authenticators ("cross-platform")
49614981
* @param {Boolean} [opts.authenticatorRequireResidentKey] Indicates whether authenticators must store the key internally (true) or if they can use a KDF to generate keys
@@ -5559,13 +5579,13 @@ class Fido2Lib {
55595579
* @property {Array} [pubKeyCredParams] A list of PublicKeyCredentialParameters objects, based on the `cryptoParams` that was passed to the constructor.
55605580
* @property {Number} [timeout] The amount of time that the call should take before returning an error
55615581
* @property {String} [attestation] Whether the client should request attestation from the authenticator or not
5562-
* @property {Object} [authenticatorSelectionCriteria] A object describing which authenticators are preferred for registration
5563-
* @property {String} [authenticatorSelectionCriteria.attachment] What type of attachement is acceptable for new authenticators.
5582+
* @property {Object} [authenticatorSelection] A object describing which authenticators are preferred for registration
5583+
* @property {String} [authenticatorSelection.attachment] What type of attachement is acceptable for new authenticators.
55645584
* Allowed values are "platform", meaning that the authenticator is embedded in the operating system, or
55655585
* "cross-platform", meaning that the authenticator is removeable (e.g. USB, NFC, or BLE).
5566-
* @property {Boolean} [authenticatorSelectionCriteria.requireResidentKey] Indicates whether authenticators must store the keys internally, or if they can
5586+
* @property {Boolean} [authenticatorSelection.requireResidentKey] Indicates whether authenticators must store the keys internally, or if they can
55675587
* store them externally (using a KDF or key wrapping)
5568-
* @property {String} [authenticatorSelectionCriteria.userVerification] Indicates whether user verification is required for authenticators. User verification
5588+
* @property {String} [authenticatorSelection.userVerification] Indicates whether user verification is required for authenticators. User verification
55695589
* means that an authenticator will validate a use through their biometrics (e.g. fingerprint) or knowledge (e.g. PIN). Allowed
55705590
* values for `userVerification` are "required", meaning that registration will fail if no authenticator provides user verification;
55715591
* "preferred", meaning that if multiple authenticators are available, the one(s) that provide user verification should be used; or

0 commit comments

Comments
 (0)