theauthapi 1.0.9 → 1.0.10

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 CHANGED
@@ -31,7 +31,7 @@ yarn add theauthapi
31
31
 
32
32
  ## Configuration
33
33
 
34
- You'll need to configure the library with your `access key` and `account id`, you can grab these from [TheAuthAPI](https://app.theauthapi.com/dashboard) dashboard.
34
+ You'll need to configure the library with your `access key` and `account id`, you can grab these from [TheAuthAPI](https://app.theauthapi.com) dashboard.
35
35
 
36
36
  For further instructions on creating an account, check out our [how to guides](https://thatapicompany.notion.site/The-Auth-API-Knowledge-Base-21660cee84e640729714fad43d9ce546).
37
37
 
@@ -139,6 +139,8 @@ try {
139
139
  }
140
140
  ```
141
141
 
142
+ **Note:** If you want to consume the API key and get the API key entity in return, you can use `apiKeys.authenticateKey` which returns an ApiKey.
143
+
142
144
  #### Example: Listing API-keys
143
145
 
144
146
  ```javascript
@@ -328,5 +330,6 @@ async function getProjectsIds(accountId: string): Promise<string[]> {
328
330
 
329
331
  - Create your account [https://theauthapi.com](https://theauthapi.com)
330
332
  - View our [Knowledge Base](https://thatapicompany.notion.site/The-Auth-API-Knowledge-Base-21660cee84e640729714fad43d9ce546) help centre
333
+ - Read our [API docs](https://docs.theauthapi.com)
331
334
  - Articles on best Auth practice - [https://theauthapi.com/articles](https://theauthapi.com/articles)
332
335
  - Meet the team behind The Auth API - [That API Company](https://thatapicompany.com/)
@@ -6,6 +6,7 @@ declare class ApiKeys implements ApiKeysInterface {
6
6
  private readonly endpoint;
7
7
  constructor(apiService: ApiRequest);
8
8
  isValidKey(apikey: string): Promise<boolean>;
9
+ authenticateKey(apikey: string): Promise<ApiKey>;
9
10
  getKeys(filter?: ApiKeyFilter): Promise<ApiKey[]>;
10
11
  getKey(apikey: string): Promise<ApiKey>;
11
12
  createKey(apiKey: ApiKeyInput): Promise<ApiKey>;
@@ -25,7 +25,7 @@ class ApiKeys {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
26
  (0, util_1.validateString)("apikey", apikey);
27
27
  try {
28
- const key = yield this.api.request(HttpMethod_1.HttpMethod.GET, `/api-keys/${apikey}`);
28
+ const key = yield this.api.request(HttpMethod_1.HttpMethod.GET, `/api-keys/auth/${apikey}`);
29
29
  return key.key !== undefined;
30
30
  }
31
31
  catch (error) {
@@ -36,6 +36,12 @@ class ApiKeys {
36
36
  }
37
37
  });
38
38
  }
39
+ authenticateKey(apikey) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ (0, util_1.validateString)("apikey", apikey);
42
+ return yield this.api.request(HttpMethod_1.HttpMethod.GET, `/api-keys/auth/${apikey}`);
43
+ });
44
+ }
39
45
  getKeys(filter) {
40
46
  return __awaiter(this, void 0, void 0, function* () {
41
47
  const endpoint = this.getKeysFilterEndpoint(filter);
@@ -2,6 +2,7 @@ import { ApiKey, ApiKeyFilter, ApiKeyInput, UpdateApiKeyInput } from "../../type
2
2
  export interface ApiKeysInterface {
3
3
  isValidKey(apiKey: string): Promise<boolean>;
4
4
  getKey(apiKey: string): Promise<ApiKey>;
5
+ authenticateKey(apiKey: string): Promise<ApiKey>;
5
6
  getKeys(filter?: ApiKeyFilter): Promise<ApiKey[]>;
6
7
  createKey(apiKey: ApiKeyInput): Promise<ApiKey>;
7
8
  updateKey(apiKey: string, updateTo: UpdateApiKeyInput): Promise<ApiKey>;
@@ -1 +1 @@
1
- export declare const version = "1.0.9";
1
+ export declare const version = "1.0.10";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = "1.0.9";
4
+ exports.version = "1.0.10";
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "theauthapi",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Client library for TheAuthAPI.com",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "dist"
9
9
  ],
10
+ "keywords": [
11
+ "theauthapi",
12
+ "authapi"
13
+ ],
10
14
  "scripts": {
11
15
  "test": "jest --runInBand",
12
16
  "test:coverage": "jest --coverage --runInBand",
13
- "np": "np --no-publish",
14
- "release": "yarn run np",
15
17
  "build": "tsc",
16
18
  "prepublish": "npm run build"
17
19
  },
@@ -35,8 +37,6 @@
35
37
  "remove-trailing-slash": "^0.1.1"
36
38
  },
37
39
  "devDependencies": {
38
- "@size-limit/preset-small-lib": "^7.0.8",
39
- "@types/basic-auth": "^1.1.3",
40
40
  "@types/express": "^4.17.13",
41
41
  "@types/jest": "^27.4.1",
42
42
  "@types/lodash.isstring": "^4.0.6",
@@ -51,9 +51,6 @@
51
51
  "express": "^4.15.2",
52
52
  "jest": "^27.5.1",
53
53
  "prettier": "2.6.2",
54
- "size-limit": "^4.11.0",
55
- "ts-jest": "^27.1.4",
56
- "ts-node": "^10.7.0",
57
54
  "typescript": "^4.6.3"
58
55
  }
59
56
  }