@tempoxyz/auth 0.0.0-pr-63.sha-fd71f2e → 0.0.0-pr-68.sha-a54224a
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/Auth.d.ts +1 -1
- package/dist/TempoAccount.d.ts +7 -1
- package/dist/TempoAccount.js +1 -1
- package/dist/actions/tempoAccount.js +9 -3
- package/package.json +1 -1
package/dist/Auth.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export declare namespace RequestError {
|
|
|
86
86
|
uri?: string | undefined;
|
|
87
87
|
};
|
|
88
88
|
/** Each refusal's stable name. `docs/errors.md` explains each one. */
|
|
89
|
-
type Reason = 'already_decided' | 'approval_pending' | 'body_too_large' | 'cross_site_request' | 'device_code_expired' | 'duplicate_limit' | 'empty_limits' | 'empty_scopes' | 'expiry_exceeds_maximum' | 'expiry_passed' | 'foreign_account' | 'foreign_origin' | 'invalid_chain' | 'invalid_code' | 'invalid_expiry' | 'invalid_field' | 'invalid_origin' | 'invalid_period' | 'invalid_public_key' | 'limit_exceeds_maximum' | 'malformed_body' | 'missing_code_challenge' | 'missing_key' | 'missing_recipients' | 'polling_too_fast' | 'rate_limited' | 'rejected' | 'request_denied' | 'scope_without_limit' | 'session_required' | 'unexpected' | 'unknown_code' | 'unknown_endpoint' | 'unsupported_call' | 'unsupported_step' | 'unsupported_token' | 'upstream_unavailable' | 'webauthn_rejected';
|
|
89
|
+
type Reason = 'already_decided' | 'approval_pending' | 'body_too_large' | 'cross_site_request' | 'device_code_expired' | 'duplicate_limit' | 'empty_limits' | 'empty_scopes' | 'expiry_exceeds_maximum' | 'expiry_passed' | 'foreign_account' | 'foreign_origin' | 'invalid_chain' | 'invalid_code' | 'invalid_expiry' | 'invalid_field' | 'invalid_origin' | 'invalid_period' | 'invalid_public_key' | 'limit_exceeds_maximum' | 'malformed_body' | 'missing_code_challenge' | 'missing_key' | 'missing_recipients' | 'polling_too_fast' | 'rate_limited' | 'rejected' | 'request_denied' | 'scope_without_limit' | 'session_required' | 'unexpected' | 'unknown_code' | 'unknown_endpoint' | 'unsupported_call' | 'unsupported_step' | 'unsupported_token' | 'upstream_unavailable' | 'webauthn_rejected' | 'webauthn_required';
|
|
90
90
|
}
|
|
91
91
|
/** A client's {@link Account} read before a sign-in set it, or after sign-out emptied it. */
|
|
92
92
|
export declare class SignedOutError extends Error {
|
package/dist/TempoAccount.d.ts
CHANGED
|
@@ -6,13 +6,19 @@
|
|
|
6
6
|
export type TempoAccount = {
|
|
7
7
|
/** The account's address, the same on every Tempo chain. */
|
|
8
8
|
address: `0x${string}`;
|
|
9
|
+
/**
|
|
10
|
+
* Who holds the account's owner key: a Privy wallet, which Tempo Auth signs with (`privy`), or a
|
|
11
|
+
* passkey, which signs only on a Tempo Auth page (`webAuthn`). Treat another value as an owner
|
|
12
|
+
* that may refuse a key authorization.
|
|
13
|
+
*/
|
|
14
|
+
owner: 'privy' | 'webAuthn' | (string & {});
|
|
9
15
|
};
|
|
10
16
|
/**
|
|
11
17
|
* Instantiates a {@link TempoAccount}.
|
|
12
18
|
*
|
|
13
19
|
* @example
|
|
14
20
|
* ```ts
|
|
15
|
-
* const tempoAccount = TempoAccount.from({ address: '0x…' })
|
|
21
|
+
* const tempoAccount = TempoAccount.from({ address: '0x…', owner: 'privy' })
|
|
16
22
|
* ```
|
|
17
23
|
*/
|
|
18
24
|
export declare function from(value: TempoAccount): TempoAccount;
|
package/dist/TempoAccount.js
CHANGED
|
@@ -12,8 +12,7 @@ import * as Api from '../internal/api.js';
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export async function create(auth) {
|
|
15
|
-
|
|
16
|
-
return { address };
|
|
15
|
+
return toTempoAccount(await Api.json(await Api.post(auth, '/v1/account/tempo', { json: {} })));
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* Lists the signed-in user's Tempo Accounts, their default first.
|
|
@@ -27,5 +26,12 @@ export async function list(auth) {
|
|
|
27
26
|
const { tempo } = await Api.json(await (auth.fetch ?? fetch)(new URL('/v1/account', auth.url), {
|
|
28
27
|
credentials: 'include',
|
|
29
28
|
}));
|
|
30
|
-
return tempo.map(
|
|
29
|
+
return tempo.map(toTempoAccount);
|
|
30
|
+
}
|
|
31
|
+
/** Reads the account's address and the type of its owner, which the API lists first. */
|
|
32
|
+
function toTempoAccount(account) {
|
|
33
|
+
return {
|
|
34
|
+
address: account.address,
|
|
35
|
+
owner: account.config.owners[0].type,
|
|
36
|
+
};
|
|
31
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempoxyz/auth",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-68.sha-a54224a",
|
|
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": {
|