{"id":14956313,"url":"https://github.com/ceramicnetwork/js-dag-jose-utils","last_synced_at":"2025-10-30T19:31:58.560Z","repository":{"id":45877594,"uuid":"300279113","full_name":"ceramicnetwork/js-dag-jose-utils","owner":"ceramicnetwork","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-03T15:10:42.000Z","size":988,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-01-22T08:43:46.216Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ceramicnetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-01T12:55:22.000Z","updated_at":"2024-06-03T10:38:53.000Z","dependencies_parsed_at":"2024-01-03T13:29:59.881Z","dependency_job_id":"8307aaa2-d52f-4365-b46a-c2deedb616dd","html_url":"https://github.com/ceramicnetwork/js-dag-jose-utils","commit_stats":{"total_commits":16,"total_committers":7,"mean_commits":"2.2857142857142856","dds":0.625,"last_synced_commit":"ba8a26cc9adf194538e948f498fd076bf9c4bbe6"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicnetwork%2Fjs-dag-jose-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicnetwork%2Fjs-dag-jose-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicnetwork%2Fjs-dag-jose-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceramicnetwork%2Fjs-dag-jose-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ceramicnetwork","download_url":"https://codeload.github.com/ceramicnetwork/js-dag-jose-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235519884,"owners_count":19003201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:12:41.788Z","updated_at":"2025-10-06T10:32:29.754Z","avatar_url":"https://github.com/ceramicnetwork.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dag-jose-utils\n\nThis 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.\n\n## Installation\nFirst install the package\n```\n$ npm i --save dag-jose-utils\n```\n\n## Importing\n```ts\nimport {\n  encodePayload,\n  prepareCleartext,\n  decodeCleartext,\n  encodeIdentityCID,\n  decodeIdentityCID,\n  toJWSPayload,\n  toJWSStrings\n} from 'dag-jose-utils'\n```\n\n## API\n\n### EncodedPayload\n```ts\ninterface EncodedPayload {\n  cid: CID\n  linkedBlock: Uint8Array\n}\n```\n\n### encodePayload(payload: Record\u003cstring, any\u003e): Promise\u003cEncodedPayload\u003e\nPrepares a payload to be signed in a JWS. Note that you will need to encode the `encodePayload.cid.bytes` as `base64url` before signing.\n\n### prepareCleartext(cleartext: Record\u003cstring, any\u003e, blockSize?: number): Uint8Array\nPrepares a cleartext object to be encrypted in a JWE. By default the blockSize for padding is 24.\n\n### decodeCleartext(b: Uint8Array): Record\u003cstring, any\u003e\nDecode a decrypted cleartext to an ipld object.\n\n### encodeIdentityCID(obj: Record\u003cstring, any\u003e): CID\nEncode an ipld object as a CID that uses the identity hash.\n\n### decodeIdentityCID(cid: CID): Record\u003cstring, any\u003e\nDecode an ipld object from a CID that uses the identity hash.\n\n### toJWSPayload(payload: EncodedPayload | CID): string\nTransform an `EncodedPayload` (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.\n\n### toJWSStrings(jose: any): string[]\nTransform a `DagJWS` 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).\n\n## Maintainer\n[Joel Thorstensson](https://github.com/oed)\n\n## License\nMIT or APACHE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceramicnetwork%2Fjs-dag-jose-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceramicnetwork%2Fjs-dag-jose-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceramicnetwork%2Fjs-dag-jose-utils/lists"}