Skip to content

Commit

Permalink
identity docs lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Oct 7, 2023
1 parent 2d13d2f commit 69f2703
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 28 additions & 33 deletions packages/identity/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -70,23 +69,22 @@

### :gear: verificationMethod

| Constant | Type |
| ---------- | ---------- |
| Constant | Type |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `verificationMethod` | `ZodObject<{ id: ZodString; type: ZodString; controller: ZodString; publicKeyMultibase: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { ...; }, { ...; }>` |

### :gear: service

| Constant | Type |
| ---------- | ---------- |
| Constant | Type |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `service` | `ZodObject<{ id: ZodString; type: ZodString; serviceEndpoint: ZodUnion<[ZodString, ZodRecord<ZodString, ZodUnknown>]>; }, "strip", ZodTypeAny, { ...; }, { ...; }>` |

### :gear: didDocument

| Constant | Type |
| ---------- | ---------- |
| Constant | Type |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `didDocument` | `ZodObject<{ id: ZodString; alsoKnownAs: ZodOptional<ZodArray<ZodString, "many">>; verificationMethod: ZodOptional<ZodArray<ZodObject<{ id: ZodString; type: ZodString; controller: ZodString; publicKeyMultibase: ZodOptional<...>; }, "strip", ZodTypeAny, { ...; }, { ...; }>, "many">>; service: ZodOptional<...>; }, "str...` |


## :factory: DidNotFoundError

## :factory: PoorlyFormattedDidError
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 69f2703

Please sign in to comment.