1'use strict';
2
3var kv = require('kv');
4function setDeviceInfo(pk, ps) {
5    if (!pk || !ps) {
6        throw new Error('params is invalid');
7    }
8
9    var productkey_key = '_amp_internal_productkey';
10    var productsecret_key = '_amp_internal_productsecret';
11
12    kv.setStorageSync(productkey_key, pk);
13    kv.setStorageSync(productsecret_key, ps);
14}
15
16function setToken(token) {
17    if(!token) {
18        throw new Error("invalid params");
19    }
20
21    var token_key = '_amp_device_token';
22    kv.setStorageSync(token_key, token);
23}
24
25function getToken() {
26    return kv.getStorageSync('_amp_device_token');
27}
28
29module.exports = {
30    setDeviceInfo,
31    setToken,
32    getToken
33}