Gathering detailed insights and metrics for balena-auth
Gathering detailed insights and metrics for balena-auth
Gathering detailed insights and metrics for balena-auth
Gathering detailed insights and metrics for balena-auth
npm install balena-auth
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (97.01%)
JavaScript (2.99%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
4 Stars
88 Commits
1 Forks
2 Watchers
4 Branches
10 Contributors
Updated on Feb 21, 2023
Minified
Minified + Gzipped
Latest Version
6.0.1
Package Id
balena-auth@6.0.1
Unpacked Size
43.38 kB
Size
10.26 kB
File Count
15
NPM Version
10.2.4
Node Version
18.19.1
Published on
Feb 23, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
25
Balena session authentication utilities
The intention of this module is to provide low level access to how a balena authentication tokens are parsed and persisted.
THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.
Unless you know what you're doing, use the balena SDK instead.
Install balena-auth
by running:
1$ npm install --save balena-auth
The module returns a class that you use to get an instance of the auth module.
It accepts the following params:
Param | Type | Description |
---|---|---|
options | Object | options |
[options.dataDirectory] | string | false | the directory to use for storage in Node.js or false to create an isolated in memory instance. Values other than false are ignored in the browser. |
[options.tokenKey] | string | the key used to store the last token in the storage. token by default. |
Example
1import BalenaAuth from 'balena-auth';
2const auth = new BalenaAuth({
3 dataDirectory: '/opt/cache/balena',
4 tokenKey: 'token'
5});
[ 'Promise' ].<void>
[ 'Promise' ].<Boolean>
Promise
[ 'Promise' ].<TokenType>
[ 'Promise' ].<string>
[ 'Promise' ].<(number|undefined)>
[ 'Promise' ].<boolean>
[ 'Promise' ].<boolean>
[ 'Promise' ].<('not_required'|'pending'|'passed')>
[ 'Promise' ].<boolean>
[ 'Promise' ].<void>
Kind: inner method of auth
Summary: Set the key
Access: public
Param | Type |
---|---|
key | String |
Example
1auth.setKey('...').then(() => { ... });
[ 'Promise' ].<Boolean>
Kind: inner method of auth
Summary: Has a key
Returns: [ 'Promise' ].<Boolean>
- has key
Access: public
Example
1auth.hasKey().then((hasKey) => { ... });
Promise
This promise is not rejected if there was no key at the time of removal.
Kind: inner method of auth
Summary: Remove the key
Access: public
Example
1auth.removeKey();
[ 'Promise' ].<TokenType>
Kind: inner method of auth
Summary: Gets the key type
Access: public
Example
1auth.getType().then((type) => { ... });
[ 'Promise' ].<string>
Kind: inner method of auth
Summary: Gets the key
Access: public
Example
1auth.getKey().then((key) => { ... });
[ 'Promise' ].<(number|undefined)>
Kind: inner method of auth
Summary: Gets the token age
Access: public
Example
1auth.getAge().then((age) => { ... });
[ 'Promise' ].<boolean>
Kind: inner method of auth
Summary: Checks if token is expired
Access: public
Example
1auth.isExpired().then((expired) => { ... });
[ 'Promise' ].<boolean>
Kind: inner method of auth
Summary: Checks if token format is valid
Access: public
Example
1auth.isValid().then((valid) => { ... });
[ 'Promise' ].<('not_required'|'pending'|'passed')>
Kind: inner method of auth
Summary: Gets whether passing a 2FA challenge is pending, passed or not required.
Access: public
Example
1auth.get2FAStatus().then((get2FAStatus) => { ... });
[ 'Promise' ].<boolean>
Kind: inner method of auth
Summary: Checks whether passing 2FA is pending/needed
Access: public
Example
1auth.needs2FA().then((needs2FA) => { ... });
If you're having any problem, please raise an issue on GitHub and the balena team will be happy to help.
Run the test suite by doing:
1$ npm test
Before submitting a PR, please make sure that you include tests, and that tslint runs without any warning:
1$ npm run lint
The project is licensed under the Apache 2.0 license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/16 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More