@tempoxyz/auth 0.0.0-pr-36.sha-c6e834e → 0.0.0-pr-52.sha-dafc5ec

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.
@@ -18,10 +18,10 @@ export async function authorize(auth, options) {
18
18
  const code = await Api.json(await Api.post(auth, `${Api.prefix}/device/authorize`, {
19
19
  json: {
20
20
  device: options.device,
21
- keyAuthorization: request(auth, {
21
+ key_authorization: request(auth, {
22
22
  accessKey: key.accessKey,
23
23
  permissions: options.permissions,
24
- }).keyAuthorization,
24
+ }).key_authorization,
25
25
  },
26
26
  }));
27
27
  /** Polls until the user approves or denies the code, or it expires. */
@@ -37,7 +37,7 @@ export async function authorize(auth, options) {
37
37
  if ('access_token' in body)
38
38
  return Api.authorization({
39
39
  account: body.account,
40
- keyAuthorization: body.key_authorization,
40
+ key_authorization: body.key_authorization,
41
41
  tokens: Api.tokens(body),
42
42
  }, key);
43
43
  // RFC 8628 asks a client told to slow down to add 5 seconds to its interval.
@@ -69,7 +69,7 @@ export async function createUrl(auth, options = {}) {
69
69
  state: Base64.fromBytes(Bytes.random(16), base64url),
70
70
  verifier: Base64.fromBytes(Bytes.random(32), base64url),
71
71
  });
72
- const { client_id, keyAuthorization, scope } = request(auth, {
72
+ const { client_id, key_authorization, scope } = request(auth, {
73
73
  accessKey: key.accessKey,
74
74
  permissions: options.permissions,
75
75
  });
@@ -77,7 +77,7 @@ export async function createUrl(auth, options = {}) {
77
77
  url.search = new URLSearchParams({
78
78
  client_id,
79
79
  code_challenge: Base64.fromBytes(Hash.sha256(Bytes.fromString(pending.verifier)), base64url),
80
- key_authorization: Base64.fromString(JSON.stringify(keyAuthorization), base64url),
80
+ key_authorization: Base64.fromString(JSON.stringify(key_authorization), base64url),
81
81
  redirect_uri: redirectUri,
82
82
  scope,
83
83
  state: pending.state,
@@ -130,7 +130,7 @@ export async function handleCallback(auth, options) {
130
130
  });
131
131
  return Api.authorization({
132
132
  account: body.account,
133
- keyAuthorization: body.key_authorization,
133
+ key_authorization: body.key_authorization,
134
134
  tokens: body,
135
135
  }, { accessKey: options.accessKey, material });
136
136
  }
@@ -15,7 +15,7 @@ export declare function authorization(body: Headless, options: {
15
15
  /** What the headless API returns for an authorization. */
16
16
  export type Headless = {
17
17
  account: Key.Key['account'];
18
- keyAuthorization: KeyAuthorization.Rpc;
18
+ key_authorization: KeyAuthorization.Rpc;
19
19
  tokens: TokenResponse | Tokens;
20
20
  };
21
21
  /** Reads a JSON response, and throws a {@link RequestError} for a refused request. */
@@ -14,7 +14,7 @@ export function authorization(body, options) {
14
14
  const key = Key.from({
15
15
  ...material,
16
16
  account: body.account,
17
- keyAuthorization: body.keyAuthorization,
17
+ keyAuthorization: body.key_authorization,
18
18
  });
19
19
  const tokens_ = 'accessToken' in body.tokens ? body.tokens : tokens(body.tokens);
20
20
  const claims = JSON.parse(Base64.toString(tokens_.idToken.split('.')[1]));
@@ -10,7 +10,7 @@ export declare function request(auth: Auth, options: {
10
10
  permissions?: Permissions | undefined;
11
11
  }): {
12
12
  client_id: string;
13
- keyAuthorization: {
13
+ key_authorization: {
14
14
  account?: `0x${string}`;
15
15
  address: `0x${string}`;
16
16
  chainId: `0x${string}`;
@@ -12,7 +12,7 @@ export function request(auth, options) {
12
12
  const { accessKey, permissions = {} } = options;
13
13
  return {
14
14
  client_id: auth.clientId,
15
- keyAuthorization: {
15
+ key_authorization: {
16
16
  ...(accessKey.accessKeyAddress ? { account: accessKey.address } : {}),
17
17
  address: accessKey.accessKeyAddress ?? accessKey.address,
18
18
  chainId: Hex.fromNumber(permissions.chainId ?? auth.chainId),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempoxyz/auth",
3
- "version": "0.0.0-pr-36.sha-c6e834e",
3
+ "version": "0.0.0-pr-52.sha-dafc5ec",
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": {