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.d.cts
CHANGED
|
@@ -592,7 +592,12 @@ declare class ApiClient {
|
|
|
592
592
|
metadata?: Record<string, unknown>;
|
|
593
593
|
}): Promise<TransactionRecord>;
|
|
594
594
|
getTransactions(jwt: string, limit?: number): Promise<TransactionRecord[]>;
|
|
595
|
-
|
|
595
|
+
/**
|
|
596
|
+
* `label` is what the user's password manager will show for this passkey.
|
|
597
|
+
* Without one they see the account's opaque id. Sent, used, and forgotten —
|
|
598
|
+
* the backend echoes it into the options and stores nothing.
|
|
599
|
+
*/
|
|
600
|
+
getWebAuthnRegisterOptions(jwt: string, rpId: string, rpName: string, label?: string): Promise<_simplewebauthn_browser.PublicKeyCredentialCreationOptionsJSON>;
|
|
596
601
|
postWebAuthnRegister(jwt: string, response: _simplewebauthn_browser.RegistrationResponseJSON, origin: string): Promise<void>;
|
|
597
602
|
/**
|
|
598
603
|
* Exchange a token from the developer's own auth system for a Decane
|
package/dist/index.d.ts
CHANGED
|
@@ -592,7 +592,12 @@ declare class ApiClient {
|
|
|
592
592
|
metadata?: Record<string, unknown>;
|
|
593
593
|
}): Promise<TransactionRecord>;
|
|
594
594
|
getTransactions(jwt: string, limit?: number): Promise<TransactionRecord[]>;
|
|
595
|
-
|
|
595
|
+
/**
|
|
596
|
+
* `label` is what the user's password manager will show for this passkey.
|
|
597
|
+
* Without one they see the account's opaque id. Sent, used, and forgotten —
|
|
598
|
+
* the backend echoes it into the options and stores nothing.
|
|
599
|
+
*/
|
|
600
|
+
getWebAuthnRegisterOptions(jwt: string, rpId: string, rpName: string, label?: string): Promise<_simplewebauthn_browser.PublicKeyCredentialCreationOptionsJSON>;
|
|
596
601
|
postWebAuthnRegister(jwt: string, response: _simplewebauthn_browser.RegistrationResponseJSON, origin: string): Promise<void>;
|
|
597
602
|
/**
|
|
598
603
|
* Exchange a token from the developer's own auth system for a Decane
|
package/dist/index.js
CHANGED
|
@@ -2085,8 +2085,14 @@ var ApiClient = class {
|
|
|
2085
2085
|
return body.transactions;
|
|
2086
2086
|
}
|
|
2087
2087
|
// ── WebAuthn registration (additive to the PRF-only passkey flow) ─────────
|
|
2088
|
-
|
|
2089
|
-
|
|
2088
|
+
/**
|
|
2089
|
+
* `label` is what the user's password manager will show for this passkey.
|
|
2090
|
+
* Without one they see the account's opaque id. Sent, used, and forgotten —
|
|
2091
|
+
* the backend echoes it into the options and stores nothing.
|
|
2092
|
+
*/
|
|
2093
|
+
async getWebAuthnRegisterOptions(jwt, rpId, rpName, label) {
|
|
2094
|
+
const query = `rpId=${encodeURIComponent(rpId)}&rpName=${encodeURIComponent(rpName)}` + (label ? `&label=${encodeURIComponent(label)}` : "");
|
|
2095
|
+
return this._request(`/webauthn/register-options?${query}`, {
|
|
2090
2096
|
headers: { Authorization: `Bearer ${jwt}` }
|
|
2091
2097
|
});
|
|
2092
2098
|
}
|
|
@@ -2970,7 +2976,12 @@ function bufFromBytes(u) {
|
|
|
2970
2976
|
return u.buffer.slice(u.byteOffset, u.byteOffset + u.byteLength);
|
|
2971
2977
|
}
|
|
2972
2978
|
async function registerWebAuthnCredential(opts) {
|
|
2973
|
-
const baseOptions = await opts.api.getWebAuthnRegisterOptions(
|
|
2979
|
+
const baseOptions = await opts.api.getWebAuthnRegisterOptions(
|
|
2980
|
+
opts.jwt,
|
|
2981
|
+
opts.rpId,
|
|
2982
|
+
opts.rpName,
|
|
2983
|
+
opts.label
|
|
2984
|
+
);
|
|
2974
2985
|
if (opts.allowDuplicate) delete baseOptions.excludeCredentials;
|
|
2975
2986
|
const optionsJSON = {
|
|
2976
2987
|
...baseOptions,
|
|
@@ -3776,12 +3787,14 @@ async function createDecaneConnect(config) {
|
|
|
3776
3787
|
let credentialId;
|
|
3777
3788
|
let prfOutput;
|
|
3778
3789
|
try {
|
|
3790
|
+
const label = (await storage.getShare(userId))?.profile?.email;
|
|
3779
3791
|
({ credentialId, prfOutput } = await registerWebAuthnCredential({
|
|
3780
3792
|
api,
|
|
3781
3793
|
jwt,
|
|
3782
3794
|
rpId,
|
|
3783
3795
|
rpName,
|
|
3784
3796
|
prfSalt,
|
|
3797
|
+
...label ? { label } : {},
|
|
3785
3798
|
...opts.allowDuplicate ? { allowDuplicate: true } : {}
|
|
3786
3799
|
}));
|
|
3787
3800
|
} catch (e) {
|