decane-connect-kit 2.15.0 → 2.16.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/index.cjs +26 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3865,8 +3865,19 @@ async function createDecaneConnect(config) {
|
|
|
3865
3865
|
rpName,
|
|
3866
3866
|
prfSalt
|
|
3867
3867
|
});
|
|
3868
|
-
|
|
3869
|
-
|
|
3868
|
+
let key = prfOutput;
|
|
3869
|
+
if (!key) {
|
|
3870
|
+
try {
|
|
3871
|
+
key = await getPrfOutput({ rpId, credentialId, prfSalt });
|
|
3872
|
+
} catch (e) {
|
|
3873
|
+
console.warn(
|
|
3874
|
+
"decane-connect-kit: the new credential did not return a PRF output; it cannot wrap the share.",
|
|
3875
|
+
e
|
|
3876
|
+
);
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
if (!key) throw new WebAuthnNotSupportedError();
|
|
3880
|
+
const wrappingKey = await importAesKey(key);
|
|
3870
3881
|
const iv = generateRandomBytes(12);
|
|
3871
3882
|
const wrappedDeviceShare = await aesGcmEncrypt(wrappingKey, deviceShare, iv);
|
|
3872
3883
|
const existing = await storage.getShare(userId);
|
|
@@ -4577,8 +4588,19 @@ async function createDecaneConnect(config) {
|
|
|
4577
4588
|
if (!auth) throw new ReconnectRequiredError();
|
|
4578
4589
|
if (!isPasskeySupported()) throw new WebAuthnNotSupportedError();
|
|
4579
4590
|
const stored = await storage.getShare(auth.userId);
|
|
4580
|
-
if (
|
|
4581
|
-
if (stored
|
|
4591
|
+
if (stored?.unlockMethod === "passkey") return;
|
|
4592
|
+
if (!stored) {
|
|
4593
|
+
if (!serverAssistedRecovery) throw new NewDeviceError();
|
|
4594
|
+
const tee = new TeeClient(teeUrl);
|
|
4595
|
+
const provisioned = await tee.provisionDeviceShare(auth.jwt);
|
|
4596
|
+
if (!provisioned) throw new NewDeviceError();
|
|
4597
|
+
try {
|
|
4598
|
+
await registerPasskeyForDevice(auth.userId, auth.jwt, provisioned);
|
|
4599
|
+
} finally {
|
|
4600
|
+
zeroize(provisioned);
|
|
4601
|
+
}
|
|
4602
|
+
return;
|
|
4603
|
+
}
|
|
4582
4604
|
let deviceShare;
|
|
4583
4605
|
try {
|
|
4584
4606
|
deviceShare = await aesGcmDecrypt(
|