Import IKAR messenger client and server
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// Test key is held in memory only; the production app uses Android Keystore.
|
||||
const crypto = require('node:crypto');
|
||||
const readline = require('node:readline');
|
||||
const key = crypto.generateKeyPairSync('ec', {namedCurve: 'prime256v1'});
|
||||
const publicKey = key.publicKey.export({type: 'spki', format: 'der'});
|
||||
console.log(JSON.stringify({installationId: crypto.createHash('sha256').update(publicKey).digest('hex').slice(0,32), devicePublicKey: publicKey.toString('base64')}));
|
||||
readline.createInterface({input: process.stdin}).on('line', line => {
|
||||
console.log(crypto.sign('sha256', Buffer.from(line, 'base64'), {key: key.privateKey, dsaEncoding: 'der'}).toString('base64'));
|
||||
});
|
||||
Reference in New Issue
Block a user