This repository is part of Triton Data Center. For contribution guidelines, issues, and general documentation, visit the main Triton project page.
This is the client for Mahi. When talking to mahi, translation and authentication responses are cached. node-mahi also contains the authorization API.
node-mahi supports two authentication methods:
verifySignature(opts, cb)- Verifies SSH key signatures
getUserByAccessKey(accessKeyId, cb)- Look up user by access key IDverifySigV4(request, cb)- Verify AWS Signature Version 4 authentication
For S3 API compatibility, use the SigV4 authentication methods:
var mahi = require('node-mahi').createClient({
url: 'http://mahi.example.com'
});
// Look up user by access key (for S3 gateway integration)
mahi.getUserByAccessKey('AKIA123456789EXAMPLE', function(err, user) {
if (err) {
console.error('Access key lookup failed:', err);
return;
}
console.log('User:', user.login);
});
// Verify SigV4 signature
mahi.verifySigV4(httpRequest, function(err, result) {
if (err) {
console.error('SigV4 verification failed:', err);
return;
}
console.log('Authentication successful:', result.accessKeyId);
});TBD
Testing requires a Mahi server instance. Point MAHI_TEST_URL at an existing
server that has been bootstrapped with the
Mahi test data
and run make test.