vpndetection 5.0.0 → 5.2.0

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.
@@ -1,5 +1,5 @@
1
1
  import { type Client, type ClientMeta, type Options as Options2, type RequestResult, type TDataShape } from './client/index.js';
2
- import type { AccountCreateApikeyData, AccountCreateApikeyErrors, AccountCreateApikeyResponses, AccountIdentityData, AccountIdentityErrors, AccountIdentityResponses, AccountListApikeysData, AccountListApikeysErrors, AccountListApikeysResponses, AccountOrgData, AccountOrgErrors, AccountOrgMembersData, AccountOrgMembersErrors, AccountOrgMembersResponses, AccountOrgResponses, AccountRevealApikeyData, AccountRevealApikeyErrors, AccountRevealApikeyResponses, AccountRevokeApikeyData, AccountRevokeApikeyErrors, AccountRevokeApikeyResponses, AccountRotateApikeyData, AccountRotateApikeyErrors, AccountRotateApikeyResponses, DatabaseChecksumData, DatabaseChecksumErrors, DatabaseChecksumResponses, DatabaseMetadataData, DatabaseMetadataErrors, DatabaseMetadataResponses, DownloadDatabaseData, DownloadDatabaseErrors, ListDatabasesData, ListDatabasesErrors, ListDatabasesResponses, ListDownloadsData, ListDownloadsErrors, ListDownloadsResponses, LookupIpData, LookupIpErrors, LookupIpResponses, LookupMyIpData, LookupMyIpErrors, LookupMyIpResponses, MyEntitlementData, MyEntitlementErrors, MyEntitlementResponses, OauthAuthorizeData, OauthAuthorizeErrors, OauthDeviceAuthorizationData, OauthDeviceAuthorizationErrors, OauthDeviceAuthorizationResponses, OauthMetadataData, OauthMetadataResponses, OauthRevokeData, OauthRevokeResponses, OauthTokenData, OauthTokenErrors, OauthTokenResponses } from './types.gen.js';
2
+ import type { AccountCreateApikeyData, AccountCreateApikeyErrors, AccountCreateApikeyResponses, AccountIdentityData, AccountIdentityErrors, AccountIdentityResponses, AccountListApikeysData, AccountListApikeysErrors, AccountListApikeysResponses, AccountOrgData, AccountOrgErrors, AccountOrgMembersData, AccountOrgMembersErrors, AccountOrgMembersResponses, AccountOrgResponses, AccountRevealApikeyData, AccountRevealApikeyErrors, AccountRevealApikeyResponses, AccountRevokeApikeyData, AccountRevokeApikeyErrors, AccountRevokeApikeyResponses, AccountRotateApikeyData, AccountRotateApikeyErrors, AccountRotateApikeyResponses, DatabaseChecksumData, DatabaseChecksumErrors, DatabaseChecksumResponses, DatabaseMetadataData, DatabaseMetadataErrors, DatabaseMetadataResponses, DownloadDatabaseData, DownloadDatabaseErrors, ListDatabasesData, ListDatabasesErrors, ListDatabasesResponses, ListDownloadsData, ListDownloadsErrors, ListDownloadsResponses, LookupBatchData, LookupBatchErrors, LookupBatchResponses, LookupIpData, LookupIpErrors, LookupIpResponses, LookupMyIpData, LookupMyIpErrors, LookupMyIpResponses, MyEntitlementData, MyEntitlementErrors, MyEntitlementResponses, OauthAuthorizeData, OauthAuthorizeErrors, OauthDeviceAuthorizationData, OauthDeviceAuthorizationErrors, OauthDeviceAuthorizationResponses, OauthMetadataData, OauthMetadataResponses, OauthRevokeData, OauthRevokeResponses, OauthTokenData, OauthTokenErrors, OauthTokenResponses } from './types.gen.js';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -36,6 +36,29 @@ export declare const lookupIp: <ThrowOnError extends boolean = false>(options: O
36
36
  *
37
37
  */
38
38
  export declare const lookupMyIp: <ThrowOnError extends boolean = false>(options?: Options<LookupMyIpData, ThrowOnError>) => RequestResult<LookupMyIpResponses, LookupMyIpErrors, ThrowOnError>;
39
+ /**
40
+ * Batch
41
+ *
42
+ * Answers up to 1000 addresses in one call. Each distinct string in `ips`
43
+ * is one lookup: it costs exactly what `GET /{ip}` costs for that address
44
+ * and comes back with exactly the fields that call would carry for your
45
+ * plan. Exact duplicates collapse to one entry and one lookup.
46
+ *
47
+ * Both maps in the answer are keyed by the string you sent, so nothing has
48
+ * to be lined up by position; the `ip` inside each result is the
49
+ * normalized form. An address that could not be answered sits in `errors`
50
+ * with the status and message the single lookup would have given, and
51
+ * never disturbs the others: a string that is not an address is a `400`
52
+ * there, and an allowance that runs out part way through leaves the
53
+ * remaining entries as `429`s.
54
+ *
55
+ * The call itself fails only for the reasons below, and a `429` on the
56
+ * call always carries `Retry-After`: the batch is admitted or refused
57
+ * whole by the rate limit, so a per-entry `429` is always a spent
58
+ * allowance and never a throttle.
59
+ *
60
+ */
61
+ export declare const lookupBatch: <ThrowOnError extends boolean = false>(options: Options<LookupBatchData, ThrowOnError>) => RequestResult<LookupBatchResponses, LookupBatchErrors, ThrowOnError>;
39
62
  /**
40
63
  * List
41
64
  *
@@ -48,6 +48,45 @@ export const lookupMyIp = (options) => (options?.client ?? client).get({
48
48
  url: '/myip',
49
49
  ...options
50
50
  });
51
+ /**
52
+ * Batch
53
+ *
54
+ * Answers up to 1000 addresses in one call. Each distinct string in `ips`
55
+ * is one lookup: it costs exactly what `GET /{ip}` costs for that address
56
+ * and comes back with exactly the fields that call would carry for your
57
+ * plan. Exact duplicates collapse to one entry and one lookup.
58
+ *
59
+ * Both maps in the answer are keyed by the string you sent, so nothing has
60
+ * to be lined up by position; the `ip` inside each result is the
61
+ * normalized form. An address that could not be answered sits in `errors`
62
+ * with the status and message the single lookup would have given, and
63
+ * never disturbs the others: a string that is not an address is a `400`
64
+ * there, and an allowance that runs out part way through leaves the
65
+ * remaining entries as `429`s.
66
+ *
67
+ * The call itself fails only for the reasons below, and a `429` on the
68
+ * call always carries `Retry-After`: the batch is admitted or refused
69
+ * whole by the rate limit, so a per-entry `429` is always a spent
70
+ * allowance and never a throttle.
71
+ *
72
+ */
73
+ export const lookupBatch = (options) => (options.client ?? client).post({
74
+ security: [
75
+ {
76
+ in: 'query',
77
+ name: 'apikey',
78
+ type: 'apiKey'
79
+ },
80
+ { name: 'X-Api-Key', type: 'apiKey' },
81
+ { scheme: 'bearer', type: 'http' }
82
+ ],
83
+ url: '/batch',
84
+ ...options,
85
+ headers: {
86
+ 'Content-Type': 'application/json',
87
+ ...options.headers
88
+ }
89
+ });
51
90
  /**
52
91
  * List
53
92
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.gen.js","sourceRoot":"","sources":["../../src/generated/sdk.gen.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAA+F,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAiB/J;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAuC,OAA4C,EAAkE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAAkD;IAC5P,QAAQ,EAAE;QACN;YACI,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACjB;QACD,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE;KACrC;IACD,GAAG,EAAE,OAAO;IACZ,GAAG,OAAO;CACb,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAuC,OAA+C,EAAsE,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAAsD;IAC1Q,QAAQ,EAAE;QACN;YACI,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;SACjB;QACD,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE;KACrC;IACD,GAAG,EAAE,OAAO;IACZ,GAAG,OAAO;CACb,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG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A4D,EAAkG,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,CAAkF;IAC7V,GAAG,6BAA6B;IAChC,GAAG,EAAE,6BAA6B;IAClC,GAAG,OAAO;IACV,OAAO,EAAE;QACL,cAAc,EAAE,mCAAmC;QACnD,GAAG,OAAO,CAAC,OAAO;KACrB;CACJ,CAAC,CAAC;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAuC,OAAkD,EAA8D,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAA8C,EAAE,GAAG,EAAE,kBAAkB,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AAE7S;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAuC,OAA8C,EAAsE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,CAAsD;IACzQ,GAAG,6BAA6B;IAChC,GAAG,EAAE,cAAc;IACnB,GAAG,OAAO;IACV,OAAO,EAAE;QACL,cAAc,EAAE,mCAAmC;QACnD,GAAG,OAAO,CAAC,OAAO;KACrB;CACJ,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAuC,OAA+C,EAA8D,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,CAA8C;IAC3P,GAAG,6BAA6B;IAChC,GAAG,EAAE,eAAe;IACpB,GAAG,OAAO;IACV,OAAO,EAAE;QACL,cAAc,EAAE,mCAAmC;QACnD,GAAG,OAAO,CAAC,OAAO;KACrB;CACJ,CAAC,CAAC"}
@@ -84,6 +84,50 @@ export type LookupResponse = {
84
84
  */
85
85
  mobproxy?: ProxyDetail;
86
86
  };
87
+ export type BatchLookupRequest = {
88
+ /**
89
+ * The addresses to classify, 1 to 1000 per call, counted before
90
+ * duplicates collapse. Each distinct string is one lookup.
91
+ *
92
+ */
93
+ ips: Array<string>;
94
+ };
95
+ export type BatchLookupResponse = {
96
+ /**
97
+ * One answer per input string that was classified, keyed by the string
98
+ * as you sent it; the `ip` inside is the normalized form. Each value is
99
+ * exactly what `GET /{ip}` answers for your plan.
100
+ *
101
+ */
102
+ results: {
103
+ [key: string]: LookupResponse;
104
+ };
105
+ /**
106
+ * One entry per input string that could not be classified, keyed the
107
+ * same way. Empty when every entry was answered.
108
+ *
109
+ */
110
+ errors: {
111
+ [key: string]: BatchLookupError;
112
+ };
113
+ };
114
+ /**
115
+ * Why one entry of a batch was not answered, as the single lookup would have reported it.
116
+ */
117
+ export type BatchLookupError = {
118
+ /**
119
+ * The HTTP status `GET /{ip}` would have answered for this entry: `400`
120
+ * for a string that is not an address, `429` for a spent allowance,
121
+ * `500` when the VPN dataset could not be consulted. A `429` here is
122
+ * never a throttle; the whole call is refused instead.
123
+ *
124
+ */
125
+ status: number;
126
+ /**
127
+ * The same message the single lookup carries for that status.
128
+ */
129
+ error: string;
130
+ };
87
131
  /**
88
132
  * What is known about the VPN attribution. Every key is present when the
89
133
  * object is populated, empty values included; the object is `{}` when
@@ -523,9 +567,14 @@ export type OauthMetadata = {
523
567
  grant_types_supported?: Array<string>;
524
568
  code_challenge_methods_supported?: Array<string>;
525
569
  /**
526
- * A client_id may be an https URL serving your client metadata.
570
+ * Always `none`. Every client is public and has no secret.
527
571
  */
528
- client_id_metadata_document_supported?: boolean;
572
+ token_endpoint_auth_methods_supported?: Array<string>;
573
+ /**
574
+ * RFC 9207. A redirect back from the authorization endpoint carries `iss`.
575
+ */
576
+ authorization_response_iss_parameter_supported?: boolean;
577
+ service_documentation?: string;
529
578
  };
530
579
  export type DeviceAuthorizationRequest = {
531
580
  client_id: string;
@@ -552,6 +601,9 @@ export type DeviceAuthorization = {
552
601
  * The same page with the code already filled in.
553
602
  */
554
603
  verification_uri_complete?: string;
604
+ /**
605
+ * Seconds until both codes expire.
606
+ */
555
607
  expires_in: number;
556
608
  /**
557
609
  * Seconds between polls.
@@ -559,26 +611,77 @@ export type DeviceAuthorization = {
559
611
  interval: number;
560
612
  };
561
613
  export type TokenRequest = {
614
+ /**
615
+ * `urn:ietf:params:oauth:grant-type:device_code`, `authorization_code` or `refresh_token`.
616
+ */
562
617
  grant_type: string;
563
618
  client_id: string;
619
+ /**
620
+ * Required by the device code grant.
621
+ */
564
622
  device_code?: string;
623
+ /**
624
+ * Required by the authorization code grant.
625
+ */
565
626
  code?: string;
627
+ /**
628
+ * Required by the authorization code grant.
629
+ */
566
630
  code_verifier?: string;
631
+ /**
632
+ * Authorization code grant: the `redirect_uri` the code was issued against, exactly.
633
+ */
567
634
  redirect_uri?: string;
635
+ /**
636
+ * Required by the refresh token grant.
637
+ */
568
638
  refresh_token?: string;
569
639
  };
570
640
  export type TokenResponse = {
571
641
  access_token: string;
642
+ /**
643
+ * Always `Bearer`.
644
+ */
572
645
  token_type: string;
646
+ /**
647
+ * Seconds until the access token expires.
648
+ */
573
649
  expires_in: number;
650
+ /**
651
+ * Always returned. A refresh consumes the token it presents, so keep this one.
652
+ */
574
653
  refresh_token?: string;
575
654
  /**
576
655
  * What was actually granted, which may be narrower than what was asked for.
577
656
  */
578
657
  scope?: string;
658
+ /**
659
+ * Not part of OAuth. The ID of the API key the person picked when they
660
+ * approved, returned by every grant while this authorization may still
661
+ * read that key back. Absent when no key was picked, or when the
662
+ * person's role no longer allows reading keys back.
663
+ *
664
+ */
665
+ 'mslm:apikey_id'?: string;
666
+ /**
667
+ * Not part of OAuth. The API key itself, so a device ends up holding an
668
+ * ordinary key. Returned by the device code and authorization code
669
+ * grants only, never by a refresh, and only alongside
670
+ * `mslm:apikey_id`. Absent when that key's secret cannot be read back,
671
+ * which is the case for a key created before keys could be shown again
672
+ * in the console; a rotated key can be.
673
+ *
674
+ */
675
+ 'mslm:apikey'?: string;
579
676
  };
580
677
  export type RevokeRequest = {
678
+ /**
679
+ * An access token or a refresh token.
680
+ */
581
681
  token: string;
682
+ /**
683
+ * Accepted and not checked.
684
+ */
582
685
  client_id?: string;
583
686
  };
584
687
  export type OauthError = {
@@ -675,6 +778,50 @@ export type LookupMyIpResponses = {
675
778
  200: LookupResponse;
676
779
  };
677
780
  export type LookupMyIpResponse = LookupMyIpResponses[keyof LookupMyIpResponses];
781
+ export type LookupBatchData = {
782
+ body: BatchLookupRequest;
783
+ path?: never;
784
+ query?: never;
785
+ url: '/batch';
786
+ };
787
+ export type LookupBatchErrors = {
788
+ /**
789
+ * The body is not a batch, or names too few or too many addresses.
790
+ */
791
+ 400: LookupError;
792
+ /**
793
+ * The presented API key is unknown, revoked, or expired.
794
+ */
795
+ 401: LookupError;
796
+ /**
797
+ * The key restricts which source addresses may use it, and this
798
+ * request did not come from one of them.
799
+ *
800
+ */
801
+ 403: LookupError;
802
+ /**
803
+ * The body is larger than any batch of 1000 addresses can be.
804
+ */
805
+ 413: LookupError;
806
+ /**
807
+ * The rate limit refused the whole call. Always transient and always
808
+ * with `Retry-After`; a spent allowance is reported per entry in a
809
+ * `200` instead.
810
+ *
811
+ */
812
+ 429: LookupError;
813
+ };
814
+ export type LookupBatchError = LookupBatchErrors[keyof LookupBatchErrors];
815
+ export type LookupBatchResponses = {
816
+ /**
817
+ * One entry per distinct input string, in `results` or in `errors`.
818
+ * Present fields within a result are those your plan includes; see the
819
+ * tier table in the API description.
820
+ *
821
+ */
822
+ 200: BatchLookupResponse;
823
+ };
824
+ export type LookupBatchResponse = LookupBatchResponses[keyof LookupBatchResponses];
678
825
  export type ListDatabasesData = {
679
826
  body?: never;
680
827
  path?: never;
@@ -819,6 +966,9 @@ export type ListDownloadsData = {
819
966
  body?: never;
820
967
  path?: never;
821
968
  query?: {
969
+ /**
970
+ * How many attempts to return. Clamped to 1 through 200.
971
+ */
822
972
  limit?: number;
823
973
  };
824
974
  url: '/api/v1/database/downloads';
@@ -1134,11 +1284,16 @@ export type OauthDeviceAuthorizationData = {
1134
1284
  };
1135
1285
  export type OauthDeviceAuthorizationErrors = {
1136
1286
  /**
1137
- * `invalid_request`, `invalid_client`, `unauthorized_client`, or
1138
- * `slow_down` when this address has started too many authorizations.
1287
+ * `invalid_request`, `unauthorized_client` when the client may not use
1288
+ * the device flow, or `slow_down` when this address has started too
1289
+ * many authorizations.
1139
1290
  *
1140
1291
  */
1141
1292
  400: OauthError;
1293
+ /**
1294
+ * `invalid_client`: the `client_id` is not registered.
1295
+ */
1296
+ 401: OauthError;
1142
1297
  };
1143
1298
  export type OauthDeviceAuthorizationError = OauthDeviceAuthorizationErrors[keyof OauthDeviceAuthorizationErrors];
1144
1299
  export type OauthDeviceAuthorizationResponses = {
@@ -1188,9 +1343,18 @@ export type OauthTokenErrors = {
1188
1343
  /**
1189
1344
  * An RFC 6749 error. `authorization_pending` and `slow_down` are
1190
1345
  * normal answers while polling a device authorization, not failures.
1346
+ * `access_denied` means the person refused, and `expired_token` that
1347
+ * the device code is no longer valid: it expired, or it was already
1348
+ * exchanged or refused. `invalid_grant` means the code, device code or
1349
+ * refresh token is not valid for this `client_id`. `slow_down` also
1350
+ * answers any grant when this address sends too many requests.
1191
1351
  *
1192
1352
  */
1193
1353
  400: OauthError;
1354
+ /**
1355
+ * `invalid_client`: the `client_id` is not registered.
1356
+ */
1357
+ 401: OauthError;
1194
1358
  };
1195
1359
  export type OauthTokenError = OauthTokenErrors[keyof OauthTokenErrors];
1196
1360
  export type OauthTokenResponses = {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export { VPNDetection, DatabaseApi, DEFAULT_BASE_URL } from './client.js';
2
2
  export type { Options, CacheOptions, LookupOptions, BatchOptions, DownloadsOptions, DownloadDestination, } from './client.js';
3
+ export { OauthApi } from './oauth.js';
4
+ export type { OauthOptions, DeviceAuthorizationOptions, PollDeviceTokenOptions, OauthMetadata, DeviceAuthorization, TokenResponse, } from './oauth.js';
3
5
  export { isBogon } from './bogon.js';
4
- export { VPNDetectionError } from './errors.js';
6
+ export { VPNDetectionError, OauthError, OauthAccessDeniedError, OauthExpiredTokenError, } from './errors.js';
5
7
  export type { ErrorKind } from './errors.js';
6
8
  export type { Result, VpnDetail, ClassDetail, ProxyDetail, LookupResponse, } from './types.js';
7
9
  export { DATABASE_FORMATS, STANDINGS, LICENSE_TYPES } from './types.js';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { VPNDetection, DatabaseApi, DEFAULT_BASE_URL } from './client.js';
2
+ export { OauthApi } from './oauth.js';
2
3
  export { isBogon } from './bogon.js';
3
- export { VPNDetectionError } from './errors.js';
4
+ export { VPNDetectionError, OauthError, OauthAccessDeniedError, OauthExpiredTokenError, } from './errors.js';
4
5
  export { DATABASE_FORMATS, STANDINGS, LICENSE_TYPES } from './types.js';
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK1E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKhD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK1E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EACH,iBAAiB,EAAE,UAAU,EAAE,sBAAsB,EAAE,sBAAsB,GAChF,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,118 @@
1
+ import type { Client } from './generated/client/index.js';
2
+ /** Per-call overrides for one OAuth request. Anything omitted falls back to the client's setting. */
3
+ export interface OauthOptions {
4
+ /** How long one attempt may take before it is abandoned, in milliseconds. */
5
+ timeoutMs?: number;
6
+ }
7
+ /** What a device sign-in asks for. A member left out is left out of the request, never sent empty. */
8
+ export interface DeviceAuthorizationOptions extends OauthOptions {
9
+ /** Space-delimited scopes, sent as given. The server narrows them to what the client may ask for. */
10
+ scope?: string;
11
+ /** The API the tokens are meant for. */
12
+ resource?: string;
13
+ }
14
+ export interface PollDeviceTokenOptions {
15
+ /** How long EACH request of the poll may take, in milliseconds. Never bounds the poll as a whole. */
16
+ timeoutMs?: number;
17
+ /** Aborting it stops the wait and any request in flight, and the poll rejects with its reason. */
18
+ signal?: AbortSignal;
19
+ }
20
+ /** The authorization server's discovery document. No call here needs it: each builds on the base URL. */
21
+ export interface OauthMetadata {
22
+ issuer: string;
23
+ authorization_endpoint: string;
24
+ token_endpoint: string;
25
+ device_authorization_endpoint?: string;
26
+ revocation_endpoint?: string;
27
+ scopes_supported?: string[];
28
+ response_types_supported?: string[];
29
+ grant_types_supported?: string[];
30
+ code_challenge_methods_supported?: string[];
31
+ token_endpoint_auth_methods_supported?: string[];
32
+ authorization_response_iss_parameter_supported?: boolean;
33
+ service_documentation?: string;
34
+ }
35
+ /** A started device sign-in. `expires_in` and `interval` are seconds. */
36
+ export interface DeviceAuthorization {
37
+ device_code: string;
38
+ /** What the person types in at `verification_uri`. */
39
+ user_code: string;
40
+ verification_uri: string;
41
+ /** `verification_uri` with the code already in it, for a program that can open a browser. */
42
+ verification_uri_complete?: string;
43
+ expires_in: number;
44
+ interval: number;
45
+ }
46
+ /**
47
+ * What a completed sign-in or a refresh hands back.
48
+ *
49
+ * `apikey_id` is set when the person picked one of their API keys and may still
50
+ * read it back. `apikey`, the key itself, also needs a sign-in rather than a
51
+ * refresh and a key whose secret can be shown again, so `apikey_id` without
52
+ * `apikey` is normal. An empty `scope` is present.
53
+ */
54
+ export interface TokenResponse {
55
+ access_token: string;
56
+ token_type: string;
57
+ expires_in: number;
58
+ /** Spent by the refresh that presents it, so keep the one each refresh returns. */
59
+ refresh_token?: string;
60
+ scope?: string;
61
+ apikey_id?: string;
62
+ apikey?: string;
63
+ }
64
+ /**
65
+ * Signs a person in on their own machine with the OAuth device flow, so a
66
+ * program can be handed one of their API keys instead of asking them to paste
67
+ * it. Reached through `client.oauth`.
68
+ *
69
+ * Every call takes a client ID, issued on request from support@vpndetection.io.
70
+ * None of these requests carries the client's API key, and none needs one.
71
+ */
72
+ export declare class OauthApi {
73
+ private readonly client;
74
+ private readonly retries;
75
+ private readonly timeoutMs;
76
+ private clock;
77
+ constructor(client: Client, retries: number, timeoutMs: number);
78
+ metadata(options?: OauthOptions): Promise<OauthMetadata>;
79
+ /**
80
+ * Start a device sign-in: show the person `user_code` and `verification_uri`,
81
+ * then hand the answer to `pollDeviceToken`. It consumes nothing, so it is
82
+ * retried like a lookup; a refusal such as `slow_down` is an `OauthError`.
83
+ */
84
+ deviceAuthorization(clientId: string, options?: DeviceAuthorizationOptions): Promise<DeviceAuthorization>;
85
+ /**
86
+ * Ask once whether the person has approved a device sign-in. Until they do,
87
+ * it rejects with an `OauthError` coded `authorization_pending`;
88
+ * `pollDeviceToken` is the loop around it.
89
+ *
90
+ * Never retried: an approved code is spent by the answer carrying the tokens,
91
+ * so a retry after a lost response could only lose them.
92
+ */
93
+ exchangeDeviceCode(clientId: string, deviceCode: string, options?: OauthOptions): Promise<TokenResponse>;
94
+ /**
95
+ * Trade a refresh token for a new pair. The old one is spent whatever happens
96
+ * next, so this is never retried. A refresh names the key the person picked
97
+ * (`apikey_id`) but never reveals it again (`apikey`).
98
+ */
99
+ exchangeRefreshToken(clientId: string, refreshToken: string, options?: OauthOptions): Promise<TokenResponse>;
100
+ /**
101
+ * End a token. A refresh token ends the whole sign-in and every token it
102
+ * issued, which is how a program signs the machine out; an access token ends
103
+ * only itself. The server answers the same for any token, known or not.
104
+ */
105
+ revoke(clientId: string, token: string, options?: OauthOptions): Promise<void>;
106
+ /**
107
+ * Wait for the person to approve a device sign-in, and return its tokens.
108
+ *
109
+ * Waits `device.interval` seconds (5 when that is below 1) before EVERY
110
+ * request, the first included, and 5 more for the rest of the call each time
111
+ * the server answers `slow_down`. Ends at the first answer that is neither:
112
+ * a denial rejects with `OauthAccessDeniedError`, a code that ran out with
113
+ * `OauthExpiredTokenError` - as does outliving `device.expires_in`, counted
114
+ * from this call, with no `status` - and any other failure as it came.
115
+ */
116
+ pollDeviceToken(clientId: string, device: DeviceAuthorization, options?: PollDeviceTokenOptions): Promise<TokenResponse>;
117
+ private exchange;
118
+ }