0.2.8 • Published 2 years ago

scrt-link-core v0.2.8

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
2 years ago

scrt-link-core

scrt.link lets you share sensitive information online. End-to-end encrypted. One time.

This package allows you to use the service programmatically. Use it whenever you need to share a secret.

Installation

yarn add scrt-link-core

Usage

The examples are based on the assumption that you use scrt.link as your backend - however, you may use this package with your own backend. Check the scrt-link repository for a reference implementation.

Basic example

import { createSecret } from 'scrt-link-core'

const { secretLink } = await createSecret('Some confidential information…')
// https://scrt.link/l#hLN8e0jd6xtLuxJqDxp1D/Q4rqaOWQtzFTZIB-7TXEYD2NgI9E1KQdeMXdfsvPykI

With options

import { createSecret } from "scrt-link-core";

const { secretLink, alias, encryptionKey } = await createSecret("Some confidential information…", {
  password: "some-passphrase",
  secretType: "neogram", // "text" | "url" | "neogram"
  neogramDestructionMessage: "This messages self-destructs in…"
  neogramDestructionTimeout: 10;
}
});
/*
alias:  hLN8e0jd6xtLuxJqDxp1D
encryptionKey: Q4rqaOWQtzFTZIB-7TXEYD2NgI9E1KQdeMXdfsvPykI
secretLink:  https://scrt.link/de/l#hLN8e0jd6xtLuxJqDxp1D/Q4rqaOWQtzFTZIB-7TXEYD2NgI9E1KQdeMXdfsvPykI
/*

Find out about the various secret types and options on scrt.link - the website's code is open source and available here.

Retrieve secret

It's recommended to just use generated link. However, there is a helper function if you need a custom solution. The function expects the alias and the encryption key.

import { retrieveSecret } from "scrt-link-core";

const { message } = await retrieveSecret("hLN8e0jd6xtLuxJqDxp1D", "Q4rqaOWQtzFTZIB-7TXEYD2NgI9E1KQdeMXdfsvPykI")
});
// message: Some confidential information…

Instant usage 💥

There are pre-built packages to use right away. I recommend Skypack, but you can find it on other CDNs like jsDelivr, cdnjs, unpkg.com.

Via ES Module import

<script type="module">
  import { createSecret } from 'https://cdn.skypack.dev/scrt-link-core'

  // Use as described above…
  createSecret('Some confidential information…').then(({ secretLink }) => {})
</script>

Full demo

Via script tag

<html>
  <head>
    <!-- Load script via CDN -->
    <script src="https://unpkg.com/scrt-link-core@latest/dist/esbuild/browser.js"></script>
  </head>

  <body>
    <script>
      // Functions are available on the window object
      window.createSecret('Some confidential information…').then(({ secretLink }) => {
        console.log(`Success! Your secret link is: ${secretLink}`)
      })
    </script>
  </body>
</html>

Full demo

Documentation

Documentation

Credits

Boilerplate: https://github.com/metachris/typescript-boilerplate by Chris Hager

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.3

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.2

2 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago