Skip to content

Commit

Permalink
tidy up package.json and READMEs (#1649)
Browse files Browse the repository at this point in the history
* identity: README example and tidy

* tidy up package metadata (package.json files)

* updated README headers/stubs for several packages

* crypto: longer README, with usage

* syntax: tweak README

* Apply suggestions from code review

Co-authored-by: Eric Bailey <[email protected]>
Co-authored-by: devin ivy <[email protected]>

---------

Co-authored-by: Eric Bailey <[email protected]>
Co-authored-by: devin ivy <[email protected]>
  • Loading branch information
3 people authored Sep 22, 2023
1 parent 1487c9f commit 584dea5
Show file tree
Hide file tree
Showing 27 changed files with 347 additions and 106 deletions.
19 changes: 13 additions & 6 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
{
"name": "@atproto/api",
"version": "0.6.15",
"license": "MIT",
"description": "Client library for atproto and Bluesky",
"keywords": [
"atproto",
"bluesky",
"api"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/api"
},
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
Expand All @@ -16,12 +29,6 @@
"bench": "jest --config jest.bench.config.js",
"bench:profile": "node --inspect-brk ../../node_modules/.bin/jest --config jest.bench.config.js"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"directory": "packages/api"
},
"dependencies": {
"@atproto/common-web": "workspace:^",
"@atproto/lexicon": "workspace:^",
Expand Down
18 changes: 12 additions & 6 deletions packages/aws/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
"name": "@atproto/aws",
"version": "0.1.1",
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/src/index.d.ts"
},
"license": "MIT",
"description": "Shared AWS cloud API helpers for atproto services",
"keywords": [
"atproto",
"aws"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/aws"
},
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/src/index.d.ts"
},
"scripts": {
"build": "node ./build.js",
"postbuild": "tsc --build tsconfig.build.json",
Expand Down
11 changes: 9 additions & 2 deletions packages/bsky/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Bsky App View
# @atproto/bsky: Bluesky AppView Service

The Bsky App View. This contains the indexers and XRPC methods for reading data from the Bsky application.
TypeScript implementation of the `app.bsky` Lexicons backing the https://bsky.app microblogging application.

[![NPM](https://img.shields.io/npm/v/@atproto/bsky)](https://www.npmjs.com/package/@atproto/bsky)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

## License

MIT License
8 changes: 7 additions & 1 deletion packages/bsky/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"name": "@atproto/bsky",
"version": "0.0.6",
"license": "MIT",
"description": "Reference implementation of app.bsky App View (Bluesky API)",
"keywords": [
"atproto",
"bluesky"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/bsky"
},
"main": "src/index.ts",
Expand Down
11 changes: 9 additions & 2 deletions packages/common-web/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# ATP Common Library for Web
# @atproto/common-web

A library containing code which is shared between web-friendly ATP packages.
Shared TypeScript code for other `@atproto/*` packages, which is web-friendly (runs in-browser).

[![NPM](https://img.shields.io/npm/v/@atproto/common)](https://www.npmjs.com/package/@atproto/common-web)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

## License

MIT License
17 changes: 11 additions & 6 deletions packages/common-web/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"name": "@atproto/common-web",
"version": "0.2.0",
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"license": "MIT",
"description": "Shared web-platform-friendly code for atproto libraries",
"keywords": [
"atproto"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/common-web"
},
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"scripts": {
"test": "jest",
"build": "node ./build.js",
Expand Down
11 changes: 9 additions & 2 deletions packages/common/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# ATP Common Library
# @atproto/common

A library containing code which is shared between ATP packages.
Shared TypeScript code for other `@atproto/*` packages. This package is oriented towards writing servers, and is not designed to be browser-compatible.

[![NPM](https://img.shields.io/npm/v/@atproto/common)](https://www.npmjs.com/package/@atproto/common)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

## License

MIT License
17 changes: 11 additions & 6 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"name": "@atproto/common",
"version": "0.3.0",
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"license": "MIT",
"description": "Shared web-platform-friendly code for atproto libraries",
"keywords": [
"atproto"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/common"
},
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"scripts": {
"test": "jest",
"build": "node ./build.js",
Expand Down
47 changes: 45 additions & 2 deletions packages/crypto/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# ATP Crypto Library
# @atproto/crypto

ATP's common cryptographic operations.
TypeScript library providing basic cryptographic helpers as needed in [atproto](https://atproto.com).

[![NPM](https://img.shields.io/npm/v/@atproto/crypto)](https://www.npmjs.com/package/@atproto/crypto)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

This package implements the two currently supported cryptographic systems:

- P-256 elliptic curve: aka "NIST P-256", aka secp256r1 (note the r), aka prime256v1
- K-256 elliptic curve: aka "NIST K-256", aka secp256k1 (note the k)

The details of cryptography in atproto are described in [the specification](https://atproto.com/specs/cryptography). This includes string encodings, validity of "low-S" signatures, byte representation "compression", hashing, and more.

## Usage

```typescript
import { verifySignature, Secp256k1Keypair, P256Keypair } from '@atproto/crypto'

// generate a new random K-256 private key
const keypair = await Secp256k1Keypair.create({ exportable: true })

// sign binary data, resulting signature bytes.
// SHA-256 hash of data is what actually gets signed.
// signature output is often base64-encoded.
const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8])
const sig = await keypair.sign(data)

// serialize the public key as a did:key string, which includes key type metadata
const pubDidKey = keypair.did()
console.log(pubDidKey)

// output would look something like: 'did:key:zQ3shVRtgqTRHC7Lj4DYScoDgReNpsDp3HBnuKBKt1FSXKQ38'

// verify signature using public key
const ok = verifySignature(pubDidKey, data, sig)
if (!ok) {
throw new Error('Uh oh, something is fishy')
} else {
console.log('Success')
}
```

## License

MIT License
18 changes: 12 additions & 6 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
"name": "@atproto/crypto",
"version": "0.2.2",
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"license": "MIT",
"description": "Library for cryptographic keys and signing in atproto",
"keywords": [
"atproto",
"cryptography"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/crypto"
},
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"scripts": {
"test": "jest ",
"build": "node ./build.js",
Expand Down
9 changes: 8 additions & 1 deletion packages/dev-env/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# ATP Developer Environment
# @atproto/dev-env: Local Developer Environment

A command-line application for developers to construct and manage development environments.

[![NPM](https://img.shields.io/npm/v/@atproto/dev-env)](https://www.npmjs.com/package/@atproto/dev-env)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

## REPL API

The following methods are available in the REPL.
Expand All @@ -25,3 +28,7 @@ Create a new user.
### `user(handle: string): ServiceClient`

Get the `ServiceClient` for the given user.

## License

MIT License
17 changes: 11 additions & 6 deletions packages/dev-env/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{
"name": "@atproto/dev-env",
"version": "0.2.6",
"license": "MIT",
"description": "Local development environment helper for atproto development",
"keywords": [
"atproto"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/dev-env"
},
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"bin": "dist/bin.js",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"directory": "packages/dev-env"
},
"scripts": {
"build": "node ./build.js",
"postbuild": "tsc --build tsconfig.build.json",
Expand Down
41 changes: 39 additions & 2 deletions packages/identity/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# ATP DID Resolver
# @atproto/identity

A library for resolving ATP's Decentralized ID methods.
TypeScript library for decentralized identities in [atproto](https://atproto.com) using DIDs and handles

[![NPM](https://img.shields.io/npm/v/@atproto/identity)](https://www.npmjs.com/package/@atproto/identity)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

## Example

Resolving a Handle and verifying against DID document:

```typescript
const didres = new DidResolver({})
const hdlres = new HandleResolver({})

const handle = 'atproto.com'
const did = await hdlres.resolve(handle)

if (did == undefined) {
throw new Error('expected handle to resolve')
}
console.log(did) // did:plc:ewvi7nxzyoun6zhxrhs64oiz

const doc = await didres.resolve(did)
console.log(doc)

// additional resolutions of same DID will be cached for some time, unless forceRefresh flag is used
const doc2 = await didres.resolve(did, true)

// helper methods use the same cache
const data = await didres.resolveAtprotoData(did)

if (data.handle != handle) {
throw new Error('invalid handle (did not match DID document)')
}
```

## License

MIT License
19 changes: 13 additions & 6 deletions packages/identity/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{
"name": "@atproto/identity",
"version": "0.2.0",
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"license": "MIT",
"description": "Library for decentralized identities in atproto using DIDs and handles",
"keywords": [
"atproto",
"did",
"identity"
],
"homepage": "https://atproto.com",
"repository": {
"type": "git",
"url": "https://github.com/bluesky-social/atproto.git",
"url": "https://github.com/bluesky-social/atproto",
"directory": "packages/identity"
},
"main": "src/index.ts",
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts"
},
"scripts": {
"test": "jest",
"test:log": "cat test.log | pino-pretty",
Expand Down
Loading

0 comments on commit 584dea5

Please sign in to comment.