��b a l e n a - r e g i s t e r - d e v i c e
= = = = = = = = = = = = = = = = = = = = =
> B a l e n a d e v i c e r e g i s t r a t i o n u t i l i t i e s .
[ ! [ n p m v e r s i o n ] ( h t t p s : / / b a d g e . f u r y . i o / j s / b a l e n a - r e g i s t e r - d e v i c e . s v g ) ] ( h t t p : / / b a d g e . f u r y . i o / j s / b a l e n a - r e g i s t e r - d e v i c e )
[ ! [ d e p e n d e n c i e s ] ( h t t p s : / / d a v i d - d m . o r g / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e . s v g ) ] ( h t t p s : / / d a v i d - d m . o r g / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e . s v g )
[ ! [ B u i l d S t a t u s ] ( h t t p s : / / t r a v i s - c i . o r g / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e . s v g ? b r a n c h = m a s t e r ) ] ( h t t p s : / / t r a v i s - c i . o r g / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e )
[ ! [ B u i l d s t a t u s ] ( h t t p s : / / c i . a p p v e y o r . c o m / a p i / p r o j e c t s / s t a t u s / u h 8 b g 4 5 p x x y x 2 q i f / b r a n c h / m a s t e r ? s v g = t r u e ) ] ( h t t p s : / / c i . a p p v e y o r . c o m / p r o j e c t / r e s i n - i o / b a l e n a - r e g i s t e r - d e v i c e / b r a n c h / m a s t e r )
I n s t a l l a t i o n
- - - - - - - - - - - -
I n s t a l l ` b a l e n a - r e g i s t e r - d e v i c e ` b y r u n n i n g :
` ` ` s h
$ n p m i n s t a l l - - s a v e b a l e n a - r e g i s t e r - d e v i c e
` ` `
D o c u m e n t a t i o n
- - - - - - - - - - - - -
B a l e n a - R e g i s t e r - D e v i c e e x p o r t s a f a c t o r y f u n c t i o n , w h i c h m u s t b e c a l l e d w i t h a d e p e n d e n c i e s o b j e c t , c o n t a i n i n g a c o n f i g u r e d [ ` b a l e n a - r e q u e s t ` ] ( h t t p s : / / g i t h u b . c o m / b a l e n a - i o - m o d u l e s / b a l e n a - r e q u e s t ) i n s t a n c e .
E x a m p l e :
` ` ` c o f f e e
d e v i c e R e g i s t e r = r e q u i r e ( ' b a l e n a - r e g i s t e r - d e v i c e ' ) ( {
r e q u e s t : r e q u e s t # A n i n s t a n t i a t e d b a l e n a - r e q u e s t i n s t a n c e
} )
` ` `
# # # d e v i c e R e g i s t e r . g e n e r a t e U n i q u e K e y ( )
G e n e r a t e a r a n d o m k e y , u s e f u l f o r b o t h u u i d a n d a p i k e y .
E x a m p l e :
` ` ` c o f f e e
r a n d o m K e y = d e v i c e R e g i s t e r . g e n e r a t e U n i q u e K e y ( )
# r a n d o m K e y i s a r a n d o m l y g e n e r a t e d k e y t h a t c a n b e u s e d a s e i t h e r a u u i d o r a n a p i k e y
c o n s o l e . l o g ( r a n d o m K e y )
` ` `
# # # d e v i c e R e g i s t e r . r e g i s t e r ( O b j e c t o p t i o n s , F u n c t i o n c a l l b a c k )
R e g i s t e r a d e v i c e w i t h B a l e n a .
* * N o t i c e * * : Y o u c a n u s e t h i s f u n c t i o n a s a p r o m i s e i f y o u o m i t t h e ` c a l l b a c k ` a r g u m e n t .
T h e ` o p t i o n s ` o b j e c t r e q u i r e s t h e f o l l o w i n g p r o p e r t i e s :
- ` N u m b e r u s e r I d ` : T h e u s e r i d - o p t i o n a l .
- ` N u m b e r a p p l i c a t i o n I d ` : T h e a p p l i c a t i o n i d .
- ` S t r i n g u u i d ` : T h e d e v i c e ' s U U I D .
- ` S t r i n g d e v i c e T y p e ` : T h e d e v i c e t y p e s l u g .
- ` S t r i n g d e v i c e A p i K e y ` : T h e A P I k e y t o c r e a t e f o r t h e n e w l y r e g i s t e r e d d e v i c e .
- ` S t r i n g p r o v i s i o n i n g A p i K e y ` : T h e p r o v i s i o n i n g A P I K e y .
- ` S t r i n g a p i E n d p o i n t ` : T h e A P I e n d p o i n t .
T h e ` c a l l b a c k ` g e t s c a l l e d w i t h t w o a r g u m e n t s : ` ( e r r o r , d e v i c e I n f o ) ` , w h e r e ` d e v i c e I n f o ` i s a n o b j e c t c o n t a i n i n g o n e p r o p e r t y : t h e ` i d ` f o r t h e d e v i c e t h a t w a s j u s t r e g i s t e r e d .
E x a m p l e :
` ` ` c o f f e e
d e v i c e R e g i s t e r . r e g i s t e r
u s e r I d : 1 9 9
a p p l i c a t i o n I d : 1 0 3 5 0
u u i d : ' . . . '
d e v i c e T y p e : ' r a s p b e r r y - p i '
d e v i c e A p i K e y : ' . . . '
p r o v i s i o n i n g A p i K e y : ' . . . '
a p i E n d p o i n t : ' h t t p s : / / a p i . b a l e n a - c l o u d . c o m '
, ( e r r o r , d e v i c e I n f o ) - >
t h r o w e r r o r i f e r r o r ?
c o n s o l e . l o g ( d e v i c e I n f o ) # { i d }
` ` `
T e s t s
- - - - -
R u n t h e t e s t s u i t e b y d o i n g :
` ` ` s h
$ n p m t e s t
` ` `
C o n t r i b u t e
- - - - - - - - - -
- I s s u e T r a c k e r : [ g i t h u b . c o m / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e / i s s u e s ] ( h t t p s : / / g i t h u b . c o m / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e / i s s u e s )
- S o u r c e C o d e : [ g i t h u b . c o m / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e ] ( h t t p s : / / g i t h u b . c o m / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e )
B e f o r e s u b m i t t i n g a P R , p l e a s e m a k e s u r e t h a t y o u i n c l u d e t e s t s , a n d t h a t [ c o f f e e l i n t ] ( h t t p : / / w w w . c o f f e e l i n t . o r g / ) r u n s w i t h o u t a n y w a r n i n g :
` ` ` s h
$ n p m r u n l i n t
` ` `
S u p p o r t
- - - - - - -
I f y o u ' r e h a v i n g a n y p r o b l e m , p l e a s e [ r a i s e a n i s s u e ] ( h t t p s : / / g i t h u b . c o m / b a l e n a - i o - m o d u l e s / b a l e n a - r e g i s t e r - d e v i c e / i s s u e s / n e w ) o n G i t H u b .
L i c e n s e
- - - - - - -
T h e p r o j e c t i s l i c e n s e d u n d e r t h e A p a c h e 2 . 0 l i c e n s e .
balena-register-device
9.0.2 • Public • PublishedVersions
Current Tags
- VersionDownloads (Last 7 Days)
- Tag
- 9.0.21,803
- latest
- 9.0.2-build-oj-test-deploy-with-new-balena-request-e99a454c8c5bc30c0db963825ccd21c93174976a-10
- build-oj-test-deploy-with-new-balena-request-e99a454c8c5bc30c0db963825ccd21c93174976a
- 9.0.2-build-oj-test-deploy-with-new-balena-request-d9c943cc36b3f3dc8cc56b3455d1017b8e8da793-10
- build-oj-test-deploy-with-new-balena-request
- 9.0.2-build-oj-test-deploy-with-new-balena-request-d9c943cc36b3f3dc8cc56b3455d1017b8e8da793-10
- build-oj-test-deploy-with-new-balena-request-d9c943cc36b3f3dc8cc56b3455d1017b8e8da793
- 9.0.2-build-oj-test-deploy-with-new-balena-request-97726e6112f1bc6a1f3785f7edac31fd44c23caf-10
- build-oj-test-deploy-with-new-balena-request-97726e6112f1bc6a1f3785f7edac31fd44c23caf
- 9.0.2-build-oj-test-deploy-with-new-balena-request-2087412e9c2ebcf7e772b4572c9218b749bdce2c-10
- build-oj-test-deploy-with-new-balena-request-2087412e9c2ebcf7e772b4572c9218b749bdce2c
- 9.0.2-build-bump-balena-request-9613c8e65e75470358ed4a435356d8856e371546-10
- build-bump-balena-request
- 9.0.2-build-bump-balena-request-9613c8e65e75470358ed4a435356d8856e371546-10
- build-bump-balena-request-9613c8e65e75470358ed4a435356d8856e371546
- 9.0.2-build-bump-balena-request-8415108a4b4f8632e4f100349103efdf34b7dea3-10
- build-bump-balena-request-8415108a4b4f8632e4f100349103efdf34b7dea3
- 9.0.2-build-bump-balena-request-2-9613c8e65e75470358ed4a435356d8856e371546-10
- build-bump-balena-request-2-9613c8e65e75470358ed4a435356d8856e371546
- 9.0.2-build-bump-balena-request-2-9613c8e65e75470358ed4a435356d8856e371546-10
- build-bump-balena-request-2
- 9.0.1-build-fix-balena-request-peer-dependency-21589a43eea60bf5e601d51bcab7b483e571fe53-10
- build-fix-balena-request-peer-dependency-21589a43eea60bf5e601d51bcab7b483e571fe53
- 9.0.1-build-fix-balena-request-peer-dependency-21589a43eea60bf5e601d51bcab7b483e571fe53-10
- build-fix-balena-request-peer-dependency
- 9.0.0-build-drop-support-to-node-14-16-cc8ad72abb414347545498f6eceab01b2fcba71a-10
- build-drop-support-to-node-14-16-cc8ad72abb414347545498f6eceab01b2fcba71a
- 9.0.0-build-drop-support-to-node-14-16-cc8ad72abb414347545498f6eceab01b2fcba71a-10
- build-drop-support-to-node-14-16
- 8.0.8-build-oj-test-deploy-with-new-balena-request-60c0867d3c634ad0e48f8769a4ddf50cc5f498bf-10
- build-oj-test-deploy-with-new-balena-request-60c0867d3c634ad0e48f8769a4ddf50cc5f498bf
- 8.0.8-build-oj-test-deploy-with-new-balena-request-0ac48d85cd5e13b2b070bcc0dde0bffe69462932-10
- build-oj-test-deploy-with-new-balena-request-0ac48d85cd5e13b2b070bcc0dde0bffe69462932
- 8.0.7-build-bump-dependencies-0cbde101fd76beeda28e2897be8414669fd1a333-10
- build-bump-dependencies-0cbde101fd76beeda28e2897be8414669fd1a333
- 8.0.7-build-bump-dependencies-0cbde101fd76beeda28e2897be8414669fd1a333-10
- build-bump-dependencies
- 8.0.6-build-update-mockttp-a8816b518f38fad92d7565508b5f5760ff874e26-10
- build-update-mockttp-a8816b518f38fad92d7565508b5f5760ff874e26
- 8.0.6-build-update-mockttp-a8816b518f38fad92d7565508b5f5760ff874e26-10
- build-update-mockttp
- 8.0.5-build-klutchell-patch-1-01aa0cbf2bfa2b1f59382ef7cba01dece6af9c34-10
- build-klutchell-patch-1-01aa0cbf2bfa2b1f59382ef7cba01dece6af9c34
- 8.0.5-build-klutchell-patch-1-01aa0cbf2bfa2b1f59382ef7cba01dece6af9c34-10
- build-klutchell-patch-1
- 8.0.4-de-resinci-yml-f579dbadf36207a93fe0acee2744331767501c1e0
- de-resinci-yml-f579dbadf36207a93fe0acee2744331767501c1e
- 8.0.4-de-resinci-yml-f579dbadf36207a93fe0acee2744331767501c1e0
- de-resinci-yml
- 8.0.3-karma-cleanup-959081c4bf2174af43f6d4538d4a64c8cd5130e60
- karma-cleanup-959081c4bf2174af43f6d4538d4a64c8cd5130e6
- 8.0.3-karma-cleanup-959081c4bf2174af43f6d4538d4a64c8cd5130e60
- karma-cleanup
- 8.0.2-add-engines-68d2fd7df55a0bec364d3c24ef1b40369adf18f30
- add-engines-68d2fd7df55a0bec364d3c24ef1b40369adf18f3
- 8.0.2-add-engines-68d2fd7df55a0bec364d3c24ef1b40369adf18f30
- add-engines
- 8.0.1-flowzonify-46d418473255582c2f0448fe4b2557404b67020b0
- flowzonify-46d418473255582c2f0448fe4b2557404b67020b
- 8.0.1-flowzonify-46d418473255582c2f0448fe4b2557404b67020b0
- flowzonify
- 7.2.1-surface-uncaught-exception-details-b2b1ec724485663711e565a849285b578ff22b4c0
- surface-uncaught-exception-details-b2b1ec724485663711e565a849285b578ff22b4c
- 6.1.4-improve-single-test-7cf0c54650f55fa0c9c587e2928958223e37cb210
- improve-single-test-7cf0c54650f55fa0c9c587e2928958223e37cb21
- 8.0.8-build-oj-test-deploy-with-new-balena-request-4975c2e44120cd606ef8e29dc9785f475c6999ba-11
- build-oj-test-deploy-with-new-balena-request-4975c2e44120cd606ef8e29dc9785f475c6999ba
Version History
- VersionDownloads (Last 7 Days)
- Published
- 9.0.21,803
- 9.0.2-build-bump-balena-request-2-9613c8e65e75470358ed4a435356d8856e371546-10
- 9.0.2-build-bump-balena-request-9613c8e65e75470358ed4a435356d8856e371546-10
- 9.0.2-build-bump-balena-request-8415108a4b4f8632e4f100349103efdf34b7dea3-10
- 9.0.2-build-oj-test-deploy-with-new-balena-request-d9c943cc36b3f3dc8cc56b3455d1017b8e8da793-10
- 9.0.2-build-oj-test-deploy-with-new-balena-request-97726e6112f1bc6a1f3785f7edac31fd44c23caf-10
- 9.0.2-build-oj-test-deploy-with-new-balena-request-2087412e9c2ebcf7e772b4572c9218b749bdce2c-10
- 9.0.2-build-oj-test-deploy-with-new-balena-request-e99a454c8c5bc30c0db963825ccd21c93174976a-10
- 9.0.1842
- 9.0.1-build-fix-balena-request-peer-dependency-21589a43eea60bf5e601d51bcab7b483e571fe53-10
- 9.0.00
- 9.0.0-build-drop-support-to-node-14-16-cc8ad72abb414347545498f6eceab01b2fcba71a-10
- 8.0.8-build-oj-test-deploy-with-new-balena-request-0ac48d85cd5e13b2b070bcc0dde0bffe69462932-10
- 8.0.8-build-oj-test-deploy-with-new-balena-request-4975c2e44120cd606ef8e29dc9785f475c6999ba-11
- 8.0.8-build-oj-test-deploy-with-new-balena-request-60c0867d3c634ad0e48f8769a4ddf50cc5f498bf-10
- 8.0.7924
- 8.0.7-build-bump-dependencies-0cbde101fd76beeda28e2897be8414669fd1a333-10
- 8.0.60
- 8.0.6-build-update-mockttp-a8816b518f38fad92d7565508b5f5760ff874e26-10
- 8.0.572
- 8.0.5-build-klutchell-patch-1-01aa0cbf2bfa2b1f59382ef7cba01dece6af9c34-10
- 8.0.446
- 8.0.4-de-resinci-yml-f579dbadf36207a93fe0acee2744331767501c1e0
- 8.0.30
- 8.0.3-karma-cleanup-959081c4bf2174af43f6d4538d4a64c8cd5130e60
- 8.0.20
- 8.0.2-add-engines-68d2fd7df55a0bec364d3c24ef1b40369adf18f30
- 8.0.10
- 8.0.1-flowzonify-46d418473255582c2f0448fe4b2557404b67020b0
- 8.0.037
- 8.0.0-uuid-9-32c19504ca79ec134b34e30a4e6a52157a7b0bd60
- 8.0.0-uuid-9-8746b5c13b9e4a5453130daca03d965159c08d9d0
- 7.2.1-surface-uncaught-exception-details-b2b1ec724485663711e565a849285b578ff22b4c0
- 7.2.0736
- 7.2.0-support-additional-fields-6f10fe77ba11ec57bb012777975423dda498a8bd0
- 7.1.10
- 7.1.1-update-deps-8d78459d6cf6e0dcaa4721c38898eeb2d25c56740
- 7.1.03
- 7.1.0-switch-to-randomstring-596a76abcf0a76aef93d191e4c59b939701c80b80
- 7.0.10
- 7.0.1-add-changelog-yml-7444f4ba2538180a5c75fa5f62de6f395ae28ba70
- 7.0.00
- 7.0.0-7-x-f4008dad3de415cc25987268b387848fc3ed12000
- 7.0.0-7-x-3ff55cfe6edaf25620a299f0af1193624fcf9c000
- 7.0.0-7-x-d4809f84ae88e9bd9c242b991c76aaf7bf1314de0
- 7.0.0-7-x-e8afc0dff0a76e6f79b836531ee37c2daa5389ae0
- 7.0.0-7-x-d355eccaa9293a41eb82cc44a70e1c7208dc141f0
- 7.0.0-7-x-07c1879565f07fa35a8966f2d443b8e745d05a220
- 7.0.0-7-x-933e42c26f327bbf94ce5302dcaa1a809ba65dc80
- 6.1.6107
- 6.1.6-export-api-error-effa651684318e8b1e336058515f467be02a4de40
- 6.1.5-export-api-error-0c3dc640992195b2bb805a3ec0b18193aad106920
- 6.1.50
- 6.1.5-convert-tests-js-d2b9af51ae9714bc076d41a1f980ba019cf9e66a0
- 6.1.40
- 6.1.4-fixed-type-error-f2be03b8cafe3dbfda30b9abf9cb7ec5a73aff0b0
- 6.1.4-fixed-type-error-5d3031cefa72eebb063eb13cb862c2efd4c39e170
- 6.1.4-improve-single-test-7cf0c54650f55fa0c9c587e2928958223e37cb210
- 6.1.30
- 6.1.3-include-full-response-in-error-bc79dbddf3e57081e9bb71e348c9ae6375c17ffc0
- 6.1.3-convert-tests-js-1e298452e79027d5663f781a947d0ea3973f59a90
- 6.1.20
- 6.1.2-update-mocha-a6677fab4254f1f3a303ff4b8bdabcb3f2f631db0
- 6.1.2-include-full-response-in-error-806f68a82e63efb828abedc3d26dc8e7d90d6e910
- 6.1.2-include-full-response-in-error-fd7649eccea3635061dbf61afad04a783c6586ee0
- 6.1.10
- 6.1.1-use-auth-header-acbbc37225033cf3b849f6a122743e3dcb37ea3c0
- 6.1.1-use-auth-header-89b019c77189abbaf53eb97856318e29da8df0170
- 6.1.1-use-auth-header-f7d43f304df0d27cca8a4c0696ad153be31e6ca40
- 6.1.00
- 6.1.0-optional-user-id-9fbce4bec49a406c2d42a07bb870fa275e6f4f340
- 6.0.10
- 6.0.1-fix-generated-key-length-6044ef0ed93f0aba05dc92be3351f4f147ac973b0
- 6.0.00
- 6.0.0-36-rename-to-balena-be77c4358f8f6fefbcaebac3ba89f3e94fc21c2b0
- 6.0.0-36-rename-to-balena-d027cc3d76c17373c977e15d22d50bd27e05218b0
- 6.0.0-36-rename-to-balena-dfbfe2c2b12bd2a54543d10c177c354acdf66fe60
- 6.0.0-36-rename-to-balena-17a53c2ddc8c17151d54e1cd0d0bfa07424b06c70
- 6.0.0-36-rename-to-balena-ff2a14e3a1f0fac1274d1c6e901b33cd9eff28e00
- 6.0.0-36-rename-to-balena-a0f1802f96ef39c298726890a9b0187c9646615e0
Package Sidebar
Install
npm i balena-register-device
Weekly Downloads
3,822
Version
9.0.2
License
Apache-2.0
Unpacked Size
26.2 kB
Total Files
5