# @totemorg/securelink

> provide secure login link to web services

Latest version **2.27.0** (published 2024-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @totemorg/securelink
pnpm add @totemorg/securelink
yarn add @totemorg/securelink
bun add @totemorg/securelink
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.27.0 |
| Published | 2024-11-23 |
| First published | 2022-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 70.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | acme SDS |
| Maintainers | totem4, totem3, totem2, totem1 |
| Keywords | E2EE |

## Links

- npm: https://www.npmjs.com/package/@totemorg/securelink
- Repository: https://github.com/totemorg/securelink
- Homepage: https://github.com/totemorg/securelink#readme
- Issues: https://github.com/totemorg/securelink/issues
- npm.io page: https://npm.io/package/@totemorg/securelink

## Dependencies (2)

- [@totemorg/core](https://npm.io/package/@totemorg/core.md) ^1.2.0
- [@totemorg/socketio](https://npm.io/package/@totemorg/socketio.md) ^1.50.0

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 2.27.0 (latest) — 2024-11-23
- 2.26.0 — 2024-11-23
- 2.25.0 — 2024-11-23
- 2.24.0 — 2024-07-02
- 2.23.0 — 2024-05-27
- 2.22.0 — 2024-05-27
- 2.21.0 — 2024-05-25
- 2.20.0 — 2024-05-25
- 2.19.0 — 2024-05-25
- 2.18.0 — 2024-05-24
- 2.17.0 — 2023-10-31
- 2.16.0 — 2023-10-31
- 2.15.0 — 2023-10-31
- 2.14.0 — 2023-10-31
- 2.13.0 — 2023-10-31
- … 37 more at https://npm.io/package/@totemorg/securelink/versions

## README

# [secureLink](https://www.npmjs.com/package/@totemorg/securelink)

The **SecureLink** provides a `/link` agent to enable

	+ secure inter-client communication
	+ antibot challenges 
	+ secure login mechanisim
	+ room admittance

**SecureLink** is built on [SocketIO](https://www.npmjs.com/package/@totemorg/socketio) and establishes the  
SocketIO protocol

	Function	Client					Channel 			Server
	==================================================================
	join			----------------- connect ---------------->
	request			----------------- join ------------------->
					<---- status || challenge || start	-------
	
	start			----------------- announce --------------->
	session			<---------------- accept* -----------------
	
	save			----------------- store ------------------>
	history			<---------------- status ------------------
	
	load			----------------- restore ---------------->
	history			<---------------- status ------------------
	
	login			----------------- login ------------------>
	request			<----- status, remove*, accept* -----------
					
	relay			----------------- relay ------------------>
	message			<---------------- relay** -----------------
	
	* sends to all clients
	** sends to all clients except the requesting client

## Install

	npm install @totemorg/securelink
	npm update

## Start

	npm run start ?					# List start options

## Manage

	npm run verminor				# Roll minor version
	npm run vermajor				# Roll major version
	npm run redoc					# Regen documentation
	npm run pubminor				# republish as minor version
	npm run pubmajor				# republish as major version

## Usage

	import SECLINK from "@totemorg/securelink";

## Program Reference
<details>
<summary>
<i>Open/Close</i>
</summary>
## Modules

<dl>
<dt><a href="#module_SECLINK">SECLINK</a></dt>
<dd><p>Provides a private (end-to-end encrypted) message link between trusted clients via secure logins. </p>
<p>This module documented in accordance with <a href="https://jsdoc.app/">jsdoc</a>.</p>
<h2 id="env-vars">Env Vars</h2>
<pre><code>LINK_PASS = passphrase to encrypt client information
LINK_HOST = @name suffix of guest clients
</code></pre>
</dd>
<dt><a href="#module_SEC-CLIENT">SEC-CLIENT</a></dt>
<dd><p>The <a href="https://www.npmjs.com/package/@totemorg/securelink">securelink</a> client.</p>
<pre><code>Provides UIs for operating private (end-to-end encrypted) messaging link 
between trusted clients.  

This module documented in accordance with [jsdoc](https://jsdoc.app/).

The UIs herein are created in the /site.jade and support:

    + client login/out/reset operations
    + SecureLink and dbSync sockets (stopLink, startLink, connectIO)
    + data encryption (genKeys, encryptMessage, decryptMessage, encodeMessage, decodeMessage)
</code></pre>
</dd>
</dl>

<a name="module_SECLINK"></a>

## SECLINK
Provides a private (end-to-end encrypted) message link between trusted clients via secure logins. 

This module documented in accordance with [jsdoc](https://jsdoc.app/).

## Env Vars
										
	LINK_PASS = passphrase to encrypt client information
	LINK_HOST = @name suffix of guest clients

**Requires**: <code>module:[enums](https://www.npmjs.com/package/@totemorg/enums)</code>, <code>module:[socketio](https://www.npmjs.com/package/@totemorg/socketio)</code>, <code>module:[socket.io](https://www.npmjs.com/package/socket.io)</code>, <code>module:[crypto](https://nodejs.org/docs/latest/api/)</code>, <code>module:[cp](https://nodejs.org/docs/latest/api/)</code>  
**Author**: [ACMESDS](https://totemorg.github.io)  
**Example**  
```js
On the server:

	import {configLink,notifyClients} from "securelink";

	configLink({
		server: server,
		guest: {....}
	});
								
	notifyClients( "update", { // send update request
	});	
						

On the client:
	
	// <script src="securelink-client.js"></script>
	
	Sockets({	// establish sockets
		update: req => {	// intercept update request
			console.log("update", req);
		}, 

		// other sockets as needed ...
	});
```

* [SECLINK](#module_SECLINK)
    * _static_
        * [.Login(account, password, cb)](#module_SECLINK.Login)
        * [.configLink()](#module_SECLINK.configLink)
        * [.notifyClients()](#module_SECLINK.notifyClients)
    * _inner_
        * [~resetClient()](#module_SECLINK..resetClient)
        * [~testClient(client, guess, res)](#module_SECLINK..testClient)
        * [~isTrusted()](#module_SECLINK..isTrusted)

<a name="module_SECLINK.Login"></a>

### SECLINK.Login(account, password, cb)
Start a secure link and return the user profile corresponding for the supplied 
account/password login.  The provided callback LOGIN(err,profile) where LOGIN =  
resetPassword || newAccount || newSession || guestSession determines the login session
type being requested.

**Kind**: static method of [<code>SECLINK</code>](#module_SECLINK)  
**Cfg**: <code>Function</code>  

| Param | Type | Description |
| --- | --- | --- |
| account | <code>String</code> | credentials |
| password | <code>String</code> | credentials |
| cb | <code>function</code> | callback (err,profile) to process the session |

<a name="module_SECLINK.configLink"></a>

### SECLINK.configLink()
Establish socketio channels for the SecureIntercom link (at store,restore,login,relay,status,
sync,join,exit,content) and the insecure dbSync link (at select,update,insert,delete).

**Kind**: static method of [<code>SECLINK</code>](#module_SECLINK)  
<a name="module_SECLINK.notifyClients"></a>

### SECLINK.notifyClients()
**Kind**: static method of [<code>SECLINK</code>](#module_SECLINK)  
<a name="module_SECLINK..resetClient"></a>

### SECLINK~resetClient()
Reset account request with callback cb( err ).

**Kind**: inner method of [<code>SECLINK</code>](#module_SECLINK)  
<a name="module_SECLINK..testClient"></a>

### SECLINK~testClient(client, guess, res)
Test response of client during a session challenge.

**Kind**: inner method of [<code>SECLINK</code>](#module_SECLINK)  

| Param | Type | Description |
| --- | --- | --- |
| client | <code>String</code> | name of client being challenged |
| guess | <code>String</code> | guess provided by client |
| res | <code>function</code> | response callback( "pass" || "fail" || "retry" ) |

<a name="module_SECLINK..isTrusted"></a>

### SECLINK~isTrusted()
Test if an account is "trusted" to use the secure com channel.

**Kind**: inner method of [<code>SECLINK</code>](#module_SECLINK)  
<a name="module_SEC-CLIENT"></a>

## SEC-CLIENT
The [securelink](https://www.npmjs.com/package/@totemorg/securelink) client.

	Provides UIs for operating private (end-to-end encrypted) messaging link 
	between trusted clients.  

	This module documented in accordance with [jsdoc](https://jsdoc.app/).

	The UIs herein are created in the /site.jade and support:

		+ client login/out/reset operations
		+ SecureLink and dbSync sockets (stopLink, startLink, connectIO)
		+ data encryption (genKeys, encryptMessage, decryptMessage, encodeMessage, decodeMessage)

**Requires**: <code>module:UIBASE</code>, <code>module:socketio</code>, <code>module:openpgp</code>, <code>module:uibase</code>  
**Author**: [ACMESDS](https://totemorg.github.io)  
</details>

## Contacting, Contributing, Following

Feel free to 
* submit and status [TOTEM issues](http://totem.hopto.org/issues.view) 
* contribute to [TOTEM notebooks](http://totem.hopto.org/shares/notebooks/) 
* revise [TOTEM requirements](http://totem.hopto.org/reqts.view) 
* browse [TOTEM holdings](http://totem.hopto.org/) 
* or follow [TOTEM milestones](http://totem.hopto.org/milestones.view) 

## License

[MIT](LICENSE)

* * *

&copy; 2012 ACMESDS

---
_Source: https://npm.io/package/@totemorg/securelink · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
