From 69f2703f528aae229908b7e28fdb2215cf1e93e8 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Fri, 6 Oct 2023 18:56:25 -0700 Subject: [PATCH] identity docs lint --- Makefile | 2 +- packages/identity/API.md | 61 ++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index eb8cad38356..d7a1720a60e 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ codegen: ## Re-generate packages from lexicon/ files .PHONY: docs docs: ## Re-generate API documentation (eg, READMEs) pnpm run --filter @atproto/identity docs - pnpm prettier --write packages/identity/README.md + pnpm prettier --write packages/identity/API.md .PHONY: lint lint: ## Run style checks and verify syntax diff --git a/packages/identity/API.md b/packages/identity/API.md index 8164df0b70a..e7118e9b102 100644 --- a/packages/identity/API.md +++ b/packages/identity/API.md @@ -15,53 +15,52 @@ ### :gear: getDid -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getDid` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => string` | ### :gear: getKey -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getKey` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => string` | ### :gear: getHandle -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getHandle` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => string` | ### :gear: getPds -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getPds` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => string` | ### :gear: getFeedGen -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getFeedGen` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => string` | ### :gear: getNotif -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getNotif` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => string` | ### :gear: parseToAtprotoDocument -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `parseToAtprotoDocument` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => Partial<...>` | ### :gear: ensureAtpDocument -| Function | Type | -| ---------- | ---------- | +| Function | Type | +| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ensureAtpDocument` | `(doc: { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }) => AtprotoData` | - ## :wrench: Constants - [verificationMethod](#gear-verificationmethod) @@ -70,23 +69,22 @@ ### :gear: verificationMethod -| Constant | Type | -| ---------- | ---------- | +| Constant | Type | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `verificationMethod` | `ZodObject<{ id: ZodString; type: ZodString; controller: ZodString; publicKeyMultibase: ZodOptional; }, "strip", ZodTypeAny, { ...; }, { ...; }>` | ### :gear: service -| Constant | Type | -| ---------- | ---------- | +| Constant | Type | +| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `service` | `ZodObject<{ id: ZodString; type: ZodString; serviceEndpoint: ZodUnion<[ZodString, ZodRecord]>; }, "strip", ZodTypeAny, { ...; }, { ...; }>` | ### :gear: didDocument -| Constant | Type | -| ---------- | ---------- | +| Constant | Type | +| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `didDocument` | `ZodObject<{ id: ZodString; alsoKnownAs: ZodOptional>; verificationMethod: ZodOptional; }, "strip", ZodTypeAny, { ...; }, { ...; }>, "many">>; service: ZodOptional<...>; }, "str...` | - ## :factory: DidNotFoundError ## :factory: PoorlyFormattedDidError @@ -109,11 +107,10 @@ Calling code must validate handle/DID pariing against the DID document itself. #### :gear: parseDnsResult -| Method | Type | -| ---------- | ---------- | +| Method | Type | +| ---------------- | ---------------------------------------- | | `parseDnsResult` | `(chunkedResults: string[][]) => string` | - ## :factory: BaseResolver ### Methods @@ -126,16 +123,14 @@ Throws if argument is not a valid DidDocument. Only checks type structure, does not parse internal fields. -| Method | Type | -| ---------- | ---------- | +| Method | Type | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `validateDidDoc` | `(did: string, val: unknown) => { id?: string; alsoKnownAs?: string[]; verificationMethod?: { id?: string; type?: string; controller?: string; publicKeyMultibase?: string; }[]; service?: { id?: string; type?: string; serviceEndpoint?: string or Record<...>; }[]; }` | Parameters: -* `did`: - DID to verify against field in the document itself -* `val`: - object to verify structure as a DidDocument - - +- `did`: - DID to verify against field in the document itself +- `val`: - object to verify structure as a DidDocument ## :factory: DidWebResolver