@atproto/oauth-types 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +26 -0
- package/dist/atproto-loopback-client-metadata.d.ts.map +1 -1
- package/dist/atproto-loopback-client-metadata.js +3 -14
- package/dist/atproto-loopback-client-metadata.js.map +1 -1
- package/dist/index.d.ts +18 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/oauth-access-token.d.ts +4 -0
- package/dist/oauth-access-token.d.ts.map +1 -0
- package/dist/oauth-access-token.js +6 -0
- package/dist/oauth-access-token.js.map +1 -0
- package/dist/oauth-authorization-code-grant-token-request.d.ts +20 -0
- package/dist/oauth-authorization-code-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-authorization-code-grant-token-request.js +17 -0
- package/dist/oauth-authorization-code-grant-token-request.js.map +1 -0
- package/dist/oauth-authorization-request-jar.d.ts +16 -0
- package/dist/oauth-authorization-request-jar.d.ts.map +1 -0
- package/dist/oauth-authorization-request-jar.js +15 -0
- package/dist/oauth-authorization-request-jar.js.map +1 -0
- package/dist/oauth-authorization-request-par.d.ts +122 -0
- package/dist/oauth-authorization-request-par.d.ts.map +1 -0
- package/dist/oauth-authorization-request-par.js +11 -0
- package/dist/oauth-authorization-request-par.js.map +1 -0
- package/dist/{oauth-authentication-request-parameters.d.ts → oauth-authorization-request-parameters.d.ts} +15 -15
- package/dist/oauth-authorization-request-parameters.d.ts.map +1 -0
- package/dist/{oauth-authentication-request-parameters.js → oauth-authorization-request-parameters.js} +15 -16
- package/dist/oauth-authorization-request-parameters.js.map +1 -0
- package/dist/oauth-authorization-request-query.d.ts +128 -0
- package/dist/oauth-authorization-request-query.d.ts.map +1 -0
- package/dist/oauth-authorization-request-query.js +13 -0
- package/dist/oauth-authorization-request-query.js.map +1 -0
- package/dist/oauth-authorization-request-uri.d.ts +10 -0
- package/dist/oauth-authorization-request-uri.d.ts.map +1 -0
- package/dist/oauth-authorization-request-uri.js +9 -0
- package/dist/oauth-authorization-request-uri.js.map +1 -0
- package/dist/oauth-authorization-server-metadata.d.ts +10 -10
- package/dist/oauth-authorization-server-metadata.d.ts.map +1 -1
- package/dist/oauth-authorization-server-metadata.js +5 -1
- package/dist/oauth-authorization-server-metadata.js.map +1 -1
- package/dist/oauth-client-credentials-grant-token-request.d.ts +10 -0
- package/dist/oauth-client-credentials-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-client-credentials-grant-token-request.js +8 -0
- package/dist/oauth-client-credentials-grant-token-request.js.map +1 -0
- package/dist/oauth-client-credentials.d.ts +18 -2
- package/dist/oauth-client-credentials.d.ts.map +1 -1
- package/dist/oauth-client-credentials.js +8 -2
- package/dist/oauth-client-credentials.js.map +1 -1
- package/dist/oauth-client-id-discoverable.d.ts +3 -2
- package/dist/oauth-client-id-discoverable.d.ts.map +1 -1
- package/dist/oauth-client-id-discoverable.js +21 -18
- package/dist/oauth-client-id-discoverable.js.map +1 -1
- package/dist/oauth-client-id-loopback.d.ts +10 -3
- package/dist/oauth-client-id-loopback.d.ts.map +1 -1
- package/dist/oauth-client-id-loopback.js +58 -21
- package/dist/oauth-client-id-loopback.js.map +1 -1
- package/dist/oauth-client-metadata.d.ts +1 -1
- package/dist/oauth-client-metadata.d.ts.map +1 -1
- package/dist/oauth-client-metadata.js +2 -1
- package/dist/oauth-client-metadata.js.map +1 -1
- package/dist/oauth-code-challenge-method.d.ts +3 -0
- package/dist/oauth-code-challenge-method.d.ts.map +1 -0
- package/dist/oauth-code-challenge-method.js +6 -0
- package/dist/oauth-code-challenge-method.js.map +1 -0
- package/dist/oauth-introspection-response.d.ts +20 -0
- package/dist/oauth-introspection-response.d.ts.map +1 -0
- package/dist/oauth-introspection-response.js +3 -0
- package/dist/oauth-introspection-response.js.map +1 -0
- package/dist/oauth-par-response.d.ts +3 -0
- package/dist/oauth-par-response.d.ts.map +1 -1
- package/dist/oauth-par-response.js +1 -0
- package/dist/oauth-par-response.js.map +1 -1
- package/dist/oauth-password-grant-token-request.d.ts +16 -0
- package/dist/oauth-password-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-password-grant-token-request.js +10 -0
- package/dist/oauth-password-grant-token-request.js.map +1 -0
- package/dist/oauth-refresh-token-grant-token-request.d.ts +16 -0
- package/dist/oauth-refresh-token-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-refresh-token-grant-token-request.js +12 -0
- package/dist/oauth-refresh-token-grant-token-request.js.map +1 -0
- package/dist/oauth-refresh-token.d.ts +4 -0
- package/dist/oauth-refresh-token.d.ts.map +1 -0
- package/dist/oauth-refresh-token.js +6 -0
- package/dist/oauth-refresh-token.js.map +1 -0
- package/dist/oauth-request-uri.d.ts +4 -0
- package/dist/oauth-request-uri.d.ts.map +1 -0
- package/dist/oauth-request-uri.js +6 -0
- package/dist/oauth-request-uri.js.map +1 -0
- package/dist/oauth-scope.d.ts +10 -0
- package/dist/oauth-scope.d.ts.map +1 -0
- package/dist/oauth-scope.js +16 -0
- package/dist/oauth-scope.js.map +1 -0
- package/dist/oauth-token-identification.d.ts +13 -0
- package/dist/oauth-token-identification.d.ts.map +1 -0
- package/dist/oauth-token-identification.js +11 -0
- package/dist/oauth-token-identification.js.map +1 -0
- package/dist/oauth-token-request.d.ts +49 -0
- package/dist/oauth-token-request.d.ts.map +1 -0
- package/dist/oauth-token-request.js +15 -0
- package/dist/oauth-token-request.js.map +1 -0
- package/dist/util.d.ts +2 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +34 -3
- package/dist/util.js.map +1 -1
- package/package.json +1 -1
- package/src/atproto-loopback-client-metadata.ts +7 -20
- package/src/index.ts +18 -5
- package/src/oauth-access-token.ts +4 -0
- package/src/oauth-authorization-code-grant-token-request.ts +18 -0
- package/src/oauth-authorization-request-jar.ts +16 -0
- package/src/oauth-authorization-request-par.ts +13 -0
- package/src/{oauth-authentication-request-parameters.ts → oauth-authorization-request-parameters.ts} +20 -21
- package/src/oauth-authorization-request-query.ts +15 -0
- package/src/oauth-authorization-request-uri.ts +11 -0
- package/src/oauth-authorization-server-metadata.ts +5 -1
- package/src/oauth-client-credentials-grant-token-request.ts +9 -0
- package/src/oauth-client-credentials.ts +21 -1
- package/src/oauth-client-id-discoverable.ts +29 -26
- package/src/oauth-client-id-loopback.ts +78 -30
- package/src/oauth-client-metadata.ts +2 -1
- package/src/oauth-code-challenge-method.ts +3 -0
- package/src/oauth-introspection-response.ts +23 -0
- package/src/oauth-par-response.ts +1 -0
- package/src/oauth-password-grant-token-request.ts +11 -0
- package/src/oauth-refresh-token-grant-token-request.ts +13 -0
- package/src/oauth-refresh-token.ts +4 -0
- package/src/oauth-request-uri.ts +5 -0
- package/src/oauth-scope.ts +15 -0
- package/src/oauth-token-identification.ts +12 -0
- package/src/oauth-token-request.ts +14 -0
- package/src/util.ts +41 -1
- package/dist/access-token.d.ts +0 -4
- package/dist/access-token.d.ts.map +0 -1
- package/dist/access-token.js +0 -6
- package/dist/access-token.js.map +0 -1
- package/dist/oauth-authentication-request-parameters.d.ts.map +0 -1
- package/dist/oauth-authentication-request-parameters.js.map +0 -1
- package/dist/oauth-client-id-url.d.ts +0 -3
- package/dist/oauth-client-id-url.d.ts.map +0 -1
- package/dist/oauth-client-id-url.js +0 -21
- package/dist/oauth-client-id-url.js.map +0 -1
- package/dist/oauth-client-identification.d.ts +0 -31
- package/dist/oauth-client-identification.d.ts.map +0 -1
- package/dist/oauth-client-identification.js +0 -12
- package/dist/oauth-client-identification.js.map +0 -1
- package/src/access-token.ts +0 -4
- package/src/oauth-client-id-url.ts +0 -25
- package/src/oauth-client-identification.ts +0 -14
@@ -0,0 +1,15 @@
|
|
1
|
+
import { z } from 'zod'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* A space separated list of most non-control ASCII characters except backslash
|
5
|
+
* and double quote.
|
6
|
+
*
|
7
|
+
* @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-11#section-1.4.1}
|
8
|
+
*/
|
9
|
+
export const oauthScopeSchema = z
|
10
|
+
.string()
|
11
|
+
// scope = scope-token *( SP scope-token )
|
12
|
+
// scope-token = 1*( %x21 / %x23-5B / %x5D-7E )
|
13
|
+
.regex(/^[\x21\x23-\x5B\x5D-\x7E]+(?: [\x21\x23-\x5B\x5D-\x7E]+)*$/)
|
14
|
+
|
15
|
+
export type OAuthScope = z.infer<typeof oauthScopeSchema>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { z } from 'zod'
|
2
|
+
import { oauthAccessTokenSchema } from './oauth-access-token.js'
|
3
|
+
import { oauthRefreshTokenSchema } from './oauth-refresh-token.js'
|
4
|
+
|
5
|
+
export const oauthTokenIdentificationSchema = z.object({
|
6
|
+
token: z.union([oauthAccessTokenSchema, oauthRefreshTokenSchema]),
|
7
|
+
token_type_hint: z.enum(['access_token', 'refresh_token']).optional(),
|
8
|
+
})
|
9
|
+
|
10
|
+
export type OAuthTokenIdentification = z.infer<
|
11
|
+
typeof oauthTokenIdentificationSchema
|
12
|
+
>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { z } from 'zod'
|
2
|
+
import { oauthAuthorizationCodeGrantTokenRequestSchema } from './oauth-authorization-code-grant-token-request.js'
|
3
|
+
import { oauthClientCredentialsGrantTokenRequestSchema } from './oauth-client-credentials-grant-token-request.js'
|
4
|
+
import { oauthPasswordGrantTokenRequestSchema } from './oauth-password-grant-token-request.js'
|
5
|
+
import { oauthRefreshTokenGrantTokenRequestSchema } from './oauth-refresh-token-grant-token-request.js'
|
6
|
+
|
7
|
+
export const oauthTokenRequestSchema = z.discriminatedUnion('grant_type', [
|
8
|
+
oauthAuthorizationCodeGrantTokenRequestSchema,
|
9
|
+
oauthRefreshTokenGrantTokenRequestSchema,
|
10
|
+
oauthPasswordGrantTokenRequestSchema,
|
11
|
+
oauthClientCredentialsGrantTokenRequestSchema,
|
12
|
+
])
|
13
|
+
|
14
|
+
export type OAuthTokenRequest = z.infer<typeof oauthTokenRequestSchema>
|
package/src/util.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export function
|
1
|
+
export function isHostnameIP(hostname: string) {
|
2
2
|
// IPv4
|
3
3
|
if (hostname.match(/^\d+\.\d+\.\d+\.\d+$/)) return true
|
4
4
|
|
@@ -26,3 +26,43 @@ export function safeUrl(input: URL | string): URL | null {
|
|
26
26
|
return null
|
27
27
|
}
|
28
28
|
}
|
29
|
+
|
30
|
+
export function extractUrlPath(url) {
|
31
|
+
// Extracts the path from a URL, without relying on the URL constructor
|
32
|
+
// (because it normalizes the URL)
|
33
|
+
const endOfProtocol = url.startsWith('https://')
|
34
|
+
? 8
|
35
|
+
: url.startsWith('http://')
|
36
|
+
? 7
|
37
|
+
: -1
|
38
|
+
if (endOfProtocol === -1) {
|
39
|
+
throw new TypeError('URL must use the "https:" or "http:" protocol')
|
40
|
+
}
|
41
|
+
|
42
|
+
const hashIdx = url.indexOf('#', endOfProtocol)
|
43
|
+
const questionIdx = url.indexOf('?', endOfProtocol)
|
44
|
+
|
45
|
+
const queryStrIdx =
|
46
|
+
questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx)
|
47
|
+
? questionIdx
|
48
|
+
: -1
|
49
|
+
|
50
|
+
const pathEnd =
|
51
|
+
hashIdx === -1
|
52
|
+
? queryStrIdx === -1
|
53
|
+
? url.length
|
54
|
+
: queryStrIdx
|
55
|
+
: queryStrIdx === -1
|
56
|
+
? hashIdx
|
57
|
+
: Math.min(hashIdx, queryStrIdx)
|
58
|
+
|
59
|
+
const slashIdx = url.indexOf('/', endOfProtocol)
|
60
|
+
|
61
|
+
const pathStart = slashIdx === -1 || slashIdx > pathEnd ? pathEnd : slashIdx
|
62
|
+
|
63
|
+
if (endOfProtocol === pathStart) {
|
64
|
+
throw new TypeError('URL must contain a host')
|
65
|
+
}
|
66
|
+
|
67
|
+
return url.substring(pathStart, pathEnd)
|
68
|
+
}
|
package/dist/access-token.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"access-token.d.ts","sourceRoot":"","sources":["../src/access-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB,aAAoB,CAAA;AAClD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
package/dist/access-token.js
DELETED
package/dist/access-token.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"access-token.js","sourceRoot":"","sources":["../src/access-token.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"oauth-authentication-request-parameters.d.ts","sourceRoot":"","sources":["../src/oauth-authentication-request-parameters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiErD;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKH,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,0CAA0C,CAClD,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"oauth-authentication-request-parameters.js","sourceRoot":"","sources":["../src/oauth-authentication-request-parameters.ts"],"names":[],"mappings":";;;AAAA,sCAA8C;AAC9C,6BAAuB;AAEvB,qFAAkF;AAClF,6DAA0D;AAC1D,qEAAkE;AAClE,yEAAsE;AACtE,2EAAwE;AACxE,+DAA4D;AAE5D;;GAEG;AACU,QAAA,0CAA0C,GAAG,OAAC,CAAC,MAAM,CAAC;IACjE,SAAS,EAAE,wCAAmB;IAE9B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE/B,aAAa,EAAE,gDAAuB;IAEtC,kCAAkC;IAClC,aAAa,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE;IAEpE,OAAO;IACP,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,qBAAqB,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAE3E,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAEzC,+EAA+E;IAC/E,gDAAgD;IAChD,+CAA+C;IAC/C,sEAAsE;IACtE,KAAK,EAAE,OAAC;SACL,MAAM,EAAE;SACR,KAAK,CAAC,oDAAoD,CAAC;SAC3D,QAAQ,EAAE;IAEb,OAAO;IAEP,0EAA0E;IAC1E,wEAAwE;IACxE,2EAA2E;IAC3E,6EAA6E;IAC7E,4EAA4E;IAC5E,yEAAyE;IACzE,2CAA2C;IAC3C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAE3C,MAAM,EAAE,OAAC;SACN,MAAM,CACL,0CAAoB,EACpB,OAAC,CAAC,MAAM,CACN,oDAAyB,EACzB,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,sDAA0B,CAAC,CAAC,CACvD,CACF;SACA,QAAQ,EAAE;IAEb,8EAA8E;IAC9E,uCAAuC;IACvC,iDAAiD;IAEjD,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAExC,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,KAAK,CAAC,gDAAgD,CAAC,CAAC,cAAc;SACtE,QAAQ,EAAE;IAEb,iEAAiE;IACjE,aAAa,EAAE,qBAAe,CAAC,QAAQ,EAAE;IAEzC,oCAAoC;IACpC,OAAO,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;IAEtD;;;;;OAKG;IACH,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE;IAEzE,gDAAgD;IAChD,qBAAqB,EAAE,gEAA+B,CAAC,QAAQ,EAAE;CAClE,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"oauth-client-id-url.d.ts","sourceRoot":"","sources":["../src/oauth-client-id-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,GAAG,GAAG,CAsBlE"}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.parseOAuthClientIdUrl = void 0;
|
4
|
-
function parseOAuthClientIdUrl(clientId) {
|
5
|
-
if (clientId.endsWith('/')) {
|
6
|
-
throw new TypeError('ClientID must not end with a trailing slash');
|
7
|
-
}
|
8
|
-
const url = new URL(clientId);
|
9
|
-
if (url.protocol !== 'https:' && url.protocol !== 'http:') {
|
10
|
-
throw new TypeError('ClientID must use the "https:" or "http:" protocol');
|
11
|
-
}
|
12
|
-
url.searchParams.sort();
|
13
|
-
// URL constructor normalizes the URL, so we need to compare the canonical form
|
14
|
-
const canonicalUri = url.pathname === '/' ? url.origin + url.search : url.href;
|
15
|
-
if (canonicalUri !== clientId) {
|
16
|
-
throw new TypeError(`ClientID must be in canonical form ("${canonicalUri}", got "${clientId}")`);
|
17
|
-
}
|
18
|
-
return url;
|
19
|
-
}
|
20
|
-
exports.parseOAuthClientIdUrl = parseOAuthClientIdUrl;
|
21
|
-
//# sourceMappingURL=oauth-client-id-url.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"oauth-client-id-url.js","sourceRoot":"","sources":["../src/oauth-client-id-url.ts"],"names":[],"mappings":";;;AAEA,SAAgB,qBAAqB,CAAC,QAAuB;IAC3D,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CAAC,6CAA6C,CAAC,CAAA;IACpE,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;IAE7B,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAC1D,MAAM,IAAI,SAAS,CAAC,oDAAoD,CAAC,CAAA;IAC3E,CAAC;IAED,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IAEvB,+EAA+E;IAC/E,MAAM,YAAY,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAA;IAC9E,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,SAAS,CACjB,wCAAwC,YAAY,WAAW,QAAQ,IAAI,CAC5E,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC;AAtBD,sDAsBC"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
export declare const oauthClientIdentificationSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
3
|
-
client_id: z.ZodString;
|
4
|
-
client_assertion_type: z.ZodLiteral<"urn:ietf:params:oauth:client-assertion-type:jwt-bearer">;
|
5
|
-
client_assertion: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `${string}.${string}.${string}`, string>;
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
7
|
-
client_id: string;
|
8
|
-
client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
|
9
|
-
client_assertion: `${string}.${string}.${string}`;
|
10
|
-
}, {
|
11
|
-
client_id: string;
|
12
|
-
client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
|
13
|
-
client_assertion: string;
|
14
|
-
}>, z.ZodObject<{
|
15
|
-
client_id: z.ZodString;
|
16
|
-
client_secret: z.ZodString;
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
18
|
-
client_id: string;
|
19
|
-
client_secret: string;
|
20
|
-
}, {
|
21
|
-
client_id: string;
|
22
|
-
client_secret: string;
|
23
|
-
}>]>, z.ZodObject<{
|
24
|
-
client_id: z.ZodString;
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
26
|
-
client_id: string;
|
27
|
-
}, {
|
28
|
-
client_id: string;
|
29
|
-
}>]>;
|
30
|
-
export type OAuthClientIdentification = z.infer<typeof oauthClientIdentificationSchema>;
|
31
|
-
//# sourceMappingURL=oauth-client-identification.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"oauth-client-identification.d.ts","sourceRoot":"","sources":["../src/oauth-client-identification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI1C,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAA"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.oauthClientIdentificationSchema = void 0;
|
4
|
-
const zod_1 = require("zod");
|
5
|
-
const oauth_client_id_js_1 = require("./oauth-client-id.js");
|
6
|
-
const oauth_client_credentials_js_1 = require("./oauth-client-credentials.js");
|
7
|
-
exports.oauthClientIdentificationSchema = zod_1.z.union([
|
8
|
-
oauth_client_credentials_js_1.oauthClientCredentialsSchema,
|
9
|
-
// Must be last since it is less specific
|
10
|
-
zod_1.z.object({ client_id: oauth_client_id_js_1.oauthClientIdSchema }),
|
11
|
-
]);
|
12
|
-
//# sourceMappingURL=oauth-client-identification.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"oauth-client-identification.js","sourceRoot":"","sources":["../src/oauth-client-identification.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEvB,6DAA0D;AAC1D,+EAA4E;AAE/D,QAAA,+BAA+B,GAAG,OAAC,CAAC,KAAK,CAAC;IACrD,0DAA4B;IAC5B,yCAAyC;IACzC,OAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,wCAAmB,EAAE,CAAC;CAC7C,CAAC,CAAA"}
|
package/src/access-token.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import { OAuthClientId } from './oauth-client-id.js'
|
2
|
-
|
3
|
-
export function parseOAuthClientIdUrl(clientId: OAuthClientId): URL {
|
4
|
-
if (clientId.endsWith('/')) {
|
5
|
-
throw new TypeError('ClientID must not end with a trailing slash')
|
6
|
-
}
|
7
|
-
|
8
|
-
const url = new URL(clientId)
|
9
|
-
|
10
|
-
if (url.protocol !== 'https:' && url.protocol !== 'http:') {
|
11
|
-
throw new TypeError('ClientID must use the "https:" or "http:" protocol')
|
12
|
-
}
|
13
|
-
|
14
|
-
url.searchParams.sort()
|
15
|
-
|
16
|
-
// URL constructor normalizes the URL, so we need to compare the canonical form
|
17
|
-
const canonicalUri = url.pathname === '/' ? url.origin + url.search : url.href
|
18
|
-
if (canonicalUri !== clientId) {
|
19
|
-
throw new TypeError(
|
20
|
-
`ClientID must be in canonical form ("${canonicalUri}", got "${clientId}")`,
|
21
|
-
)
|
22
|
-
}
|
23
|
-
|
24
|
-
return url
|
25
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import { z } from 'zod'
|
2
|
-
|
3
|
-
import { oauthClientIdSchema } from './oauth-client-id.js'
|
4
|
-
import { oauthClientCredentialsSchema } from './oauth-client-credentials.js'
|
5
|
-
|
6
|
-
export const oauthClientIdentificationSchema = z.union([
|
7
|
-
oauthClientCredentialsSchema,
|
8
|
-
// Must be last since it is less specific
|
9
|
-
z.object({ client_id: oauthClientIdSchema }),
|
10
|
-
])
|
11
|
-
|
12
|
-
export type OAuthClientIdentification = z.infer<
|
13
|
-
typeof oauthClientIdentificationSchema
|
14
|
-
>
|