Skip to content

Commit 037762e

Browse files
authored
chore: add markdown plugin (#641)
docs: adds and updates some docs comments chore: adds platform client and updates more docs Signed-off-by: Eugene Yakhnenko <[email protected]>
1 parent a6b9879 commit 037762e

File tree

10 files changed

+456
-157
lines changed

10 files changed

+456
-157
lines changed

lib/package-lock.json

Lines changed: 129 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
"build:watch": "tsc --watch",
7070
"clean": "rm -rf {build,coverage,dist,tests/mocha/dist}",
7171
"coverage:merge": "for x in mocha wtr; do cp coverage/$x/coverage-final.json coverage/$x.json; done; nyc report --reporter text --reporter lcov -t coverage --lines 75 --statements 75 --branches 70 --functions 65 --check-coverage >coverage/coverage.txt",
72-
"doc": "typedoc --out dist/docs src/index.ts",
72+
"doc": "typedoc --out dist/docs src/index.ts --customCss ./typedoc-theme.css",
73+
"doc:md": "typedoc --plugin typedoc-plugin-markdown --out dist/docs-md src/index.ts",
7374
"format": "prettier --write \"{src,tdf3,tests}/**/*.ts\"",
7475
"license-check": "license-checker-rseidelsohn --production --onlyAllow 'Apache-2.0; BSD; CC-BY-4.0; ISC; MIT'",
7576
"lint": "eslint ./src/**/*.ts ./tdf3/**/*.ts ./tests/**/*.ts",
@@ -133,7 +134,8 @@
133134
"process": "^0.11.10",
134135
"sinon": "~19.0.2",
135136
"tsconfig-paths": "^4.2.0",
136-
"typedoc": "^0.27.9",
137+
"typedoc": "^0.28.5",
138+
"typedoc-plugin-markdown": "^4.7.0",
137139
"typescript": "^5.8.2",
138140
"typescript-eslint": "^8.26.0",
139141
"webpack": "^5.98.0",

lib/src/access.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ export async function noteInvalidPublicKey(url: URL, r: Promise<CryptoKey>): Pro
136136
}
137137
}
138138

139+
/**
140+
* Fetches the key access servers for a given platform URL.
141+
* @param platformUrl The platform URL to fetch key access servers for.
142+
* @param authProvider The authentication provider to use for the request.
143+
* @returns A promise that resolves to an OriginAllowList.
144+
*/
139145
export async function fetchKeyAccessServers(
140146
platformUrl: string,
141147
authProvider: AuthProvider
@@ -190,6 +196,15 @@ const origin = (u: string): string => {
190196
}
191197
};
192198

199+
/**
200+
* Manages a list of origins that are allowed to access the Key Access Server (KAS).
201+
* @origins A list of origins that are allowed to access the KAS.
202+
* @allowAll If true, all origins are allowed to access the KAS.
203+
* If false, only the origins in the list are allowed to access the KAS.
204+
* @description This class is used to manage a list of origins that are allowed to access the KAS.
205+
* It validates the URLs and provides a method to check if a given URL is allowed.
206+
* It is used to ensure that only authorized origins can access the KAS.
207+
*/
193208
export class OriginAllowList {
194209
origins: string[];
195210
allowAll: boolean;

lib/src/auth/oidc-refreshtoken-provider.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@ import { ConfigurationError } from '../errors.js';
22
import { type AuthProvider, type HttpRequest } from './auth.js';
33
import { AccessToken, type RefreshTokenCredentials } from './oidc.js';
44

5+
/**
6+
* An AuthProvider that uses an OIDC refresh token to obtain an access token.
7+
* It exchanges the refresh token for an access token and uses that to augment HTTP requests with credentials.
8+
* @example
9+
* ```ts
10+
* import { OIDCRefreshTokenProvider } from '@opentdf/sdk';
11+
* await AuthProviders.refreshAuthProvider({
12+
clientId: 'my-client-id',
13+
exchange: 'refresh',
14+
refreshToken: 'refresh-token-from-oidc-provider',
15+
oidcOrigin: 'https://example.oidc.provider.com',
16+
});
17+
```
18+
*/
519
export class OIDCRefreshTokenProvider implements AuthProvider {
620
oidcAuth: AccessToken;
721
refreshToken?: string;

lib/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export { type AuthProvider, type HttpMethod, HttpRequest, withHeaders } from './
22
export * as AuthProviders from './auth/providers.js';
33
export { attributeFQNsAsValues } from './policy/api.js';
44
export { version, clientType, tdfSpecVersion } from './version.js';
5+
export { PlatformClient, type PlatformClientOptions, type PlatformServices } from './platform.js';
56
export * from './opentdf.js';
67
export * from './seekable.js';
78
export * from '../tdf3/src/models/index.js';

0 commit comments

Comments
 (0)