diff --git a/lib/anthropic.js b/lib/anthropic.js index 5efad2f..809b399 100644 --- a/lib/anthropic.js +++ b/lib/anthropic.js @@ -3,7 +3,7 @@ // https://github.com/gnh1201/welsonjs // // ***SECURITY NOTICE*** -// Anthropic/Claude requires an internet connection. Data may be transmitted externally. Users must also comply with the terms of use and the privacy policy. +// Anthropic/Claude requires an internet connection, and data may be transmitted externally. Users must adhere to the terms of use and privacy policy. // - Privacy Policy: https://www.anthropic.com/legal/privacy // var FILE = require("lib/file"); diff --git a/lib/chatgpt.js b/lib/chatgpt.js index 7a0e8fa..7d624bd 100644 --- a/lib/chatgpt.js +++ b/lib/chatgpt.js @@ -3,7 +3,7 @@ // https://github.com/gnh1201/welsonjs // // ***SECURITY NOTICE*** -// ChatGPT requires an internet connection. Data may be transmitted externally. Users must also comply with the terms of use and the privacy policy. +// ChatGPT requires an internet connection, and data may be transmitted externally. Users must adhere to the terms of use and privacy policy. // - Privacy Policy: https://openai.com/policies/row-privacy-policy/ // var FILE = require("lib/file"); diff --git a/lib/groq.js b/lib/groq.js index fc1c7d9..ca99729 100644 --- a/lib/groq.js +++ b/lib/groq.js @@ -3,7 +3,7 @@ // https://github.com/gnh1201/welsonjs // // ***SECURITY NOTICE*** -// Groq requires an internet connection. Data may be transmitted externally. Users must also comply with the terms of use and the privacy policy. +// Groq requires an internet connection, and data may be transmitted externally. Users must adhere to the terms of use and privacy policy. // - Privacy Policy: https://groq.com/privacy-policy/ // var FILE = require("lib/file"); diff --git a/lib/punycode.js b/lib/punycode.js index 1274911..737cd37 100644 --- a/lib/punycode.js +++ b/lib/punycode.js @@ -3,7 +3,7 @@ // https://github.com/gnh1201/welsonjs // // ***SECURITY NOTICE*** -// The Punycode (IDN) library requires an internet connection. Data may be transmitted externally. Users must also comply with the terms of use. +// The Punycode (IDN) library requires an active internet connection. Data may be transmitted externally, and users must adhere to the terms of use. // - Privacy Policy: https://policy.catswords.social/site_terms.html // - Terms of Service: https://policy.catswords.social/site_extended_description.html // diff --git a/lib/totp.js b/lib/totp.js new file mode 100644 index 0000000..84ede51 --- /dev/null +++ b/lib/totp.js @@ -0,0 +1,44 @@ +// totp.js +// TOTP library for WelsonJS framework +// Namhyeon Go +// https://github.com/gnh1201/welsonjs +// +// ***SECURITY NOTICE*** +// The TOTP library requires an internet connection, and data may be transmitted externally. Users must adhere to the terms of use and privacy policy. +// - Privacy Policy: https://policy.catswords.social/site_terms.html +// - Terms of Service: https://policy.catswords.social/site_extended_description.html +// +var JsonRpc2 = require("lib/jsonrpc2"); + +function getPubKey() { + var rpc = JsonRpc2.create("https://public-api.catswords.net"); + var result = rpc.invoke("relay_invoke_method", { + "method": "load_script", + "requires": [ + "https://raw.githubusercontent.com/dimamedia/PHP-Simple-TOTP-and-PubKey/refs/heads/master/class.tfa.php" + ], + "args": [ + "$tfa = new tfa(); return $tfa->getPubKey()" + ] + }, ""); + + return result.data; +} + +function getOtp() { + var rpc = JsonRpc2.create("https://public-api.catswords.net"); + var result = rpc.invoke("relay_invoke_method", { + "method": "load_script", + "requires": [ + "https://raw.githubusercontent.com/dimamedia/PHP-Simple-TOTP-and-PubKey/refs/heads/master/class.tfa.php" + ], + "args": [ + "$tfa = new tfa(); return $tfa->getOtp()" + ] + }, ""); + + return result.data; +} + +exports.getPubKey = getPubKey; +exports.getOtp = getOtp;