accounts 0.10.5 → 0.10.6
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# accounts
|
|
2
2
|
|
|
3
|
+
## 0.10.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e12ae75: Added `auth` option to the `webAuthn` adapter, mirroring the Provider `auth` capability shape (`string | { url, ... }`); the existing `authUrl` option is preserved as a deprecated alias.
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
- webAuthn({ authUrl: '/webauthn' })
|
|
11
|
+
+ webAuthn({ auth: '/webauthn' })
|
|
12
|
+
```
|
|
13
|
+
|
|
3
14
|
## 0.10.5
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
1
2
|
import type { OneOf } from '../../internal/types.js';
|
|
2
3
|
import * as Adapter from '../Adapter.js';
|
|
3
4
|
import * as WebAuthnCeremony from '../WebAuthnCeremony.js';
|
|
5
|
+
import * as Rpc from '../zod/rpc.js';
|
|
4
6
|
/**
|
|
5
7
|
* Creates a WebAuthn adapter backed by real passkey ceremonies.
|
|
6
8
|
*
|
|
@@ -22,7 +24,15 @@ export declare namespace webAuthn {
|
|
|
22
24
|
/** Ceremony strategy for WebAuthn registration and authentication. @default WebAuthnCeremony.local() */
|
|
23
25
|
ceremony?: WebAuthnCeremony.WebAuthnCeremony | undefined;
|
|
24
26
|
} | {
|
|
25
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Server Authentication endpoint for WebAuthn ceremonies (shorthand for
|
|
29
|
+
* `WebAuthnCeremony.server({ url })`). Accepts the same shape as the
|
|
30
|
+
* Provider `auth` capability — only the `url` field is consumed here;
|
|
31
|
+
* other fields (`challenge`, `verify`, `logout`, `returnToken`) are
|
|
32
|
+
* SIWE-only and ignored by the WebAuthn ceremony.
|
|
33
|
+
*/
|
|
34
|
+
auth?: z.input<typeof Rpc.wallet_connect.auth> | undefined;
|
|
35
|
+
/** @deprecated Use `auth` instead. */
|
|
26
36
|
authUrl?: string | undefined;
|
|
27
37
|
}> & {
|
|
28
38
|
/** Data URI of the provider icon. @default Black 1×1 SVG. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webAuthn.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/webAuthn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webAuthn.d.ts","sourceRoot":"","sources":["../../../src/core/adapters/webAuthn.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AAGpC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,QAAQ,CAAC,OAAY,GAAG,OAAO,CAAC,OAAO,CA6FxE;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,KAAK,OAAO,GAAG,KAAK,CAChB;QACE,wGAAwG;QACxG,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,GAAG,SAAS,CAAA;KACzD,GACD;QACE;;;;;;WAMG;QACH,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;QAC1D,sCAAsC;QACtC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAC7B,CACJ,GAAG;QACF,6DAA6D;QAC7D,IAAI,CAAC,EAAE,cAAc,MAAM,EAAE,GAAG,SAAS,CAAA;QACzC,oFAAoF;QACpF,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QACzB,8DAA8D;QAC9D,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAC1B,CAAA;CACF"}
|
|
@@ -4,6 +4,7 @@ import { Account } from 'viem/tempo';
|
|
|
4
4
|
import { Authentication, Registration } from 'webauthx/client';
|
|
5
5
|
import * as Adapter from '../Adapter.js';
|
|
6
6
|
import * as WebAuthnCeremony from '../WebAuthnCeremony.js';
|
|
7
|
+
import * as Rpc from '../zod/rpc.js';
|
|
7
8
|
import { local } from './local.js';
|
|
8
9
|
/**
|
|
9
10
|
* Creates a WebAuthn adapter backed by real passkey ceremonies.
|
|
@@ -21,11 +22,16 @@ import { local } from './local.js';
|
|
|
21
22
|
* ```
|
|
22
23
|
*/
|
|
23
24
|
export function webAuthn(options = {}) {
|
|
24
|
-
const { authUrl, icon, name, rdns } = options;
|
|
25
|
+
const { auth, authUrl, icon, name, rdns } = options;
|
|
26
|
+
const url = (() => {
|
|
27
|
+
if (auth)
|
|
28
|
+
return typeof auth === 'string' ? auth : auth.url;
|
|
29
|
+
return authUrl;
|
|
30
|
+
})();
|
|
25
31
|
return Adapter.define({ icon, name, rdns }, (parameters) => {
|
|
26
32
|
const { storage } = parameters;
|
|
27
33
|
const ceremony = options.ceremony ??
|
|
28
|
-
(
|
|
34
|
+
(url ? WebAuthnCeremony.server({ url }) : WebAuthnCeremony.local({ storage }));
|
|
29
35
|
const base = local({
|
|
30
36
|
async createAccount(parameters) {
|
|
31
37
|
const { options } = await ceremony.getRegistrationOptions(parameters);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webAuthn.js","sourceRoot":"","sources":["../../../src/core/adapters/webAuthn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EA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,KAAK,EAAE,IAAI,EAAE,CAChB;oBACH,CAAC,CAAC,SAAS,CAAA;gBAEb,OAAO;oBACL,QAAQ,EAAE;wBACR;4BACE,OAAO,EAAE,OAAO,CAAC,OAAO;4BACxB,OAAO,EAAE,UAAU;4BACnB,UAAU,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;yBACjD;qBACF;oBACD,KAAK;oBACL,SAAS;oBACT,QAAQ;iBACT,CAAA;YACH,CAAC;SACF,CAAC,CAAC,UAAU,CAAC,CAAA;QAEd,OAAO,EAAE,GAAG,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,10 +2,12 @@ import { PublicKey, Signature } from 'ox'
|
|
|
2
2
|
import { SignatureEnvelope } from 'ox/tempo'
|
|
3
3
|
import { Account } from 'viem/tempo'
|
|
4
4
|
import { Authentication, Registration } from 'webauthx/client'
|
|
5
|
+
import type { z } from 'zod'
|
|
5
6
|
|
|
6
7
|
import type { OneOf } from '../../internal/types.js'
|
|
7
8
|
import * as Adapter from '../Adapter.js'
|
|
8
9
|
import * as WebAuthnCeremony from '../WebAuthnCeremony.js'
|
|
10
|
+
import * as Rpc from '../zod/rpc.js'
|
|
9
11
|
import { local } from './local.js'
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -24,14 +26,19 @@ import { local } from './local.js'
|
|
|
24
26
|
* ```
|
|
25
27
|
*/
|
|
26
28
|
export function webAuthn(options: webAuthn.Options = {}): Adapter.Adapter {
|
|
27
|
-
const { authUrl, icon, name, rdns } = options
|
|
29
|
+
const { auth, authUrl, icon, name, rdns } = options
|
|
30
|
+
|
|
31
|
+
const url = (() => {
|
|
32
|
+
if (auth) return typeof auth === 'string' ? auth : auth.url
|
|
33
|
+
return authUrl
|
|
34
|
+
})()
|
|
28
35
|
|
|
29
36
|
return Adapter.define({ icon, name, rdns }, (parameters) => {
|
|
30
37
|
const { storage } = parameters
|
|
31
38
|
|
|
32
39
|
const ceremony =
|
|
33
40
|
options.ceremony ??
|
|
34
|
-
(
|
|
41
|
+
(url ? WebAuthnCeremony.server({ url }) : WebAuthnCeremony.local({ storage }))
|
|
35
42
|
|
|
36
43
|
const base = local({
|
|
37
44
|
async createAccount(parameters) {
|
|
@@ -120,7 +127,15 @@ export declare namespace webAuthn {
|
|
|
120
127
|
ceremony?: WebAuthnCeremony.WebAuthnCeremony | undefined
|
|
121
128
|
}
|
|
122
129
|
| {
|
|
123
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Server Authentication endpoint for WebAuthn ceremonies (shorthand for
|
|
132
|
+
* `WebAuthnCeremony.server({ url })`). Accepts the same shape as the
|
|
133
|
+
* Provider `auth` capability — only the `url` field is consumed here;
|
|
134
|
+
* other fields (`challenge`, `verify`, `logout`, `returnToken`) are
|
|
135
|
+
* SIWE-only and ignored by the WebAuthn ceremony.
|
|
136
|
+
*/
|
|
137
|
+
auth?: z.input<typeof Rpc.wallet_connect.auth> | undefined
|
|
138
|
+
/** @deprecated Use `auth` instead. */
|
|
124
139
|
authUrl?: string | undefined
|
|
125
140
|
}
|
|
126
141
|
> & {
|