@tempoxyz/auth 0.0.0-pr-48.sha-9d0ea2b → 0.0.0-pr-49.sha-edc6ce4

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 CHANGED
@@ -49,7 +49,7 @@ export declare namespace RequestError {
49
49
  uri?: string | undefined;
50
50
  };
51
51
  /** Each refusal's stable name. `docs/errors.md` explains each one. */
52
- type Reason = 'already_decided' | 'body_too_large' | 'duplicate_limit' | 'empty_limits' | 'empty_scopes' | 'expiry_exceeds_maximum' | 'expiry_passed' | 'foreign_account' | 'invalid_chain' | 'invalid_code' | 'invalid_expiry' | 'invalid_field' | 'invalid_origin' | 'invalid_public_key' | 'limit_exceeds_maximum' | 'missing_code_challenge' | 'missing_key' | 'missing_recipients' | 'periodic_limit' | 'rejected' | 'scope_without_limit' | 'unknown_code' | 'unsupported_call' | 'unsupported_step' | 'unsupported_token';
52
+ type Reason = 'already_decided' | 'duplicate_limit' | 'empty_limits' | 'empty_scopes' | 'expiry_exceeds_maximum' | 'expiry_passed' | 'foreign_account' | 'invalid_chain' | 'invalid_code' | 'invalid_expiry' | 'invalid_field' | 'invalid_origin' | 'invalid_public_key' | 'limit_exceeds_maximum' | 'missing_code_challenge' | 'missing_key' | 'missing_recipients' | 'periodic_limit' | 'rate_limited' | 'rejected' | 'scope_without_limit' | 'unknown_code' | 'unsupported_call' | 'unsupported_step' | 'unsupported_token';
53
53
  }
54
54
  /**
55
55
  * Creates a Tempo Auth instance.
package/dist/Key.js CHANGED
@@ -53,9 +53,7 @@ export function toAccount(key, options = {}) {
53
53
  const { accessKey } = options;
54
54
  const keyAuthorization = KeyAuthorization.fromRpc(key.keyAuthorization);
55
55
  const keyAuthorizationManager = KeyAuthorizationManager.memory();
56
- // The memory manager stores synchronously, so the authorization is in place before the account
57
- // is returned.
58
- void keyAuthorizationManager.set({
56
+ keyAuthorizationManager.set({
59
57
  accessKey: keyAuthorization.address,
60
58
  address: key.account,
61
59
  chainId: Number(keyAuthorization.chainId),
@@ -99,14 +99,6 @@ export async function createUrl(auth, options = {}) {
99
99
  export async function handleCallback(auth, options) {
100
100
  const { redirectUri, state, verifier, ...material } = options.pending;
101
101
  const params = new URL(options.url).searchParams;
102
- // State comes first, so a forged link cannot supply the error an app shows.
103
- if (params.get('state') !== state)
104
- throw new RequestError({
105
- code: 'invalid_request',
106
- field: 'state',
107
- message: 'Invalid `state` in the callback URL. Start sign-in again from this app.',
108
- status: 400,
109
- });
110
102
  const code = params.get('code');
111
103
  if (!code)
112
104
  throw new RequestError({
@@ -116,6 +108,13 @@ export async function handleCallback(auth, options) {
116
108
  'Missing `code` in the callback URL. Start sign-in again.',
117
109
  status: 400,
118
110
  });
111
+ if (params.get('state') !== state)
112
+ throw new RequestError({
113
+ code: 'invalid_request',
114
+ field: 'state',
115
+ message: 'Invalid `state` in the callback URL. Start sign-in again from this app.',
116
+ status: 400,
117
+ });
119
118
  const body = await Api.token(auth, {
120
119
  code,
121
120
  code_verifier: verifier,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempoxyz/auth",
3
- "version": "0.0.0-pr-48.sha-9d0ea2b",
3
+ "version": "0.0.0-pr-49.sha-edc6ce4",
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": {