@hugoalh/github-sodium

A module to provide an easier sodium for GitHub secret.

Usage no npm install needed!

<script type="module">
  import hugoalhGithubSodium from 'https://cdn.skypack.dev/@hugoalh/github-sodium';
</script>

README

GitHub Sodium (NodeJS)

GitHubSodium.NodeJS GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions GitHub Stars GitHub Forks GitHub Languages CodeFactor Grade LGTM Alerts LGTM Grade License

Release Latest (GitHub Latest Release Date) Pre (GitHub Latest Pre-Release Date)
GitHub GitHub Total Downloads GitHub Latest Release Version GitHub Latest Pre-Release Version
NPM NPM Total Downloads NPM Latest Release Version NPM Latest Pre-Release Version

📝 Description

A NodeJS module to provide an easier sodium for GitHub secret.

This project is based on TweetSodium (GitHub)(NPM) with optimization for GitHub secret.

📚 Documentation

Getting Started

Install

NodeJS (>= v14.15.0) + NPM (>= v6.14.8):

npm install @hugoalh/github-sodium

Use In CommonJS

const githubSodium = require("@hugoalh/github-sodium");

Use In ModuleJS

import githubSodium from "@hugoalh/github-sodium";

API

githubSodium(// Encrypt value to GitHub secret value.
  publicKey: string,// Organization's or repository's public key, which need for encrypt value to secret value before create or update a secret.
  value: string// Value that need to encrypt as secret value.
): string// An encrypted GitHub secret value.

Example

githubSodium("base64-encoded-public-key", "plain-text-secret");
//=> "+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0="