dmai-license
Dmai license service.
Installing
Package manager
Using npm:
$ npm install dmai-license --registry=https://nexus.dm-ai.com/repository/group-npm/
Using yarn:
$ yarn config set registry https://nexus.dm-ai.com/repository/group-npm/
$ yarn add dmai-license
Once the package is installed, you can import the library using require
approach:
const { activeLicense, isActived } = require('dmai-license');
Example
const { activeLicense, isActived } = require('dmai-license');
activeLicense({ license: 'xxx' })
.then(function (response) {
// handle success
console.log(response);
// 成功
// {
// code: 0,
// msg: '[dmai-license] license activated success',
// data: {},
// error: ''
// }
// 失败
// {
// code: -1,
// msg: '[dmai-license] decrypt error, please check license',
// data: {},
// error: 'error:0407006A:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01'
// }
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});
isActived()
.then(function (response) {
// handle success
console.log(response);
// 成功 { code: 0, msg: '[dmai-license]', data: { access: true }, error: '' }
// 失败 { code: 0, msg: '[dmai-license]', data: { access: false }, error: '' }
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});
// Want to use async/await? Add the `async` keyword to your outer function/method.
async function mainAL() {
try {
const response = await activeLicense({ license: 'xxx' });
console.log(response);
// 成功
// {
// code: 0,
// msg: '[dmai-license] license activated success',
// data: {},
// error: ''
// }
// 失败
// {
// code: -1,
// msg: '[dmai-license] decrypt error, please check license',
// data: {},
// error: 'error:0407006A:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01'
// }
} catch (error) {
console.error(error);
}
}
async function mainIA() {
try {
const response = await isActived();
console.log(response);
// 成功 { code: 0, msg: '[dmai-license]', data: { access: true }, error: '' }
// 失败 { code: 0, msg: '[dmai-license]', data: { access: false }, error: '' }
} catch (error) {
console.error(error);
}
}
Release notes
1.0.0 (2023-08-16)
Release dmai license service!