-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tidy up package.json and READMEs (#1649)
* 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
1 parent
1487c9f
commit 584dea5
Showing
27 changed files
with
347 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.