@tempoxyz/auth 0.0.0-pr-74.sha-e38768f → 0.0.0-pr-75.sha-31e088a

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Signs the user in with a passkey from the app's own sign-in form, and signs the app's key with the
3
- * same assertion. The browser offers every passkey it holds for Tempo's domain, so the app needs no
4
- * email first.
3
+ * same assertion. By default the browser offers every passkey it holds for Tempo's domain, so the
4
+ * app needs no email first. A non-empty `credentialId` narrows that to the passkeys it names.
5
5
  * @module
6
6
  */
7
7
  import { Authentication } from 'ox/webauthn';
@@ -42,12 +42,21 @@ export declare namespace signIn {
42
42
  * `tempo-auth:sign` scope may send one.
43
43
  */
44
44
  challenge?: string | undefined;
45
+ /**
46
+ * The credential ID, or up to 16 IDs, the browser offers. Each is unpadded base64url, as
47
+ * `PublicKeyCredential.id` reports it, of 1 to 1,023 bytes. A padded or otherwise non-canonical
48
+ * encoding throws a `RequestError` with reason `invalid_field`. Defaults to every passkey the
49
+ * browser holds for Tempo's domain, as an empty list does.
50
+ */
51
+ credentialId?: readonly string[] | string | undefined;
45
52
  /**
46
53
  * Runs the WebAuthn ceremony in place of `navigator.credentials.get`, such as a native passkey
47
54
  * module. Its assertion must report a web origin on the relying party's domain that the app
48
55
  * registered, so an Android app's facet origin is refused.
49
56
  */
50
57
  getFn?: Authentication.sign.Options['getFn'] | undefined;
58
+ /** How the browser mediates the ceremony, such as `conditional` for passkey autofill. Defaults to the browser's own mediation. */
59
+ mediation?: 'conditional' | 'optional' | 'required' | 'silent' | undefined;
51
60
  /** What the key may do. It must fit the headless ceiling, which fills what it leaves out. */
52
61
  permissions?: Permissions<chainId> | undefined;
53
62
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Signs the user in with a passkey from the app's own sign-in form, and signs the app's key with the
3
- * same assertion. The browser offers every passkey it holds for Tempo's domain, so the app needs no
4
- * email first.
3
+ * same assertion. By default the browser offers every passkey it holds for Tempo's domain, so the
4
+ * app needs no email first. A non-empty `credentialId` narrows that to the passkeys it names.
5
5
  * @module
6
6
  */
7
7
  import { Authentication } from 'ox/webauthn';
@@ -29,7 +29,7 @@ import { request } from '../internal/request.js';
29
29
  * ```
30
30
  */
31
31
  export async function signIn(auth, options = {}) {
32
- const { challenge, getFn, permissions } = options;
32
+ const { challenge, credentialId, getFn, mediation, permissions } = options;
33
33
  const key = await AccessKey.resolve(options.accessKey);
34
34
  const authorize = request(auth, {
35
35
  accessKey: key.accessKey,
@@ -40,7 +40,11 @@ export async function signIn(auth, options = {}) {
40
40
  // sends no `Origin` to bind one-tap to, so it sends the request with the assertion instead.
41
41
  const native = !/^https?:/i.test(authorize.redirect_uri);
42
42
  const requested = await Api.json(await Api.post(auth, '/v1/auth/passkey/options', {
43
- json: native ? {} : { authorize },
43
+ json: {
44
+ ...(native ? {} : { authorize }),
45
+ ...(credentialId === undefined ? {} : { credentialId }),
46
+ ...(mediation === undefined ? {} : { mediation }),
47
+ },
44
48
  }));
45
49
  const deserialized = Authentication.deserializeOptions(requested.options);
46
50
  const assertion = Authentication.serializeResponse(await Authentication.sign(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempoxyz/auth",
3
- "version": "0.0.0-pr-74.sha-e38768f",
3
+ "version": "0.0.0-pr-75.sha-31e088a",
4
4
  "description": "Signs users in to Tempo through Tempo Auth, and returns Viem access key accounts on their Tempo Accounts.",
5
5
  "type": "module",
6
6
  "exports": {