![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
balena-auth
Advanced tools
Balena session authentication utilities
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:
$ 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
import BalenaAuth from 'balena-auth';
const auth = new BalenaAuth({
dataDirectory: '/opt/cache/balena',
tokenKey: 'token'
});
[ '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
auth.setKey('...').then(() => { ... });
[ 'Promise' ].<Boolean>
Kind: inner method of auth
Summary: Has a key
Returns: [ 'Promise' ].<Boolean>
- has key
Access: public
Example
auth.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
auth.removeKey();
[ 'Promise' ].<TokenType>
Kind: inner method of auth
Summary: Gets the key type
Access: public
Example
auth.getType().then((type) => { ... });
[ 'Promise' ].<string>
Kind: inner method of auth
Summary: Gets the key
Access: public
Example
auth.getKey().then((key) => { ... });
[ 'Promise' ].<(number|undefined)>
Kind: inner method of auth
Summary: Gets the token age
Access: public
Example
auth.getAge().then((age) => { ... });
[ 'Promise' ].<boolean>
Kind: inner method of auth
Summary: Checks if token is expired
Access: public
Example
auth.isExpired().then((expired) => { ... });
[ 'Promise' ].<boolean>
Kind: inner method of auth
Summary: Checks if token format is valid
Access: public
Example
auth.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
auth.get2FAStatus().then((get2FAStatus) => { ... });
[ 'Promise' ].<boolean>
Kind: inner method of auth
Summary: Checks whether passing 2FA is pending/needed
Access: public
Example
auth.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:
$ npm test
Before submitting a PR, please make sure that you include tests, and that tslint runs without any warning:
$ npm run lint
The project is licensed under the Apache 2.0 license.
FAQs
Balena session authentication utilities
The npm package balena-auth receives a total of 96 weekly downloads. As such, balena-auth popularity was classified as not popular.
We found that balena-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.