Skip to content

Commit

Permalink
Update package READMEs (#256)
Browse files Browse the repository at this point in the history
* chore(hsu): update README

* chore(open-payments): update README

* chore(open-payments): update README

* chore: update repository link in package.jsons

* chore(openapi): update README

* chore: update repository & homepage for packages

* chore: add changeset

* chore: format

* chore: append .git to repository fields
  • Loading branch information
mkurapov authored Mar 24, 2023
1 parent e209555 commit 842630e
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 40 deletions.
7 changes: 7 additions & 0 deletions .changeset/strange-toys-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@interledger/http-signature-utils': patch
'@interledger/open-payments': patch
'@interledger/openapi': patch
---

Update README
38 changes: 15 additions & 23 deletions packages/http-signature-utils/README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
# HTTP Signature Utils Library

The Library includes
This library provides tools for working with [HTTP Message Signatures](https://datatracker.ietf.org/doc/draft-ietf-httpbis-message-signatures):

- loading Ed25519 keys from file or creating them
- generating JWKs from Ed25519 keys
- creating HTTP signature headers
- validate and verify HTTP signature headers
- Loading Ed25519 keys from a file or creating them
- Generating JWKs from Ed25519 keys
- Creating HTTP Signature headers & digests
- Validating and verifying HTTP Signature headers

## Local Development
HTTP Message Signatures are used for protecting the integrity of [Open Payments](https://docs.openpayments.guide/) API requests.

### Building
## Installation

From the monorepo root directory:
You can install the package using:

```shell
pnpm --filter http-signature-utils build
```

### Testing

From the monorepo root directory:

```shell
pnpm --filter http-signature-utils test
npm install @interledger/http-signature-utils
```

## Usage

Load or generate a private key
Load or generate a private Ed25519 key:

```ts
const key = parseOrProvisionKey('/PATH/TO/private-key.pem')
```

Create JWK from private key
Create JWK from private Ed25519 key:

```ts
const jwk = generateJwk({
Expand All @@ -42,7 +34,7 @@ const jwk = generateJwk({
})
```

Create Signature Headers
Create signature headers:

```ts
const signatureHeaders = await createSignatureHeaders({
Expand All @@ -59,7 +51,7 @@ const signatureHeaders = await createSignatureHeaders({
})
```

Create Signature and Content Headers
Create signature and content headers:

```ts
const headers = await createHeaders({
Expand All @@ -76,7 +68,7 @@ const headers = await createHeaders({
})
```

Validate Signature and Content Headers
Validate signature and content headers:

```ts
const isValidHeader = validateSignatureHeaders(request: {
Expand All @@ -94,7 +86,7 @@ const isValidHeader = validateSignatureHeaders(request: {
})
```

Verify signature
Verify signature:

```ts
const isValidSig = await validateSignature(
Expand Down
6 changes: 6 additions & 0 deletions packages/http-signature-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"name": "@interledger/http-signature-utils",
"version": "1.0.0",
"description": "Provides utilities for working with HTTP signatures",
"repository": {
"type": "git",
"url": "https://github.com/interledger/open-payments.git",
"directory": "packages/http-signature-utils"
},
"homepage": "https://github.com/interledger/open-payments/tree/main/packages/http-signature-utils#readme",
"author": "Interledger Tech Team <[email protected]>",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
12 changes: 7 additions & 5 deletions packages/open-payments/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Open Payments

[Open Payments](../../docs/open-payments.md) is an API standard that allows third-parties (with the account holder's consent) to initiate payments and to view the transaction history on the account holder's account.
[Open Payments](https://docs.openpayments.guide/) is an API standard that allows third-parties (with the account holder's consent) to initiate payments and to view the transaction history on the account holder's account.

Open Payments consists of two OpenAPI specifications, a **resource server** which exposes APIs for performing functions against the underlying accounts and an **authorization server** which exposes APIs compliant with the [GNAP](../../docs/glossary.md#grant-negotiation-authorization-protocol) standard for getting grants to access the resource server APIs.
Open Payments consists of two OpenAPI specifications, a **resource server** which exposes APIs for performing functions against the underlying accounts and an **authorization server** which exposes APIs compliant with the [GNAP](https://docs.openpayments.guide/docs/security) standard for getting grants to access the resource server APIs.

This package provides TypeScript & NodeJS tools for using Open Payments:

Expand Down Expand Up @@ -51,7 +51,7 @@ const paymentPointer = await client.paymentPointer.get({

### `AuthenticatedClient`

An `AuthenticatedClient` provides all of the methods that `UnauthenticatedClient` does, as well as the rest of the Open Payment APIs (both the authorizaton and resource specs). Each request requiring authentication will be signed (using [HTTP signatures](../../docs/architecture.md#http-signature-utils)) with the given private key.
An `AuthenticatedClient` provides all of the methods that `UnauthenticatedClient` does, as well as the rest of the Open Payment APIs (both the authorizaton and resource specs). Each request requiring authentication will be signed (using [HTTP Message Signatures](https://github.com/interledger/open-payments/tree/main/packages/http-signature-utils)) with the given private key.

```ts
import { createAuthenticatedClient } from '@interledger/open-payments'
Expand All @@ -73,7 +73,7 @@ In order to create the client, three properties need to be provided: `keyId`, th

> **Note**
>
> To simplify EdDSA-Ed25519 key provisioning and JWK generation, you can use the `parseOrProvisionKey` and `generateJwk` methods from the [`http-signature-utils`](../http-signature-utils/README.md#usage) package.
> To simplify EdDSA-Ed25519 key provisioning and JWK generation, you can use methods from the [`@interledger/http-signature-utils`](https://github.com/interledger/open-payments/tree/main/packages/http-signature-utils)) package.
## Example

Expand Down Expand Up @@ -182,7 +182,9 @@ const quote = await client.quote.create(

5. Create `OutgoingPayment` grant & start interaction flow:

The final step for Online Marketplace's backend system will be to create an `OutgoingPayment` on Alice's wallet. Before this, however, Online Marketplace will need to create an outgoing payment grant, which typically requires some sort of interaction with Alice. Online Marketplace will need to facilitate this interaction with Alice (e.g. redirect her to a webpage with a dialog) to get her consent for creating an `OutgoingPayment` on her account. The detailed sequence for how this is achieved can be found [here](../../docs/grant-interaction.md).
The final step for Online Marketplace's backend system will be to create an `OutgoingPayment` on Alice's wallet. Before this, however, Online Marketplace will need to create an outgoing payment grant, which typically requires some sort of interaction with Alice. Online Marketplace will need to facilitate this interaction with Alice (e.g. redirect her to a webpage with a dialog) to get her consent for creating an `OutgoingPayment` on her account.

To see a detailed sequence and an example implementation for how this is achieved, see https://github.com/interledger/rafiki.

6. Create `OutgoingPayment`:

Expand Down
6 changes: 6 additions & 0 deletions packages/open-payments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"version": "1.0.0",
"description": "Tools for interacting with the Open Payments API",
"author": "Interledger Tech Team <[email protected]>",
"repository": {
"type": "git",
"url": "https://github.com/interledger/open-payments.git",
"directory": "packages/open-payments"
},
"homepage": "https://github.com/interledger/open-payments/tree/main/packages/open-payments#readme",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
16 changes: 4 additions & 12 deletions packages/openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@

This package exposes functionality to validate requests and responses according to a given OpenAPI 3.1 schema.

## Local Development
## Installation

### Building
You can install the package using:

```shell
pnpm --filter openapi build
```

### Testing

From the monorepo root directory:

```shell
pnpm --filter openapi test
npm install @interledger/openapi
```

## Usage
Expand Down Expand Up @@ -50,7 +42,7 @@ validateResponse({ body: response.body, status }) // throws or returns true
<br>

Likewise, you can validate both requests and responses inside a middleware method, using `createValidatorMiddleware`:
Likewise, you can validate both requests and responses inside a [Koa](https://github.com/koajs/koa) middleware method, using `createValidatorMiddleware`:

```ts
const openApi = await createOpenAPI(OPEN_API_URL)
Expand Down
6 changes: 6 additions & 0 deletions packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"version": "1.0.0",
"description": "Validates requests and responses according to an OpenAPI 3.1 schema",
"author": "Interledger Tech Team <[email protected]>",
"repository": {
"type": "git",
"url": "https://github.com/interledger/open-payments.git",
"directory": "packages/openapi"
},
"homepage": "https://github.com/interledger/open-payments/tree/main/packages/openapi#readme",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down

0 comments on commit 842630e

Please sign in to comment.