Giter Club home page Giter Club logo

w3name-action's Introduction

w3name-action

Publish IPNS name using w3name service.

w3name-action status

Example usage

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: <cid from previous steps>
          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 npm package.

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

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a โญ๏ธ if this project helped you!

Copyright ยฉ 2022 Pawan Paudel.

w3name-action's People

Contributors

pawanpaudel93 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.