device-check 2.3.1
Install from the command line:
Learn more about npm packages
$ npm install @floornfts/device-check@2.3.1
Install via package.json:
"@floornfts/device-check": "2.3.1"
About this version
A Promise-based Node.js client for the Apple device check API. https://developer.apple.com/documentation/devicecheck/accessing_and_modifying_per-device_data
npm install device-check
const deviceCheck = new DeviceCheck(ApiHost.DEVELOPMENT);
const key = readFileSync('key.p8').toString();
const jwt = jsonwebtoken.sign({}, key, { algorithm: 'ES256', keyid: 'AP00LNP89K', issuer: 'PJK0EZJ3I6' });
try {
const queryResult = await deviceCheck.QueryDevice(jwt, {
device_token: 'aDeviceToken',
// Optional, will be set as Date.now() if omitted
timestamp: Date.now()
// Optional, will be set as V4 UUID if omitted
transaction_id: 'aTransactionId'
});
} catch (err) {
console.log(err);
}
const key = readFileSync('key.p8').toString();
const jwt = jsonwebtoken.sign({}, key, { algorithm: 'ES256', keyid: 'AP00LNP89K', issuer: 'PJK0EZJ3I6' });
try {
await deviceCheck.UpdateDevice(jwt, {
device_token: 'aDeviceToken',
// Optional, will be default to Date.now() if omitted
timestamp: Date.now()
// Optional, will be default to V4 UUID if omitted
transaction_id: 'aTransactionId'
bit0: true,
bit1: false
});
} catch (err) {
console.log(err);
}
const key = readFileSync('key.p8').toString();
const jwt = jsonwebtoken.sign({}, key, { algorithm: 'ES256', keyid: 'AP00LNP89K', issuer: 'PJK0EZJ3I6' });
// Will throw if device token is invalid
try {
await deviceCheck.ValidateDevice(jwt, {
device_token: 'aDeviceToken',
// Optional, will be default to Date.now() if omitted
timestamp: Date.now()
// Optional, will be default to V4 UUID if omitted
transaction_id: 'aTransactionId'
});
} catch (err) {
console.log(err);
}
Details
- device-check
-
floornfts
- 4 months ago
- MIT
- 9 dependencies
Assets
- device-check-2.3.1.tgz
Download activity
- Total downloads 2,647
- Last 30 days 672
- Last week 87
- Today 5