decane-connect-kit 2.18.0 → 2.19.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 +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2167,8 +2167,14 @@ var ApiClient = class {
|
|
|
2167
2167
|
return body.transactions;
|
|
2168
2168
|
}
|
|
2169
2169
|
// ── WebAuthn registration (additive to the PRF-only passkey flow) ─────────
|
|
2170
|
-
|
|
2171
|
-
|
|
2170
|
+
/**
|
|
2171
|
+
* `label` is what the user's password manager will show for this passkey.
|
|
2172
|
+
* Without one they see the account's opaque id. Sent, used, and forgotten —
|
|
2173
|
+
* the backend echoes it into the options and stores nothing.
|
|
2174
|
+
*/
|
|
2175
|
+
async getWebAuthnRegisterOptions(jwt, rpId, rpName, label) {
|
|
2176
|
+
const query = `rpId=${encodeURIComponent(rpId)}&rpName=${encodeURIComponent(rpName)}` + (label ? `&label=${encodeURIComponent(label)}` : "");
|
|
2177
|
+
return this._request(`/webauthn/register-options?${query}`, {
|
|
2172
2178
|
headers: { Authorization: `Bearer ${jwt}` }
|
|
2173
2179
|
});
|
|
2174
2180
|
}
|
|
@@ -3052,7 +3058,12 @@ function bufFromBytes(u) {
|
|
|
3052
3058
|
return u.buffer.slice(u.byteOffset, u.byteOffset + u.byteLength);
|
|
3053
3059
|
}
|
|
3054
3060
|
async function registerWebAuthnCredential(opts) {
|
|
3055
|
-
const baseOptions = await opts.api.getWebAuthnRegisterOptions(
|
|
3061
|
+
const baseOptions = await opts.api.getWebAuthnRegisterOptions(
|
|
3062
|
+
opts.jwt,
|
|
3063
|
+
opts.rpId,
|
|
3064
|
+
opts.rpName,
|
|
3065
|
+
opts.label
|
|
3066
|
+
);
|
|
3056
3067
|
if (opts.allowDuplicate) delete baseOptions.excludeCredentials;
|
|
3057
3068
|
const optionsJSON = {
|
|
3058
3069
|
...baseOptions,
|
|
@@ -3858,12 +3869,14 @@ async function createDecaneConnect(config) {
|
|
|
3858
3869
|
let credentialId;
|
|
3859
3870
|
let prfOutput;
|
|
3860
3871
|
try {
|
|
3872
|
+
const label = (await storage.getShare(userId))?.profile?.email;
|
|
3861
3873
|
({ credentialId, prfOutput } = await registerWebAuthnCredential({
|
|
3862
3874
|
api,
|
|
3863
3875
|
jwt,
|
|
3864
3876
|
rpId,
|
|
3865
3877
|
rpName,
|
|
3866
3878
|
prfSalt,
|
|
3879
|
+
...label ? { label } : {},
|
|
3867
3880
|
...opts.allowDuplicate ? { allowDuplicate: true } : {}
|
|
3868
3881
|
}));
|
|
3869
3882
|
} catch (e) {
|