@palbase/web 7.0.0 → 7.1.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/{analytics-facade-CdTK9Y0s.d.ts → analytics-facade-CZIwbsvG.d.ts} +23 -0
- package/dist/{analytics-facade-TB-D4ww8.d.cts → analytics-facade-esr6cOBN.d.cts} +23 -0
- package/dist/{chunk-7SNSLY5M.js → chunk-P6TWUWZC.js} +191 -2
- package/dist/chunk-P6TWUWZC.js.map +1 -0
- package/dist/index.cjs +190 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +190 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +1 -1
- package/dist/next/client.cjs +190 -1
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +190 -1
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +1 -1
- package/dist/{pb-B6ZcZy8v.d.ts → pb-AWwslm5m.d.ts} +1 -1
- package/dist/{pb-CiSj4lM3.d.cts → pb-BT-vKA4j.d.cts} +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-7SNSLY5M.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as SignInMethods, V as UnreadView, W as Unsubscribe } from './analytics-facade-
|
|
1
|
+
export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as SignInMethods, V as UnreadView, W as Unsubscribe } from './analytics-facade-esr6cOBN.cjs';
|
|
2
2
|
export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.cjs';
|
|
3
|
-
export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-
|
|
3
|
+
export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-BT-vKA4j.cjs';
|
|
4
4
|
export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.cjs';
|
|
5
5
|
export { F as FlagValue } from './pooled-flags-4GtDtsiu.js';
|
|
6
6
|
|
|
@@ -206,6 +206,6 @@ interface MlsGlue {
|
|
|
206
206
|
*/
|
|
207
207
|
declare function initMls(): Promise<MlsGlue>;
|
|
208
208
|
|
|
209
|
-
declare const VERSION = "7.
|
|
209
|
+
declare const VERSION = "7.1.0";
|
|
210
210
|
|
|
211
211
|
export { VERSION, initMls };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as SignInMethods, V as UnreadView, W as Unsubscribe } from './analytics-facade-
|
|
1
|
+
export { f as AnalyticsProperties, g as AuthChangeEvent, h as AuthState, i as AuthSuccess, A as AuthUser, j as Call, k as CallChangeCallback, l as CallParticipant, m as CallState, C as Chat, n as ChatBackend, o as ChatDraft, p as ChatKind, b as ChatMember, c as ChatMessage, q as ChatMessageKind, r as ChatRole, s as ChatState, t as CommsPrefs, F as FlagsView, M as MagicLinkResult, u as MentionRange, v as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, w as PalbeAnalytics, x as PalbeAuth, y as PalbeCalls, P as PalbeConfig, z as PalbeFlags, B as PalbeMessaging, D as PalbeOAuthConfig, E as PalbeRealtime, G as PresenceState, H as RealtimeChannel, R as RealtimeConnectionState, I as RealtimeHandler, a as RealtimePayload, J as RealtimeStatus, K as RealtimeStatusSnapshot, L as RealtimeSubscription, Q as ResolvedMention, S as ResolvedReply, T as SentReceipt, U as SignInMethods, V as UnreadView, W as Unsubscribe } from './analytics-facade-CZIwbsvG.js';
|
|
2
2
|
export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.js';
|
|
3
|
-
export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-
|
|
3
|
+
export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-AWwslm5m.js';
|
|
4
4
|
export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.js';
|
|
5
5
|
export { F as FlagValue } from './pooled-flags-4GtDtsiu.js';
|
|
6
6
|
|
|
@@ -206,6 +206,6 @@ interface MlsGlue {
|
|
|
206
206
|
*/
|
|
207
207
|
declare function initMls(): Promise<MlsGlue>;
|
|
208
208
|
|
|
209
|
-
declare const VERSION = "7.
|
|
209
|
+
declare const VERSION = "7.1.0";
|
|
210
210
|
|
|
211
211
|
export { VERSION, initMls };
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -1478,6 +1478,162 @@ function asWireAuthResult(raw) {
|
|
|
1478
1478
|
return raw;
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
1481
|
+
// src/passkey.ts
|
|
1482
|
+
function base64UrlToBytes(value) {
|
|
1483
|
+
const padded = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
1484
|
+
const binary = atob(padded.padEnd(padded.length + (4 - padded.length % 4) % 4, "="));
|
|
1485
|
+
const bytes = new Uint8Array(new ArrayBuffer(binary.length));
|
|
1486
|
+
for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
|
|
1487
|
+
return bytes;
|
|
1488
|
+
}
|
|
1489
|
+
function bytesToBase64Url(buffer) {
|
|
1490
|
+
const bytes = new Uint8Array(buffer);
|
|
1491
|
+
let binary = "";
|
|
1492
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
1493
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1494
|
+
}
|
|
1495
|
+
function requireString(source, key) {
|
|
1496
|
+
const value = source[key];
|
|
1497
|
+
if (typeof value !== "string" || value === "") {
|
|
1498
|
+
throw new Error(`passkey options are missing ${key}`);
|
|
1499
|
+
}
|
|
1500
|
+
return value;
|
|
1501
|
+
}
|
|
1502
|
+
function toCreationOptions(publicKey) {
|
|
1503
|
+
const rp = publicKey.rp;
|
|
1504
|
+
const user = publicKey.user;
|
|
1505
|
+
if (!user?.id) {
|
|
1506
|
+
throw new Error("passkey options carry no user id \u2014 the credential would be unusable");
|
|
1507
|
+
}
|
|
1508
|
+
const excludeCredentials = Array.isArray(publicKey.excludeCredentials) ? publicKey.excludeCredentials.map((c) => ({
|
|
1509
|
+
id: base64UrlToBytes(c.id),
|
|
1510
|
+
type: "public-key"
|
|
1511
|
+
})) : void 0;
|
|
1512
|
+
return {
|
|
1513
|
+
challenge: base64UrlToBytes(requireString(publicKey, "challenge")),
|
|
1514
|
+
rp: { id: rp?.id, name: rp?.name ?? rp?.id ?? "" },
|
|
1515
|
+
user: {
|
|
1516
|
+
id: base64UrlToBytes(user.id),
|
|
1517
|
+
name: user.name ?? "",
|
|
1518
|
+
displayName: user.displayName ?? user.name ?? ""
|
|
1519
|
+
},
|
|
1520
|
+
pubKeyCredParams: publicKey.pubKeyCredParams ?? [],
|
|
1521
|
+
authenticatorSelection: publicKey.authenticatorSelection,
|
|
1522
|
+
timeout: publicKey.timeout,
|
|
1523
|
+
attestation: publicKey.attestation,
|
|
1524
|
+
excludeCredentials
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
function toRequestOptions(publicKey) {
|
|
1528
|
+
const allowCredentials = Array.isArray(publicKey.allowCredentials) ? publicKey.allowCredentials.map((c) => ({
|
|
1529
|
+
id: base64UrlToBytes(c.id),
|
|
1530
|
+
type: "public-key"
|
|
1531
|
+
})) : void 0;
|
|
1532
|
+
return {
|
|
1533
|
+
challenge: base64UrlToBytes(requireString(publicKey, "challenge")),
|
|
1534
|
+
rpId: publicKey.rpId,
|
|
1535
|
+
timeout: publicKey.timeout,
|
|
1536
|
+
userVerification: publicKey.userVerification,
|
|
1537
|
+
allowCredentials
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
function attestationToJSON(credential) {
|
|
1541
|
+
const response = credential.response;
|
|
1542
|
+
return {
|
|
1543
|
+
id: credential.id,
|
|
1544
|
+
rawId: bytesToBase64Url(credential.rawId),
|
|
1545
|
+
type: credential.type,
|
|
1546
|
+
response: {
|
|
1547
|
+
clientDataJSON: bytesToBase64Url(response.clientDataJSON),
|
|
1548
|
+
attestationObject: bytesToBase64Url(response.attestationObject)
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
function assertionToJSON(credential) {
|
|
1553
|
+
const response = credential.response;
|
|
1554
|
+
return {
|
|
1555
|
+
id: credential.id,
|
|
1556
|
+
rawId: bytesToBase64Url(credential.rawId),
|
|
1557
|
+
type: credential.type,
|
|
1558
|
+
response: {
|
|
1559
|
+
clientDataJSON: bytesToBase64Url(response.clientDataJSON),
|
|
1560
|
+
authenticatorData: bytesToBase64Url(response.authenticatorData),
|
|
1561
|
+
signature: bytesToBase64Url(response.signature),
|
|
1562
|
+
// The user handle is how palauth resolves WHO signed in on a discoverable
|
|
1563
|
+
// login — there is no identifier in the request.
|
|
1564
|
+
userHandle: response.userHandle ? bytesToBase64Url(response.userHandle) : null
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
function isPasskeySupported() {
|
|
1569
|
+
return typeof window !== "undefined" && typeof window.PublicKeyCredential === "function" && typeof navigator !== "undefined" && navigator.credentials !== void 0;
|
|
1570
|
+
}
|
|
1571
|
+
function ensureSupported() {
|
|
1572
|
+
if (!isPasskeySupported()) {
|
|
1573
|
+
throw new Error("This browser cannot use passkeys \u2014 offer a password or e-mail sign-in");
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
async function createCredential(publicKey) {
|
|
1577
|
+
const credential = await navigator.credentials.create({
|
|
1578
|
+
publicKey: toCreationOptions(publicKey)
|
|
1579
|
+
});
|
|
1580
|
+
if (credential === null) {
|
|
1581
|
+
throw new Error("the browser returned no credential");
|
|
1582
|
+
}
|
|
1583
|
+
return credential;
|
|
1584
|
+
}
|
|
1585
|
+
async function getCredential(publicKey) {
|
|
1586
|
+
const credential = await navigator.credentials.get({
|
|
1587
|
+
publicKey: toRequestOptions(publicKey)
|
|
1588
|
+
});
|
|
1589
|
+
if (credential === null) {
|
|
1590
|
+
throw new Error("the browser returned no credential");
|
|
1591
|
+
}
|
|
1592
|
+
return credential;
|
|
1593
|
+
}
|
|
1594
|
+
async function passkeySignIn(rt) {
|
|
1595
|
+
ensureSupported();
|
|
1596
|
+
const envelope = await palbeRequest(rt, "POST", "/auth/webauthn/login/begin", {
|
|
1597
|
+
body: {}
|
|
1598
|
+
});
|
|
1599
|
+
const credential = await getCredential(envelope.options.publicKey);
|
|
1600
|
+
const raw = await palbeRequest(rt, "POST", "/auth/webauthn/login/finish", {
|
|
1601
|
+
body: assertionToJSON(credential)
|
|
1602
|
+
});
|
|
1603
|
+
const result = asWireAuthResult(raw);
|
|
1604
|
+
if (result === null) {
|
|
1605
|
+
throw new Error("passkey sign-in returned an unusable session");
|
|
1606
|
+
}
|
|
1607
|
+
return result;
|
|
1608
|
+
}
|
|
1609
|
+
async function passkeySignUp(rt, email, displayName) {
|
|
1610
|
+
ensureSupported();
|
|
1611
|
+
const begun = await palbeRequest(rt, "POST", "/auth/webauthn/signup/begin", {
|
|
1612
|
+
body: { email, user_name: displayName }
|
|
1613
|
+
});
|
|
1614
|
+
const credential = await createCredential(begun.options.publicKey);
|
|
1615
|
+
await palbeRequest(
|
|
1616
|
+
rt,
|
|
1617
|
+
"POST",
|
|
1618
|
+
`/auth/webauthn/signup/finish?user_id=${encodeURIComponent(begun.user_id)}`,
|
|
1619
|
+
{ body: attestationToJSON(credential) }
|
|
1620
|
+
);
|
|
1621
|
+
return await passkeySignIn(rt);
|
|
1622
|
+
}
|
|
1623
|
+
async function passkeyRegister(rt, name) {
|
|
1624
|
+
ensureSupported();
|
|
1625
|
+
const envelope = await palbeRequest(
|
|
1626
|
+
rt,
|
|
1627
|
+
"POST",
|
|
1628
|
+
"/auth/webauthn/register/begin",
|
|
1629
|
+
{ body: { name } }
|
|
1630
|
+
);
|
|
1631
|
+
const credential = await createCredential(envelope.options.publicKey);
|
|
1632
|
+
await palbeRequest(rt, "POST", "/auth/webauthn/register/finish", {
|
|
1633
|
+
body: attestationToJSON(credential)
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1481
1637
|
// src/auth-facade.ts
|
|
1482
1638
|
function mapWireUser(raw) {
|
|
1483
1639
|
return {
|
|
@@ -1832,6 +1988,39 @@ var PalbeAuth = class {
|
|
|
1832
1988
|
return this.adopt(data);
|
|
1833
1989
|
});
|
|
1834
1990
|
}
|
|
1991
|
+
/**
|
|
1992
|
+
* Sign in with a passkey stored for this Environment. No identifier is typed:
|
|
1993
|
+
* the browser lists the accounts it holds and the user picks one.
|
|
1994
|
+
*
|
|
1995
|
+
* Throws when the browser cannot run a ceremony — check `passkeysSupported`
|
|
1996
|
+
* first and keep a password or e-mail path beside the button.
|
|
1997
|
+
*/
|
|
1998
|
+
async signInWithPasskey() {
|
|
1999
|
+
return this.withSigningIn(async () => this.adoptWire(await passkeySignIn(this.rt)));
|
|
2000
|
+
}
|
|
2001
|
+
/**
|
|
2002
|
+
* Create an account whose only credential is a passkey — the e-mail is the
|
|
2003
|
+
* identifier, the passkey is the credential, and no password ever exists.
|
|
2004
|
+
*/
|
|
2005
|
+
async signUpWithPasskey(email, displayName) {
|
|
2006
|
+
return this.withSigningIn(
|
|
2007
|
+
async () => this.adoptWire(await passkeySignUp(this.rt, email, displayName))
|
|
2008
|
+
);
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Add a passkey to the signed-in account, so the next sign-in is one tap.
|
|
2012
|
+
*
|
|
2013
|
+
* Rejects with a 403 `reauthentication_required` when the session is not
|
|
2014
|
+
* recent: a passkey outlives a password reset, so enrolling one takes more
|
|
2015
|
+
* than a valid session.
|
|
2016
|
+
*/
|
|
2017
|
+
async registerPasskey(name) {
|
|
2018
|
+
await passkeyRegister(this.rt, name);
|
|
2019
|
+
}
|
|
2020
|
+
/** Whether this browser can run a passkey ceremony at all. */
|
|
2021
|
+
get passkeysSupported() {
|
|
2022
|
+
return isPasskeySupported();
|
|
2023
|
+
}
|
|
1835
2024
|
async signInWithOAuth(params) {
|
|
1836
2025
|
const { redirect = true, ...opts } = params;
|
|
1837
2026
|
const { url } = unwrap(await this.rt.authClient.getOAuthURL(opts));
|
|
@@ -9075,7 +9264,7 @@ function defaultSessionStorage(key) {
|
|
|
9075
9264
|
}
|
|
9076
9265
|
|
|
9077
9266
|
// src/version.ts
|
|
9078
|
-
var VERSION = "7.
|
|
9267
|
+
var VERSION = "7.1.0";
|
|
9079
9268
|
|
|
9080
9269
|
// src/runtime.ts
|
|
9081
9270
|
function buildRuntime(config) {
|