Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update multiformats, add JWS utilities, update deps #1

Merged
merged 4 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# dag-jose-utils


This library provides utilities for using the dag-jose ipld codec. It uses dag-cbor to encode payloads and cleartexts to CIDs.

This library provides utilities for using the [DAG-JOSE](https://github.com/ceramicnetwork/js-dag-jose) IPLD codec. It uses [DAG-CBOR](https://github.com/ipld/js-dag-cbor) to encode payloads and cleartexts to CIDs.

## Installation
First install the package
Expand All @@ -17,7 +15,9 @@ import {
prepareCleartext,
decodeCleartext,
encodeIdentityCID,
decodeIdentityCID
decodeIdentityCID,
toJWSPayload,
toJWSStrings
} from 'dag-jose-utils'
```

Expand Down Expand Up @@ -46,10 +46,14 @@ Encode an ipld object as a CID that uses the identity hash.
### decodeIdentityCID(cid: CID): Record<string, any>
Decode an ipld object from a CID that uses the identity hash.

### toJWSPayload(payload: EncodedPayload | CID): string
Transform an `EnvodedPayload` (from `encodePayload()`) or a CID into a JWS string for use with `createJWS()` in [did-jwt](https://github.com/decentralized-identity/did-jwt). The string form is simply the Base64url encoded form of the CID's byte representation.
rvagg marked this conversation as resolved.
Show resolved Hide resolved

### toJWSStrings(jose: any): string[]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunate that you need this method. Ideally did-jwt should support the General encoding, that the ´jose` object here has, out of the box!

Transform a `DagJWT` object from ipld-dag-jose into an array of strings for each signature in the object. The strings can then be verified using `verifyJWS()` in [did-jwt](https://github.com/decentralized-identity/did-jwt).
rvagg marked this conversation as resolved.
Show resolved Hide resolved

## Maintainer
[Joel Thorstensson](https://github.com/oed)


## License
MIT or APACHE
Loading