Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

w3name-action


Publish IPNS name using w3name service.


w3name-action status

## Example usage

```yaml
name: 'w3-action'
on:
push:
branches:
- main

jobs:
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).