Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pawanpaudel93/w3name-action
Publish IPNS name using w3name service.
https://github.com/pawanpaudel93/w3name-action
ipfs w3name
Last synced: about 1 month ago
JSON representation
Publish IPNS name using w3name service.
- Host: GitHub
- URL: https://github.com/pawanpaudel93/w3name-action
- Owner: pawanpaudel93
- License: mit
- Created: 2022-09-14T06:36:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-07T08:06:28.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T10:48:50.430Z (about 2 months ago)
- Topics: ipfs, w3name
- Language: TypeScript
- Homepage:
- Size: 1.34 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
w3name-action
Publish IPNS name using w3name service.
## Example usage
```yaml
name: 'w3-action'
on:
push:
branches:
- mainjobs:
w3name-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: w3name publish
uses: pawanpaudel93/[email protected]
with:
cid:
signing_key: ${{ secrets.SIGNING_KEY }}
```## Inputs
### `cid`
**Required** The IPFS content ID for the directory or file on IPFS.
### `signing_key`
**Required** w3name signing key to publish names.
You can create the `signing_key` by using the following code snippet by installing `w3name` npm package or using [dearwebthree](https://github.com/pawanpaudel93/dearwebthree) npm package.
```js
const fsPromises = require('fs/promises')
const Name = require('w3name')function pad(n, width, z = '0') {
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n
}function arrayBufferToHexString(buf) {
const view = new Uint8Array(buf)
const hex = Array.from(view).map(v => pad(v.toString(16), 2))
return hex.join('')
};(async () => {
const name = await Name.create()
const signingKey = arrayBufferToHexString(name.key.bytes)
await fsPromises.writeFile(
'w3name.json',
JSON.stringify(
{
name: name.toString(),
signingKey
},
null,
2
)
)
console.log(`w3name.json file created.`)
})()
```## Outputs
### `name`
The IPNS name associated with the `signing_key`
e.g. `k51qzi5uqu5dm09eb5pk1af1622tn7atinj0ynaic685p9pzbinffxlmc9t82j`### `url`
The IPNS URL of the name.
e.g. `https://w3s.link/ipns/k51qzi5uqu5dm09eb5pk1af1622tn7atinj0ynaic685p9pzbinffxlmc9t82j`## Author
👤 **Pawan Paudel**
- Github: [@pawanpaudel93](https://github.com/pawanpaudel93)
## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/pawanpaudel93/w3name-action/issues).## Show your support
Give a ⭐️ if this project helped you!
Copyright © 2022 [Pawan Paudel](https://github.com/pawanpaudel93).