Last active
January 24, 2021 11:09
-
-
Save Kyiro/0ea1fcb85439bf57dc7fbe678a305a4e to your computer and use it in GitHub Desktop.
Example Node script for Decoding/Encoding the keychain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Decode the AES key | |
// Example: Ced0+UTeTBbDhnHM9mLTk5qxlz3YZK6dEn1U+NTxOko= | |
// Output: 09e774f944de4c16c38671ccf662d3939ab1973dd864ae9d127d54f8d4f13a4a | |
function decode(string) { | |
return Buffer.from(string, 'base64').toString('hex') | |
} | |
// Encode the AES key (without 0x) for the keychain | |
// Example: 581D53157B01D82CB0CDBD7A859D8774173C5F516C4D5AB3943C21C893BC3DC7 | |
// Output: WB1TFXsB2Cywzb16hZ2HdBc8X1FsTVqzlDwhyJO8Pcc= | |
function encode(key) { | |
return Buffer.from(key, 'hex').toString('base64') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment