{"id":31376515,"url":"https://github.com/substrate-system/message","last_synced_at":"2026-01-20T17:27:42.163Z","repository":{"id":154183462,"uuid":"631062395","full_name":"substrate-system/message","owner":"substrate-system","description":"Create and verify signed messages","archived":false,"fork":false,"pushed_at":"2025-09-08T03:38:43.000Z","size":213,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T10:52:17.661Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/substrate-system.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-21T20:40:59.000Z","updated_at":"2025-09-08T03:37:54.000Z","dependencies_parsed_at":"2023-09-18T06:43:28.239Z","dependency_job_id":"7d67bd80-b42f-468b-bba5-437d22cb1223","html_url":"https://github.com/substrate-system/message","commit_stats":null,"previous_names":["ssc-half-light/message","bicycle-codes/message","substrate-system/message"],"tags_count":55,"template":false,"template_full_name":"nichoth/template-ts-browser","purl":"pkg:github/substrate-system/message","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fmessage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fmessage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fmessage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fmessage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/substrate-system","download_url":"https://codeload.github.com/substrate-system/message/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fmessage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277322052,"owners_count":25798726,"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","status":"online","status_checked_at":"2025-09-28T02:00:08.834Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-09-28T03:53:43.718Z","updated_at":"2026-01-20T17:27:42.149Z","avatar_url":"https://github.com/substrate-system.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# message\n\n[![tests](https://img.shields.io/github/actions/workflow/status/substrate-system/message/nodejs.yml?style=flat-square)](https://github.com/substrate-system/message/actions/workflows/nodejs.yml)\n[![types](https://img.shields.io/npm/types/msgpackr?style=flat-square)](README.md)\n[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)\n[![install size](https://flat.badgen.net/packagephobia/install/@substrate-system/message)](https://packagephobia.com/result?p=@substrate-system/message)\n[![GZip size](https://flat.badgen.net/bundlephobia/minzip/@substrate-system/message)](https://bundlephobia.com/package/@substrate-system/message)\n[![license](https://img.shields.io/badge/license-Big_Time-blue?style=flat-square)](LICENSE)\n\n\nCreate and verify signed messages with [the webcrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API).\n\n\n## Contents\n\n\u003c!-- toc --\u003e\n\n- [Install](#install)\n- [Example](#example)\n  * [Create a message](#create-a-message)\n  * [Verify a message](#verify-a-message)\n\n\u003c!-- tocstop --\u003e\n\n## Install\n\n```sh\nnpm i -S @substrate-system/message\n```\n\n## Example\n\n### Create a message\n```js\nimport { EccKeys as Keys } from '@substrate-system/keys'\nimport { create } from '@substrate-system/message'\n\nconst alicesKeys = await Keys.create()\nconst req = await create(alicesKeys.writeKey, { hello: 'world' })\n```\n\nThe returned object has a format like\n```js\n{\n    author: 'did:key:...',\n    signature: '123abc',\n    ...message\n}\n```\n\n\u003e\n\u003e [!NOTE]  \n\u003e The message will have the fields `author` and `signature` appended to it.\n\u003e `author` is the DID that was used to sign this message. It is read\n\u003e by `verify(message)`.\n\u003e\n\n```js\nimport { test } from '@substrate-system/tapzero'\nimport { Keys } from '@substrate-system/keys'\nimport { create } from '@substrate-system/message'\n\nlet req:SignedMessage\u003c{ hello: 'world' }\u003e\nconst alicesKeys = await Keys.create()\ntest('create a message', async t =\u003e {\n    req = await create(alicesKeys.writeKey, { hello: 'world' })\n\n    t.ok(req, 'request was created')\n    t.equal(typeof req.signature, 'string', 'should have a signature')\n    t.ok(req.author.includes('did:key:'), 'should have an author field')\n    t.equal(req.hello, 'world', 'should have the properties we passed in')\n})\n```\n\n### Verify a message\n```js\nimport { test } from '@substrate-system/tapzero'\nimport { verify } from '@substrate-system/message'\n\ntest('verify a message', async t =\u003e {\n    // `req` is the message we created above\n    const isOk = await verify(req)\n    t.equal(isOk, true, 'should return true for a valid message')\n})\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Fmessage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubstrate-system%2Fmessage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Fmessage/lists"}