@tempoxyz/id 0.0.0-pr-479.sha-3ea98d2 → 0.0.0-pr-481.sha-e1aaa69
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/README.md +0 -2
- package/dist/Actions.d.ts +13 -13
- package/dist/Actions.js +9 -9
- package/dist/Actions.js.map +1 -1
- package/dist/Authorization.d.ts +1 -1
- package/dist/Authorization.d.ts.map +1 -1
- package/dist/Id.d.ts +10 -10
- package/dist/Id.d.ts.map +1 -1
- package/dist/Id.js +3 -3
- package/dist/Id.js.map +1 -1
- package/dist/Key.d.ts +8 -8
- package/dist/Key.d.ts.map +1 -1
- package/dist/Key.js +5 -5
- package/dist/Key.js.map +1 -1
- package/dist/Pending.d.ts +2 -2
- package/dist/Pending.d.ts.map +1 -1
- package/dist/Permissions.d.ts +7 -7
- package/dist/Permissions.d.ts.map +1 -1
- package/dist/Plugin.d.ts +1 -1
- package/dist/Plugin.d.ts.map +1 -1
- package/dist/Session.d.ts +1 -1
- package/dist/Session.js +1 -1
- package/dist/actions/account.d.ts +14 -14
- package/dist/actions/account.d.ts.map +1 -1
- package/dist/actions/account.js +6 -6
- package/dist/actions/account.js.map +1 -1
- package/dist/actions/backend/email.d.ts +4 -4
- package/dist/actions/backend/email.js +4 -4
- package/dist/actions/backend/email.js.map +1 -1
- package/dist/actions/device.d.ts +3 -3
- package/dist/actions/device.js +2 -2
- package/dist/actions/device.js.map +1 -1
- package/dist/actions/dialog.d.ts +5 -5
- package/dist/actions/dialog.d.ts.map +1 -1
- package/dist/actions/dialog.js +3 -3
- package/dist/actions/email.d.ts +12 -12
- package/dist/actions/email.d.ts.map +1 -1
- package/dist/actions/email.js +10 -10
- package/dist/actions/email.js.map +1 -1
- package/dist/actions/passkey.d.ts +18 -18
- package/dist/actions/passkey.d.ts.map +1 -1
- package/dist/actions/passkey.js +13 -13
- package/dist/actions/passkey.js.map +1 -1
- package/dist/actions/redirect.d.ts +10 -10
- package/dist/actions/redirect.d.ts.map +1 -1
- package/dist/actions/redirect.js +5 -5
- package/dist/actions/redirect.js.map +1 -1
- package/dist/internal/accessKey.d.ts +6 -6
- package/dist/internal/accessKey.d.ts.map +1 -1
- package/dist/internal/accessKey.js +4 -4
- package/dist/internal/api.d.ts +7 -7
- package/dist/internal/api.d.ts.map +1 -1
- package/dist/internal/api.js +5 -5
- package/dist/internal/api.js.map +1 -1
- package/dist/internal/backendSessions.d.ts +1 -1
- package/dist/internal/backendSessions.js +2 -2
- package/dist/internal/backendSessions.js.map +1 -1
- package/dist/internal/core.d.ts +4 -4
- package/dist/internal/core.d.ts.map +1 -1
- package/dist/internal/core.js +5 -5
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/headless.d.ts +15 -15
- package/dist/internal/headless.d.ts.map +1 -1
- package/dist/internal/headless.js +7 -7
- package/dist/internal/headless.js.map +1 -1
- package/dist/internal/request.d.ts +8 -8
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +4 -4
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/session.d.ts +1 -1
- package/dist/internal/session.js +2 -2
- package/dist/internal/session.js.map +1 -1
- package/dist/internal/signIn.d.ts +4 -4
- package/dist/internal/signIn.d.ts.map +1 -1
- package/dist/internal/signIn.js +2 -2
- package/dist/internal/signIn.js.map +1 -1
- package/dist/internal/signer.d.ts +1 -1
- package/dist/internal/signer.js +2 -2
- package/dist/internal/signer.js.map +1 -1
- package/dist/internal/verifier.d.ts +2 -2
- package/dist/internal/verifier.d.ts.map +1 -1
- package/dist/internal/viem/accessKey.d.ts +5 -5
- package/dist/internal/viem/accessKey.d.ts.map +1 -1
- package/dist/internal/viem/accessKey.js +7 -7
- package/dist/internal/viem/accessKey.js.map +1 -1
- package/dist/plugins/backend.d.ts +1 -1
- package/dist/plugins/device.d.ts +3 -3
- package/dist/plugins/device.js +1 -1
- package/dist/plugins/dialog.d.ts +1 -1
- package/dist/plugins/email.d.ts +4 -4
- package/dist/plugins/email.js +1 -1
- package/dist/plugins/passkey.d.ts +3 -3
- package/dist/plugins/passkey.js +1 -1
- package/dist/plugins/passkey.js.map +1 -1
- package/dist/plugins/redirect.d.ts +1 -1
- package/dist/plugins/viem.d.ts +1 -1
- package/dist/plugins/viem.js +1 -1
- package/dist/plugins/viem.js.map +1 -1
- package/dist/wagmi.d.ts +3 -3
- package/dist/wagmi.js +6 -6
- package/dist/wagmi.js.map +1 -1
- package/package.json +2 -2
- package/src/Actions.ts +16 -16
- package/src/Authorization.ts +1 -1
- package/src/Id.ts +10 -10
- package/src/Key.ts +9 -9
- package/src/Pending.ts +2 -2
- package/src/Permissions.ts +7 -7
- package/src/Plugin.ts +1 -1
- package/src/Session.ts +1 -1
- package/src/actions/account.ts +15 -15
- package/src/actions/backend/email.ts +6 -6
- package/src/actions/device.ts +4 -4
- package/src/actions/dialog.ts +5 -5
- package/src/actions/email.ts +16 -16
- package/src/actions/passkey.ts +24 -24
- package/src/actions/redirect.ts +14 -14
- package/src/internal/accessKey.ts +6 -6
- package/src/internal/api.ts +9 -9
- package/src/internal/backendSessions.ts +4 -4
- package/src/internal/core.ts +7 -7
- package/src/internal/headless.ts +18 -18
- package/src/internal/request.ts +11 -11
- package/src/internal/session.ts +3 -3
- package/src/internal/signIn.ts +4 -4
- package/src/internal/signer.ts +2 -2
- package/src/internal/verifier.ts +2 -2
- package/src/internal/viem/accessKey.ts +8 -8
- package/src/plugins/backend.ts +1 -1
- package/src/plugins/device.ts +3 -3
- package/src/plugins/dialog.ts +1 -1
- package/src/plugins/email.ts +4 -4
- package/src/plugins/passkey.ts +4 -4
- package/src/plugins/redirect.ts +1 -1
- package/src/plugins/viem.ts +2 -2
- package/src/wagmi.ts +7 -7
package/src/internal/headless.ts
CHANGED
|
@@ -12,19 +12,19 @@ import * as AccessKey from './accessKey.js'
|
|
|
12
12
|
import * as Api from './api.js'
|
|
13
13
|
import { request } from './request.js'
|
|
14
14
|
|
|
15
|
-
/** A headless authorization, without its key for a sign-in without `permissions`, and whether its account can upgrade. */
|
|
15
|
+
/** A headless authorization, without its access key for a sign-in without `permissions`, and whether its account can upgrade. */
|
|
16
16
|
export type Result = (Authorization | Api.WithoutKey) & {
|
|
17
17
|
/**
|
|
18
|
-
* Whether the key's account is a wallet.tempo passkey's that waits for its upgrade on the key's
|
|
19
|
-
* chain. The key signed as the passkey's own account, and `Actions.account.upgrade` with it
|
|
20
|
-
* registers the key and upgrades the account.
|
|
18
|
+
* Whether the access key's account is a wallet.tempo passkey's that waits for its upgrade on the access key's
|
|
19
|
+
* chain. The access key signed as the passkey's own account, and `Actions.account.upgrade` with it
|
|
20
|
+
* registers the access key and upgrades the account.
|
|
21
21
|
*/
|
|
22
22
|
upgradeAvailable: boolean
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Sends `POST /v1/account`, which creates the user's first Tempo Account, then
|
|
27
|
-
* `POST /v1/authorize`. A sign-in without
|
|
27
|
+
* `POST /v1/authorize`. A sign-in without an access key skips the account. Each refusal is marked
|
|
28
28
|
* `signedIn`. An authorization for a user other than `userId` throws `session_changed`.
|
|
29
29
|
*/
|
|
30
30
|
export async function authorize(
|
|
@@ -32,9 +32,9 @@ export async function authorize(
|
|
|
32
32
|
options: authorize.Options,
|
|
33
33
|
): Promise<Result> {
|
|
34
34
|
const { challenge, getFn, permissions } = options
|
|
35
|
-
// The user is signed in already, so every failure from here on, key generation included, is marked.
|
|
35
|
+
// The user is signed in already, so every failure from here on, access key generation included, is marked.
|
|
36
36
|
try {
|
|
37
|
-
// Permissions request the key.
|
|
37
|
+
// Permissions request the access key.
|
|
38
38
|
const key = permissions
|
|
39
39
|
? await AccessKey.resolve(options.accessKey)
|
|
40
40
|
: undefined
|
|
@@ -69,13 +69,13 @@ export async function authorize(
|
|
|
69
69
|
|
|
70
70
|
export declare namespace authorize {
|
|
71
71
|
type Options = {
|
|
72
|
-
/** The key to authorize. Defaults to a new key. */
|
|
72
|
+
/** The access key to authorize. Defaults to a new access key. */
|
|
73
73
|
accessKey?: Account.Account | undefined
|
|
74
|
-
/** A message that the key's witness binds. */
|
|
74
|
+
/** A message that the access key's witness binds. */
|
|
75
75
|
challenge?: string | undefined
|
|
76
76
|
/** Runs the ceremony of the passkey that owns the account. Defaults to `navigator.credentials.get`. */
|
|
77
77
|
getFn?: Authentication.sign.Options['getFn'] | undefined
|
|
78
|
-
/** What the key may do, which requests the key. Without it, the sign-in authorizes no key. */
|
|
78
|
+
/** What the access key may do, which requests the access key. Without it, the sign-in authorizes no access key. */
|
|
79
79
|
permissions?: Permissions | undefined
|
|
80
80
|
/** The user that the sign-in verified. */
|
|
81
81
|
userId: string
|
|
@@ -92,7 +92,7 @@ export async function complete(
|
|
|
92
92
|
): Promise<Result> {
|
|
93
93
|
const { body, key } = options
|
|
94
94
|
if (!body.authorization)
|
|
95
|
-
// The request's own `accessKey`, so
|
|
95
|
+
// The request's own `accessKey`, so an access key that the library generates keeps its material.
|
|
96
96
|
return await authorize(auth, { ...options.request, userId: body.user.id })
|
|
97
97
|
try {
|
|
98
98
|
const signed =
|
|
@@ -132,7 +132,7 @@ export declare namespace complete {
|
|
|
132
132
|
/** The signed-in user. */
|
|
133
133
|
user: { id: string }
|
|
134
134
|
}
|
|
135
|
-
/** The key that the request authorized, or `undefined` without one. */
|
|
135
|
+
/** The access key that the request authorized, or `undefined` without one. */
|
|
136
136
|
key: AccessKey.resolve.ReturnType | undefined
|
|
137
137
|
/** The sign-in's options, for a server that returns no authorization. */
|
|
138
138
|
request: prepare.Options
|
|
@@ -140,7 +140,7 @@ export declare namespace complete {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
* Returns the key, or none without `permissions`, and the authorization request that a sign-in sends:
|
|
143
|
+
* Returns the access key, or none without `permissions`, and the authorization request that a sign-in sends:
|
|
144
144
|
* an emailed-code sign-in with its code, and a passkey sign-in with its options.
|
|
145
145
|
*/
|
|
146
146
|
export async function prepare(auth: Config, options: prepare.Options) {
|
|
@@ -176,7 +176,7 @@ export async function read<value>(response: Response): Promise<value> {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
* Sends `POST /v1/authorize` with `json`. For a request with
|
|
179
|
+
* Sends `POST /v1/authorize` with `json`. For a request with an access key, on a page that runs passkey
|
|
180
180
|
* ceremonies, it requests the passkey step, signs it with {@link sign}, and returns the repeated
|
|
181
181
|
* request's response. Otherwise it returns the response of the one request.
|
|
182
182
|
*/
|
|
@@ -211,7 +211,7 @@ export declare namespace post {
|
|
|
211
211
|
getFn?: Authentication.sign.Options['getFn'] | undefined
|
|
212
212
|
/** The authorization request. */
|
|
213
213
|
json: ReturnType<typeof request>
|
|
214
|
-
/** Whether a passkey-owned account signs the key on the page. Defaults to `true`. */
|
|
214
|
+
/** Whether a passkey-owned account signs the access key on the page. Defaults to `true`. */
|
|
215
215
|
passkey?: boolean | undefined
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -269,7 +269,7 @@ export declare namespace sign {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* Returns whether a request asks for the passkey step: it carries
|
|
272
|
+
* Returns whether a request asks for the passkey step: it carries an access key, and the page runs passkey
|
|
273
273
|
* ceremonies, through `getFn` or `navigator.credentials`.
|
|
274
274
|
*/
|
|
275
275
|
export function steps(
|
|
@@ -285,11 +285,11 @@ export function steps(
|
|
|
285
285
|
|
|
286
286
|
/** The passkey step of a headless authorization, which the page signs before it repeats the request. */
|
|
287
287
|
export type Step = {
|
|
288
|
-
/** The key's expiry in Unix seconds, which the repeated request sends. */
|
|
288
|
+
/** The access key's expiry in Unix seconds, which the repeated request sends. */
|
|
289
289
|
expiry: number
|
|
290
290
|
/** The step. */
|
|
291
291
|
step: {
|
|
292
|
-
/** The options for `navigator.credentials.get()`, whose challenge is the key's digest. */
|
|
292
|
+
/** The options for `navigator.credentials.get()`, whose challenge is the access key's digest. */
|
|
293
293
|
options: Types.CredentialRequestOptions<true>
|
|
294
294
|
/** The kind of step. */
|
|
295
295
|
type: 'passkey'
|
package/src/internal/request.ts
CHANGED
|
@@ -29,7 +29,7 @@ export async function authorizeUrl(
|
|
|
29
29
|
throw new ChallengeWithoutKeyError()
|
|
30
30
|
const redirectUri =
|
|
31
31
|
options.redirectUri ?? auth.redirectUri ?? `${window.location.origin}/`
|
|
32
|
-
// Permissions request the key.
|
|
32
|
+
// Permissions request the access key.
|
|
33
33
|
const key = permissions
|
|
34
34
|
? await AccessKey.resolve(options.accessKey)
|
|
35
35
|
: undefined
|
|
@@ -89,7 +89,7 @@ export async function authorizeUrl(
|
|
|
89
89
|
|
|
90
90
|
export declare namespace authorizeUrl {
|
|
91
91
|
type Options = {
|
|
92
|
-
/** The key to authorize. Defaults to a new key, whose material `pending` keeps. */
|
|
92
|
+
/** The access key to authorize. Defaults to a new access key, whose material `pending` keeps. */
|
|
93
93
|
accessKey?: Account.Account | undefined
|
|
94
94
|
/** A message whose EIP-191 hash the key authorization binds as its `witness`. */
|
|
95
95
|
challenge?: string | undefined
|
|
@@ -123,11 +123,11 @@ export declare namespace authorizeUrl {
|
|
|
123
123
|
export function request(
|
|
124
124
|
auth: Config,
|
|
125
125
|
options: {
|
|
126
|
-
/** The key to authorize, if any. */
|
|
126
|
+
/** The access key to authorize, if any. */
|
|
127
127
|
accessKey?: Account.Account | undefined
|
|
128
|
-
/** The Tempo Account the key acts for, in place of the one `accessKey` names. */
|
|
128
|
+
/** The Tempo Account the access key acts for, in place of the one `accessKey` names. */
|
|
129
129
|
account?: `0x${string}` | undefined
|
|
130
|
-
/** A message that the key's witness binds. */
|
|
130
|
+
/** A message that the access key's witness binds. */
|
|
131
131
|
challenge?: string | undefined
|
|
132
132
|
permissions?: Permissions | undefined
|
|
133
133
|
},
|
|
@@ -148,24 +148,24 @@ export function request(
|
|
|
148
148
|
redirect_uri:
|
|
149
149
|
auth.redirectUri ?? `${globalThis.location?.origin ?? auth.url}/`,
|
|
150
150
|
scope: auth.scope,
|
|
151
|
-
//
|
|
152
|
-
// own account, and the sign-in then registers the key and upgrades the account.
|
|
151
|
+
// An access key of a wallet.tempo passkey's account that waits for its upgrade signs as the passkey's
|
|
152
|
+
// own account, and the sign-in then registers the access key and upgrades the account.
|
|
153
153
|
...(accessKey ? { skip_upgrade: true } : {}),
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* Returns the key authorization request. An access key account names its Tempo Account, and a plain
|
|
159
|
-
* key leaves the choice to Tempo ID.
|
|
159
|
+
* access key leaves the choice to Tempo ID.
|
|
160
160
|
*/
|
|
161
161
|
export function keyAuthorization(
|
|
162
162
|
auth: Config,
|
|
163
163
|
options: {
|
|
164
|
-
/** The key to authorize. */
|
|
164
|
+
/** The access key to authorize. */
|
|
165
165
|
accessKey: Account.Account
|
|
166
|
-
/** The Tempo Account the key acts for, in place of the one `accessKey` names. */
|
|
166
|
+
/** The Tempo Account the access key acts for, in place of the one `accessKey` names. */
|
|
167
167
|
account?: `0x${string}` | undefined
|
|
168
|
-
/** What the key may do. */
|
|
168
|
+
/** What the access key may do. */
|
|
169
169
|
permissions: Permissions
|
|
170
170
|
},
|
|
171
171
|
) {
|
package/src/internal/session.ts
CHANGED
|
@@ -243,7 +243,7 @@ export function create(options: create.Options): create.ReturnType {
|
|
|
243
243
|
error?: unknown,
|
|
244
244
|
failure: FailOptions = {},
|
|
245
245
|
) => {
|
|
246
|
-
// An update that sent no refresh token, such as the account of a session without
|
|
246
|
+
// An update that sent no refresh token, such as the account of a session without an access key,
|
|
247
247
|
// holds the tokens that the sign-out ended already.
|
|
248
248
|
if (options.update && !options.sent) return new SupersededError()
|
|
249
249
|
// A refresh that a sign-out overtook rotated the token that the sign-out holds, so the
|
|
@@ -388,7 +388,7 @@ export function create(options: create.Options): create.ReturnType {
|
|
|
388
388
|
const ending = newer(before, local) ? before : local
|
|
389
389
|
// Another context's refresh can save the session's later tokens after the sign-out. Those
|
|
390
390
|
// tokens end in place of the rotated ones. A refresh keeps the session's access key, so a
|
|
391
|
-
// stored copy with another key is a later sign-in, such as another tab's, which stays. Any
|
|
391
|
+
// stored copy with another access key is a later sign-in, such as another tab's, which stays. Any
|
|
392
392
|
// other stored copy, such as this instance's earlier one, is not the session's latest.
|
|
393
393
|
const after =
|
|
394
394
|
stored &&
|
|
@@ -497,7 +497,7 @@ export declare namespace create {
|
|
|
497
497
|
/** Returns the session, without reading the store. */
|
|
498
498
|
get: () => Session.Session | undefined
|
|
499
499
|
/**
|
|
500
|
-
* Reads the saved session once, and returns the session. Empties a session whose key expired.
|
|
500
|
+
* Reads the saved session once, and returns the session. Empties a session whose access key expired.
|
|
501
501
|
*/
|
|
502
502
|
load: () => Promise<Session.Session | undefined>
|
|
503
503
|
/**
|
package/src/internal/signIn.ts
CHANGED
|
@@ -13,8 +13,8 @@ import type { User } from '../User.js'
|
|
|
13
13
|
import * as Api from './api.js'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* The `permissions` of a sign-in: the key's permissions, a function that returns them, or `false`
|
|
17
|
-
* for a sign-in without
|
|
16
|
+
* The `permissions` of a sign-in: the access key's permissions, a function that returns them, or `false`
|
|
17
|
+
* for a sign-in without an access key. Absent, the instance's `permissions` apply.
|
|
18
18
|
*/
|
|
19
19
|
export type PermissionsOption =
|
|
20
20
|
| Permissions
|
|
@@ -22,7 +22,7 @@ export type PermissionsOption =
|
|
|
22
22
|
| false
|
|
23
23
|
| undefined
|
|
24
24
|
|
|
25
|
-
/** Returns the permissions of a sign-in, or `undefined` for a sign-in without
|
|
25
|
+
/** Returns the permissions of a sign-in, or `undefined` for a sign-in without an access key. */
|
|
26
26
|
export function permissions(
|
|
27
27
|
context: Plugin.Context,
|
|
28
28
|
value: PermissionsOption,
|
|
@@ -33,7 +33,7 @@ export function permissions(
|
|
|
33
33
|
return context.permissions()
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/** Returns the session of a sign-in's result: its tokens, its user, its key, and its account. */
|
|
36
|
+
/** Returns the session of a sign-in's result: its tokens, its user, its access key, and its account. */
|
|
37
37
|
export function toSession(
|
|
38
38
|
result: Tokens & {
|
|
39
39
|
account?: TempoAccount.TempoAccount | undefined
|
package/src/internal/signer.ts
CHANGED
|
@@ -32,7 +32,7 @@ import type * as TempoAccount from '../TempoAccount.js'
|
|
|
32
32
|
* signs messages and typed data: the cloud wallet through Tempo ID, or the account's passkey.
|
|
33
33
|
* Elsewhere, the access key signs them. A session without a key, or with a key of another chain,
|
|
34
34
|
* signs only through its owner, and a transaction throws `Id.KeyRequiredError`. Returns `undefined`
|
|
35
|
-
* for a session without
|
|
35
|
+
* for a session without an access key that can sign nothing.
|
|
36
36
|
*/
|
|
37
37
|
export function fromSession(
|
|
38
38
|
config: Config,
|
|
@@ -40,7 +40,7 @@ export function fromSession(
|
|
|
40
40
|
options: fromSession.Options,
|
|
41
41
|
): LocalAccount | undefined {
|
|
42
42
|
const { accessToken, chainId, owner } = options
|
|
43
|
-
//
|
|
43
|
+
// An access key authorizes one chain, so on another chain the account signs only through its owner.
|
|
44
44
|
const key =
|
|
45
45
|
session.key && Number(session.key.chainId) === chainId
|
|
46
46
|
? session.key
|
package/src/internal/verifier.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Keeps the part of a redirect's state that redeems its code in the tab's `sessionStorage`, beside
|
|
3
3
|
* the default IndexedDB store: its `state`, redirect URI, and PKCE verifier, and whether it
|
|
4
|
-
* authorizes
|
|
4
|
+
* authorizes an access key. The callback page reads it at once, so the code exchange starts before
|
|
5
5
|
* IndexedDB's first read, which waits behind the page's first tasks. It holds no key material.
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
@@ -15,7 +15,7 @@ export type Ticket = {
|
|
|
15
15
|
chainId?: number | undefined
|
|
16
16
|
/** The app that started the redirect. */
|
|
17
17
|
clientId?: string | undefined
|
|
18
|
-
/** Whether the redirect authorizes
|
|
18
|
+
/** Whether the redirect authorizes an access key, whose material only the instance's store holds. */
|
|
19
19
|
key: boolean
|
|
20
20
|
/** Where Tempo ID redirects back to. The code exchange repeats it. */
|
|
21
21
|
redirectUri: string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Viem's `accessKey` actions that change
|
|
2
|
+
* Viem's `accessKey` actions that change an access key, `revoke` and `updateLimit` and their `Sync` forms,
|
|
3
3
|
* for a client whose account signs with the user's cloud wallet through Tempo ID. The chain refuses
|
|
4
4
|
* keychain changes from an access key, so Tempo ID sends each change from the account, and the
|
|
5
5
|
* actions return what Viem's own return. With an `account` in the parameters, such as the account's
|
|
@@ -18,11 +18,11 @@ import { Actions as ViemActions } from 'viem/tempo'
|
|
|
18
18
|
import * as Actions from '../../Actions.js'
|
|
19
19
|
import { type Config, RevokedError, SignedOutError } from '../../Id.js'
|
|
20
20
|
|
|
21
|
-
/** A revocation of
|
|
21
|
+
/** A revocation of an access key that the chain holds revoked already, which sends no transaction. */
|
|
22
22
|
/**
|
|
23
23
|
* Revokes `accessKey` of the client's account through Tempo ID, as Viem's `accessKey.revoke` does,
|
|
24
|
-
* and returns the transaction's hash.
|
|
25
|
-
* limits or calls and revokes in the same transaction. Throws {@link RevokedError} for
|
|
24
|
+
* and returns the transaction's hash. An access key that the chain has not registered yet registers without
|
|
25
|
+
* limits or calls and revokes in the same transaction. Throws {@link RevokedError} for an access key that
|
|
26
26
|
* the chain holds revoked already.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
@@ -73,7 +73,7 @@ export async function revokeSync(
|
|
|
73
73
|
/**
|
|
74
74
|
* Sets the amount of `token` that `accessKey` of the client's account can still spend, through
|
|
75
75
|
* Tempo ID, as Viem's `accessKey.updateLimit` does, and returns the transaction's hash. The chain
|
|
76
|
-
* must hold the key. Tempo ID needs a sign-in within the last 10 minutes.
|
|
76
|
+
* must hold the access key. Tempo ID needs a sign-in within the last 10 minutes.
|
|
77
77
|
*
|
|
78
78
|
* @example
|
|
79
79
|
* ```ts
|
|
@@ -146,8 +146,8 @@ type Options<parameters> = {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* Revokes the key through Tempo ID, and returns the receipt that its response holds. Throws
|
|
150
|
-
* {@link RevokedError} for
|
|
149
|
+
* Revokes the access key through Tempo ID, and returns the receipt that its response holds. Throws
|
|
150
|
+
* {@link RevokedError} for an access key that the chain holds revoked already.
|
|
151
151
|
*/
|
|
152
152
|
async function revoke_remote(
|
|
153
153
|
client: Client<Transport, Chain, Account>,
|
|
@@ -164,7 +164,7 @@ async function revoke_remote(
|
|
|
164
164
|
return receipt
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
/** Sets the key's limit of one token through Tempo ID, and returns the receipt that its response holds. */
|
|
167
|
+
/** Sets the access key's limit of one token through Tempo ID, and returns the receipt that its response holds. */
|
|
168
168
|
async function updateLimit_remote(
|
|
169
169
|
client: Client<Transport, Chain, Account>,
|
|
170
170
|
options: Options<updateLimit.Parameters>,
|
package/src/plugins/backend.ts
CHANGED
|
@@ -218,7 +218,7 @@ export declare namespace backend {
|
|
|
218
218
|
/** The session ID. Defaults to 32 random bytes in URL-safe Base64. */
|
|
219
219
|
id?: string | undefined
|
|
220
220
|
/**
|
|
221
|
-
* What the key may do, a function that returns it, or `false` for a sign-in without
|
|
221
|
+
* What the access key may do, a function that returns it, or `false` for a sign-in without an access key.
|
|
222
222
|
* Defaults to the instance's `permissions`.
|
|
223
223
|
*/
|
|
224
224
|
permissions?: SignIn.PermissionsOption
|
package/src/plugins/device.ts
CHANGED
|
@@ -31,7 +31,7 @@ export function device(options: device.Options) {
|
|
|
31
31
|
actions: (context) => ({
|
|
32
32
|
/**
|
|
33
33
|
* Starts the device grant, passes its code to `onCode`, and resolves once the user approves it.
|
|
34
|
-
* The grant always requests
|
|
34
|
+
* The grant always requests an access key, so it throws `Id.KeyRequiredError` without permissions.
|
|
35
35
|
*/
|
|
36
36
|
async signIn(
|
|
37
37
|
parameters: device.signIn.Parameters = {},
|
|
@@ -89,8 +89,8 @@ export declare namespace device {
|
|
|
89
89
|
*/
|
|
90
90
|
funding?: Funding.Funding | undefined
|
|
91
91
|
/**
|
|
92
|
-
* What the key may do, or a function that returns it. Defaults to the instance's
|
|
93
|
-
* `permissions`. The device grant always requests
|
|
92
|
+
* What the access key may do, or a function that returns it. Defaults to the instance's
|
|
93
|
+
* `permissions`. The device grant always requests an access key.
|
|
94
94
|
*/
|
|
95
95
|
permissions?: SignIn.PermissionsOption
|
|
96
96
|
}
|
package/src/plugins/dialog.ts
CHANGED
|
@@ -99,7 +99,7 @@ export declare namespace dialog {
|
|
|
99
99
|
*/
|
|
100
100
|
mode?: 'iframe' | 'popup' | undefined
|
|
101
101
|
/**
|
|
102
|
-
* What the key may do, a function that returns it, or `false` for a sign-in without
|
|
102
|
+
* What the access key may do, a function that returns it, or `false` for a sign-in without an access key.
|
|
103
103
|
* Defaults to the instance's `permissions`.
|
|
104
104
|
*/
|
|
105
105
|
permissions?: SignIn.PermissionsOption
|
package/src/plugins/email.ts
CHANGED
|
@@ -42,7 +42,7 @@ export function email(options: email.Options = {}) {
|
|
|
42
42
|
},
|
|
43
43
|
/**
|
|
44
44
|
* Signs the user in with the emailed code, sets the instance's session, and returns it.
|
|
45
|
-
* With permissions, the session holds
|
|
45
|
+
* With permissions, the session holds an access key. On a browser page, the session holds the
|
|
46
46
|
* user's Tempo Account from the sign-in's own response, with no request after it.
|
|
47
47
|
*/
|
|
48
48
|
async signIn(
|
|
@@ -127,7 +127,7 @@ export declare namespace email {
|
|
|
127
127
|
type Parameters = {
|
|
128
128
|
/**
|
|
129
129
|
* A message whose EIP-191 hash the key authorization binds as its `witness`. Needs the
|
|
130
|
-
* `tempo-id:sign` scope and
|
|
130
|
+
* `tempo-id:sign` scope and an access key.
|
|
131
131
|
*/
|
|
132
132
|
challenge?: string | undefined
|
|
133
133
|
/** The 6-digit code that Tempo ID emailed. */
|
|
@@ -140,7 +140,7 @@ export declare namespace email {
|
|
|
140
140
|
*/
|
|
141
141
|
link?: string | undefined
|
|
142
142
|
/**
|
|
143
|
-
* What the key may do, a function that returns it, or `false` for a sign-in without
|
|
143
|
+
* What the access key may do, a function that returns it, or `false` for a sign-in without an access key.
|
|
144
144
|
* Defaults to the instance's `permissions`.
|
|
145
145
|
*/
|
|
146
146
|
permissions?: SignIn.PermissionsOption
|
|
@@ -150,7 +150,7 @@ export declare namespace email {
|
|
|
150
150
|
|
|
151
151
|
type ReturnType = Session.Session & {
|
|
152
152
|
/**
|
|
153
|
-
* Whether the account is a wallet.tempo passkey's that waits for its upgrade on the key's
|
|
153
|
+
* Whether the account is a wallet.tempo passkey's that waits for its upgrade on the access key's
|
|
154
154
|
* chain.
|
|
155
155
|
*/
|
|
156
156
|
upgradeAvailable: boolean
|
package/src/plugins/passkey.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function passkey(options: passkey.Options = {}) {
|
|
|
36
36
|
return result
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// The key names the account. Without one, the session reads the account that Tempo ID
|
|
39
|
+
// The access key names the account. Without one, the session reads the account that Tempo ID
|
|
40
40
|
// selects for the app.
|
|
41
41
|
const account =
|
|
42
42
|
'key' in result
|
|
@@ -146,7 +146,7 @@ export declare namespace passkey {
|
|
|
146
146
|
type Parameters = {
|
|
147
147
|
/**
|
|
148
148
|
* A message whose EIP-191 hash the key authorization binds as its `witness`. Needs the
|
|
149
|
-
* `tempo-id:sign` scope and
|
|
149
|
+
* `tempo-id:sign` scope and an access key.
|
|
150
150
|
*/
|
|
151
151
|
challenge?: string | undefined
|
|
152
152
|
/** The credential ID, or up to 16 IDs, that the browser offers. Defaults to every passkey. */
|
|
@@ -154,7 +154,7 @@ export declare namespace passkey {
|
|
|
154
154
|
/** The browser's mediation, such as `conditional` for autofill. Defaults to its own. */
|
|
155
155
|
mediation?: 'conditional' | 'optional' | 'required' | 'silent' | undefined
|
|
156
156
|
/**
|
|
157
|
-
* What the key may do, a function that returns it, or `false` for a sign-in without
|
|
157
|
+
* What the access key may do, a function that returns it, or `false` for a sign-in without an access key.
|
|
158
158
|
* Defaults to the instance's `permissions`.
|
|
159
159
|
*/
|
|
160
160
|
permissions?: SignIn.PermissionsOption
|
|
@@ -168,7 +168,7 @@ export declare namespace passkey {
|
|
|
168
168
|
type ReturnType =
|
|
169
169
|
| (Session.Session & {
|
|
170
170
|
/**
|
|
171
|
-
* Whether the account is a wallet.tempo passkey's that waits for its upgrade on the key's
|
|
171
|
+
* Whether the account is a wallet.tempo passkey's that waits for its upgrade on the access key's
|
|
172
172
|
* chain.
|
|
173
173
|
*/
|
|
174
174
|
upgradeAvailable: boolean
|
package/src/plugins/redirect.ts
CHANGED
|
@@ -154,7 +154,7 @@ export declare namespace redirect {
|
|
|
154
154
|
/** The amount that the app needs in the user's account, which opens the funding page. */
|
|
155
155
|
funding?: Funding.Funding | undefined
|
|
156
156
|
/**
|
|
157
|
-
* What the key may do, a function that returns it, or `false` for a sign-in without
|
|
157
|
+
* What the access key may do, a function that returns it, or `false` for a sign-in without an access key.
|
|
158
158
|
* Defaults to the instance's `permissions`.
|
|
159
159
|
*/
|
|
160
160
|
permissions?: SignIn.PermissionsOption
|
package/src/plugins/viem.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function viem(options: viem.Options = {}) {
|
|
|
60
60
|
const plugin = Plugin.from({
|
|
61
61
|
actions: (context) => {
|
|
62
62
|
const { config } = context
|
|
63
|
-
// The account of each session on each chain, so a client rebuilds no key at each read.
|
|
63
|
+
// The account of each session on each chain, so a client rebuilds no access key at each read.
|
|
64
64
|
const accounts = new WeakMap<
|
|
65
65
|
Session.Session,
|
|
66
66
|
Map<number, LocalAccount | undefined>
|
|
@@ -250,7 +250,7 @@ export declare namespace viem {
|
|
|
250
250
|
chainId?: number | undefined
|
|
251
251
|
/**
|
|
252
252
|
* A fixed session, such as one that `tempoId.backend.get` returns, whose access key signs. A
|
|
253
|
-
* client of a session without
|
|
253
|
+
* client of a session without an access key throws `Id.KeyRequiredError`.
|
|
254
254
|
*/
|
|
255
255
|
session?: Session.Session | undefined
|
|
256
256
|
}
|
package/src/wagmi.ts
CHANGED
|
@@ -39,7 +39,7 @@ import { pluginOptions, settings, viem } from './plugins/viem.js'
|
|
|
39
39
|
import * as Session from './Session.js'
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* The connector's account has no address: the session holds no key, and Tempo ID returned no Tempo
|
|
42
|
+
* The connector's account has no address: the session holds no access key, and Tempo ID returned no Tempo
|
|
43
43
|
* Account for the app on the connector's chain.
|
|
44
44
|
*/
|
|
45
45
|
export class AccountUnavailableError extends Error {
|
|
@@ -106,7 +106,7 @@ export class SignInRequiredError extends Error {
|
|
|
106
106
|
* `connect` returns the instance's session without a sign-in, unless it receives `permissions`.
|
|
107
107
|
* Otherwise it runs `signIn`, or the `signIn` of the first plugin of `plugins` that signs in without
|
|
108
108
|
* input: `device`, `dialog`, `passkey`, or `redirect`. An instance without a sign-in plugin holds
|
|
109
|
-
* `dialog`. A session without
|
|
109
|
+
* `dialog`. A session without an access key receives the Tempo Account that Tempo ID selects for the app.
|
|
110
110
|
*
|
|
111
111
|
* wagmi's actions use the instance's Viem client. The access key signs transactions. On a page, the
|
|
112
112
|
* account's owner signs messages and typed data. Elsewhere, the access key signs them. `disconnect`
|
|
@@ -158,7 +158,7 @@ export function tempoId<const plugins extends readonly Plugin.Option[] = []>(
|
|
|
158
158
|
| Readonly<Record<number, Transport>>
|
|
159
159
|
| undefined,
|
|
160
160
|
}),
|
|
161
|
-
// Holds the instance's context, through which a session without
|
|
161
|
+
// Holds the instance's context, through which a session without an access key receives its
|
|
162
162
|
// account.
|
|
163
163
|
Plugin.from({
|
|
164
164
|
id: 'wagmi',
|
|
@@ -185,7 +185,7 @@ export declare namespace tempoId {
|
|
|
185
185
|
/** Whether wagmi restores an earlier connection, which never signs in. */
|
|
186
186
|
isReconnecting?: boolean | undefined
|
|
187
187
|
/**
|
|
188
|
-
* What the key may do, a function that returns it, or `false` for a sign-in without
|
|
188
|
+
* What the access key may do, a function that returns it, or `false` for a sign-in without an access key. With
|
|
189
189
|
* it, `connect` signs in again over a held session. Defaults to the connector's `permissions`.
|
|
190
190
|
*/
|
|
191
191
|
permissions?: SignIn.PermissionsOption
|
|
@@ -432,7 +432,7 @@ function settle<value>(fn: () => value): Promise<value> {
|
|
|
432
432
|
return new Promise((resolve) => resolve(fn()))
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
/** Returns the address of `session`'s account, or `undefined` without
|
|
435
|
+
/** Returns the address of `session`'s account, or `undefined` without an access key and an account. */
|
|
436
436
|
function addressOf(session: Session.Session | undefined) {
|
|
437
437
|
return session?.key?.account ?? session?.account?.address
|
|
438
438
|
}
|
|
@@ -510,7 +510,7 @@ function connector<const plugins extends readonly Plugin.Option[]>(source: {
|
|
|
510
510
|
instance.session.subscribe((session, previous) => {
|
|
511
511
|
const next = addressOf(session)
|
|
512
512
|
if (session && !next) {
|
|
513
|
-
// A session without
|
|
513
|
+
// A session without an access key or an account, such as a keyless dialog's, has no address
|
|
514
514
|
// until its account is read. The account's commit notifies this subscriber again.
|
|
515
515
|
if (addressOf(previous)) onDisconnect()
|
|
516
516
|
// A failed read leaves wagmi disconnected, and `connect` reads the account again.
|
|
@@ -647,7 +647,7 @@ function connector<const plugins extends readonly Plugin.Option[]>(source: {
|
|
|
647
647
|
|
|
648
648
|
/**
|
|
649
649
|
* Returns `session`, with the Tempo Account that Tempo ID selects for the app when it holds no
|
|
650
|
-
* key and no account, such as after a dialog's sign-in without permissions.
|
|
650
|
+
* access key and no account, such as after a dialog's sign-in without permissions.
|
|
651
651
|
*/
|
|
652
652
|
async function withAccount(
|
|
653
653
|
held: Session.Session,
|