Registry / messaging / hive-auth-wrapper

hive-auth-wrapper

JSON →
library1.0.0jsnpmunverified

A WebSocket wrapper for the Hive Authentication Services (HAS) infrastructure, version 1.0.0, actively maintained. It abstracts WebSocket connection management and event handling, providing a promise-based API for authentication, transaction broadcasting, and challenge signing on the Hive blockchain. Key differentiators: eliminates low-level WebSocket code, handles token expiry automatically, supports configurable host and PKSA encryption. Stable API with default configuration, suitable for Hive dApps needing HAS integration.

npm install hive-auth-wrapper
INSTALL
IMPORT
SIG · HIVE-AUTH-WRAPPER
H
hive-auth-wrapper
messagingjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import HAS from 'hive-auth-wrapper'
const HAS = require('hive-auth-wrapper')
ESM default import; CommonJS require may work but not recommended for TypeScript
status
import HAS from 'hive-auth-wrapper'; HAS.status()
import { status } from 'hive-auth-wrapper'
status is a static method on the default export, not a named export
setOptions
import HAS from 'hive-auth-wrapper'; HAS.setOptions(options)
import { setOptions } from 'hive-auth-wrapper'
setOptions is a static method on the default export

Authentication and transaction broadcast using Hive Auth Wrapper

import HAS from 'hive-auth-wrapper'; const APP_META = { name: 'myapp', description: 'My HAS compatible application', icon: undefined }; const auth = { username: 'username', token: undefined, expire: undefined, key: undefined }; HAS.authenticate(auth, APP_META) .then(res => console.log('Authenticated:', res)) .catch(err => console.error('Auth failed:', err)); const op = ["vote", { voter: auth.username, author: "author", permlink: "permlink", weight: 10000 }]; HAS.broadcast(auth, "posting", [op]) .then(res => console.log('Broadcasted:', res)) .catch(err => console.error('Broadcast failed:', err));
Debug
Known issues
breakingWebSocket connection errors are not automatically retried; connection failure causes promise rejection.
fix
Implement custom retry logic in your error handler.
affects: >=1.0.0
deprecatedThe 'auth' object key property is deprecated in favor of token-based authentication.
fix
Use token and expire fields instead of key.
affects: >=1.0.0
gotchaDefault host wss://hive-auth.arcange.eu is used if no host is specified; ensure this is accessible.
fix
Set host in setOptions() if using a different server.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: HAS.authenticate is not a function
Importing library incorrectly (using named import instead of default import).
fix
Use 'import HAS from "hive-auth-wrapper"' instead of 'import { HAS } from "hive-auth-wrapper"'.
WebSocket connection to 'wss://hive-auth.arcange.eu' failed
Server unreachable or incorrect host configuration.
fix
Check network connectivity and verify the host URL in setOptions().
Error: Auth token expired
Used an expired auth token without re-authenticating.
fix
Check auth.expire before using token and call authenticate() if expired.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
hive-txoptionaltransaction signing and broadcasting
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
hive-auth-wrapper — npm install hive-auth-wrapper · libregistry