@tempoxyz/id 0.0.0-pr-670.sha-e3d58d0 → 0.0.0-pr-795.sha-bc173b5

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.
@@ -2,7 +2,7 @@ import {
2
2
  bind,
3
3
  from,
4
4
  passkey_exports
5
- } from "./chunk-2C3S5GFN.js";
5
+ } from "./chunk-BG5R7DWZ.js";
6
6
  import {
7
7
  dialog_exports,
8
8
  redirect_exports
@@ -420,7 +420,7 @@ async function signIn2(auth2, options) {
420
420
  }
421
421
  })();
422
422
  if (body.passkey_account && body.registration && prepared.key && options.accessKey) {
423
- const { register } = await import("./passkey-KDXU23B5.js");
423
+ const { register } = await import("./passkey-YRMARUDY.js");
424
424
  const registered = await register(auth2, {
425
425
  accessKey: { ...options.accessKey, account: prepared.key.accessKey },
426
426
  challenge: options.challenge,
@@ -28,7 +28,7 @@ __export(passkey_exports, {
28
28
  register: () => register,
29
29
  signIn: () => signIn
30
30
  });
31
- import { Address as Address2 } from "ox";
31
+ import { Address } from "ox";
32
32
  import {
33
33
  Authentication,
34
34
  Credential,
@@ -36,14 +36,10 @@ import {
36
36
  } from "ox/webauthn";
37
37
 
38
38
  // ../../accounts/src/internal/Registration.ts
39
- import { Address } from "ox";
40
- import { AccountConfig, KeyAuthorization } from "ox/tempo";
41
- import { Account } from "viem/tempo";
42
39
  var lifetime = 4 * 60 * 1e3;
43
40
  function from(value, options) {
44
41
  return {
45
42
  expiresAt: options.requestedAt + lifetime,
46
- ...value.keyAuthorization ? { keyAuthorization: value.keyAuthorization } : {},
47
43
  options: value.options,
48
44
  ...value.proof ? { proof: value.proof } : {}
49
45
  };
@@ -55,19 +51,6 @@ function send(registration) {
55
51
  function bind(registration) {
56
52
  return { ...registration, keyed: true };
57
53
  }
58
- function challenge(keyAuthorization, options) {
59
- const account = Account.fromConfig({
60
- owners: [Address.fromPublicKey(options.publicKey)]
61
- });
62
- return AccountConfig.getSignPayload({
63
- account: account.address,
64
- config: account.config,
65
- payload: KeyAuthorization.getSignPayload({
66
- ...KeyAuthorization.deserialize(keyAuthorization),
67
- account: account.address
68
- })
69
- });
70
- }
71
54
  function bound(registration) {
72
55
  return registration.keyed === true;
73
56
  }
@@ -162,16 +145,16 @@ async function register(auth, options = {}) {
162
145
  status: 0
163
146
  });
164
147
  const deserialized = Registration.deserializeOptions(prepared.options);
165
- const passkey = await Registration.create(
166
- // ox reads `createFn` beside creation options at runtime, which its types admit only beside flat options.
167
- createFn ? { ...deserialized, createFn } : deserialized
148
+ const credential = Credential.serialize(
149
+ await Registration.create(
150
+ // ox reads `createFn` beside creation options at runtime, which its types admit only beside flat options.
151
+ createFn ? { ...deserialized, createFn } : deserialized
152
+ )
168
153
  );
169
- const credential = Credential.serialize(passkey);
170
154
  const created = {
171
155
  credentialId: credential.id,
172
156
  rpId: prepared.options.publicKey.rp.id
173
157
  };
174
- const single = Boolean(prepared.proof ?? prepared.keyAuthorization);
175
158
  const assertion = await (async () => {
176
159
  try {
177
160
  const proof = await (async () => {
@@ -182,16 +165,6 @@ async function register(auth, options = {}) {
182
165
  allowCredentials: [{ id: credential.id, type: "public-key" }]
183
166
  }
184
167
  });
185
- if (prepared.keyAuthorization)
186
- return Authentication.getOptions({
187
- challenge: challenge(
188
- prepared.keyAuthorization,
189
- { publicKey: passkey.publicKey }
190
- ),
191
- credentialId: credential.id,
192
- rpId: created.rpId,
193
- userVerification: "required"
194
- });
195
168
  send(prepared);
196
169
  const { step } = await json(
197
170
  await post(
@@ -215,7 +188,7 @@ async function register(auth, options = {}) {
215
188
  throw error;
216
189
  }
217
190
  })();
218
- if (single) send(prepared);
191
+ if (prepared.proof) send(prepared);
219
192
  const response = await post(
220
193
  answered(auth, {
221
194
  message: "The registration received no response, and the passkey can be registered. Check the connection, then sign in with the passkey or register it again."
@@ -228,7 +201,7 @@ async function register(auth, options = {}) {
228
201
  ...options.account ? { account: options.account } : {},
229
202
  assertion,
230
203
  ...chain !== void 0 ? { chain } : {},
231
- ...single ? { credential } : {},
204
+ ...prepared.proof ? { credential } : {},
232
205
  ...key ? { accessKey: { account: key.account, chainId: key.chainId } } : {}
233
206
  }
234
207
  }
@@ -237,7 +210,7 @@ async function register(auth, options = {}) {
237
210
  try {
238
211
  return await json(response);
239
212
  } catch (error) {
240
- const dropped = single ? response.headers.get(storedHeader) !== "true" && error instanceof RequestError && error.reason !== void 0 : refused(error);
213
+ const dropped = prepared.proof ? response.headers.get(storedHeader) !== "true" && error instanceof RequestError && error.reason !== void 0 : refused(error);
241
214
  if (dropped) forget(created);
242
215
  throw error;
243
216
  }
@@ -245,7 +218,7 @@ async function register(auth, options = {}) {
245
218
  const result = { address: registered.address, id: registered.id };
246
219
  if (!headless) return result;
247
220
  const signed = registered.authorization;
248
- if (!signed?.account || !Address2.isEqual(signed.account, registered.address))
221
+ if (!signed?.account || !Address.isEqual(signed.account, registered.address))
249
222
  throw new RequestError({
250
223
  code: "server_error",
251
224
  message: signed ? "Account mismatch: Tempo ID signed the access key for another account than the new passkey. The passkey is registered, so sign in with it." : `Unsupported option: Tempo ID at ${auth.url} predates \`accessKey\` on passkey registration. The passkey is registered, so sign in with it, or update Tempo ID.`,
@@ -255,7 +228,7 @@ async function register(auth, options = {}) {
255
228
  signed,
256
229
  headless.key
257
230
  );
258
- const challenged = options.challenge === void 0 || authorization2.challengeSignature ? {} : await challenge2(
231
+ const challenged = options.challenge === void 0 || authorization2.challengeSignature ? {} : await challenge(
259
232
  { ...auth, chainId: Number(authorization2.key.chainId) },
260
233
  {
261
234
  account: registered.address,
@@ -274,7 +247,7 @@ async function register(auth, options = {}) {
274
247
  ..."challengeError" in challenged ? { challengeError: challenged.challengeError } : {}
275
248
  };
276
249
  }
277
- async function challenge2(auth, options) {
250
+ async function challenge(auth, options) {
278
251
  try {
279
252
  const body = await json(
280
253
  await post2(auth, {
@@ -291,7 +264,7 @@ async function challenge2(auth, options) {
291
264
  () => void 0
292
265
  );
293
266
  const signed = challengeSignature(body, { challenged: true });
294
- if (user(tokens2).id !== options.userId || !Address2.isEqual(signed.address, options.account))
267
+ if (user(tokens2).id !== options.userId || !Address.isEqual(signed.address, options.account))
295
268
  throw new RequestError({
296
269
  code: "server_error",
297
270
  message: "Account mismatch: Tempo ID signed the challenge as another account or user than the new passkey's. The passkey is registered, so sign in with it and the challenge.",
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  env,
3
3
  login
4
- } from "../chunk-63YGOACN.js";
5
- import "../chunk-2C3S5GFN.js";
4
+ } from "../chunk-B5QLHT6G.js";
5
+ import "../chunk-BG5R7DWZ.js";
6
6
  import "../chunk-5BMEYTWL.js";
7
7
  import "../chunk-HET3PM5A.js";
8
8
  import "../chunk-76XNJYCT.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  env,
3
3
  remove
4
- } from "../chunk-63YGOACN.js";
5
- import "../chunk-2C3S5GFN.js";
4
+ } from "../chunk-B5QLHT6G.js";
5
+ import "../chunk-BG5R7DWZ.js";
6
6
  import "../chunk-5BMEYTWL.js";
7
7
  import "../chunk-HET3PM5A.js";
8
8
  import "../chunk-76XNJYCT.js";
@@ -2,8 +2,8 @@ import {
2
2
  env,
3
3
  signedOut,
4
4
  whoami
5
- } from "../chunk-63YGOACN.js";
6
- import "../chunk-2C3S5GFN.js";
5
+ } from "../chunk-B5QLHT6G.js";
6
+ import "../chunk-BG5R7DWZ.js";
7
7
  import "../chunk-5BMEYTWL.js";
8
8
  import "../chunk-HET3PM5A.js";
9
9
  import "../chunk-76XNJYCT.js";
@@ -3,7 +3,7 @@ import {
3
3
  prepare,
4
4
  register,
5
5
  signIn
6
- } from "./chunk-2C3S5GFN.js";
6
+ } from "./chunk-BG5R7DWZ.js";
7
7
  import "./chunk-LFCZMBVQ.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
  export {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=24.21"
10
10
  },
11
11
  "name": "@tempoxyz/id",
12
- "version": "0.0.0-pr-670.sha-e3d58d0",
12
+ "version": "0.0.0-pr-795.sha-bc173b5",
13
13
  "description": "The tempo-id CLI: sign in to Tempo ID, and call its API and the Admin API.",
14
14
  "type": "module",
15
15
  "bin": {