How do I generate a content hash using sha256 hash of the request body content, using the private api key with Wix Corvid - hash

I am seeking any information attainable in reference to creating a content hash. I am very new to the coding world and would appreciate any feedback. I have searched the Wix API Documentation and am unable to find any information pertaining to this in the forum either.

You need to install npm package into Wix. For example:
js-sha256
Then you can use this code only in backend side:
var sha256 = require('js-sha256');
export async function testSha256(param) {
let p = await sha256.sha256(param);
return p;
}
Then call this script from frontend, like as:
let hashed = await testSha256('test');

Related

"Invalid API Key provided" using the stripe extension in firebase cloud functions

having a problem that when I try to run my cloud function where my secret key is being perceived as invalid. I am 99.99% sure that it is the same as is in the Stripe dashboard and have copied and pasted 100 times so I think it is something else.
{success: false, error: Invalid API Key provided: sk_test_**********************************************************************************************************************************************************************************************************}
If anyone could help that would be fantastic.
Can you double check if there's any extra empty space characters being added to the API key that you specified in the cloud function? Or if you are reading the API key from a config file, try hardcode it directly to the code and see if it solves the problem.
Initial thoughts...
Ensure you have setup a restricted key with the specified security.
Could this be an issue with the secret manager, invalidating your key here and reconfiguring https://console.cloud.google.com/security/secret-manager?referrer=search&project={your-project-id} may fix the issue.
If you install a new instance, do you still have the same issue?
If you can run locally, does the key work ok in small nodejs project for example, depending on which extension you are using:
import Stripe from 'stripe';
// invoices extension: apiVersion: '2020-03-02',
// payments extension: apiVersion = '2020-08-27';
const stripe = new Stripe('sk_test_...', {
apiVersion: '2022-11-15',
});
const createCustomer = async () => {
const params: Stripe.CustomerCreateParams = {
description: 'test customer',
};
const customer: Stripe.Customer = await stripe.customers.create(params);
console.log(customer.id);
};
createCustomer();

How to get the coordinates from the address using google map

I'm trying to get the coordinates from the address which user input,using flutter_google_places but here is gives me error
{candidates: [], error_message: You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account, status: REQUEST_DENIED}
here is my code
static Future<String> getPlaceId(String input) async {
final String url =
"https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=$input&inputtype=textquery&key$googleApiKey";
var response = await http.get(Uri.parse(url));
Map<String, dynamic> json = jsonDecode(response.body);
print(json);
var placeId = json['candidates'][0]['place_id'] as String;
return placeId;
}
i added the key too, but it gives me this error, please help how to do this or this is there any other to get the coordinates from user input address.
There are a few steps you have to make sure you complete. First, make sure your API key is not restricted for your device. You can either set the key to restrict none or just add your authentic key to the API key. And get the access.
Also basic stuff. Make sure all the needed SDK's are activated for your project. And It would be better if you can provide some more data. That would be kinda helpful. Also don't forget to add your api key to the xml file inside your android project. if you're doing it for android.
(BTW the issue is with your credentials. First solve that. Then you can find the way to get the coordinates. It's pretty easy. You're already there.)

Working with URL parameters in custom Kibana plugin

I am working on a custom plugin to Kibana (7.5.2). The plugin is of type 'app'. I would like to be able to pass parameters to this plugin in order to pre-load some data from Elasticsearch. I.e., I need to provide users with some specific URLs containing parameters that will be used by the plugin to show only a relevant portion of data.
My problem is that I was not able to find sufficient documentation on this and I do not know what the correct approach should be. I will try to summarize what I know/have done so far:
I have read the official resources on plugin development
I am aware of the fact that _g and _a URL parameters are used to pass state in Kibana applications. However, a) I am not sure if this is the correct approach in my case and b) I also failed to find any information on how my plugin should access the data from these parameters.
I checked the sources of other known plugins, but again, failed to find any clues.
I am able to inject some configuration values using injectUiAppVars in the init method of my plugin (index.js) and retrieve these values in my app (main.js):
index.js:
export default function (kibana) {
return new kibana.Plugin({
require: ['elasticsearch'],
name: ...,
uiExports: {
...
},
...
init(server, options) { // eslint-disable-line no-unused-vars
server.injectUiAppVars('logviewer', async () => {
var kibana_vars = await server.getInjectedUiAppVars('kibana');
var aggregated_vars = { ...kibana_vars, ...{ mycustomparameter: "some value" } }
return aggregated_vars
});
...
}
});
}
main.js
import chrome from 'ui/chrome';
. . .
const mycustomparameter = chrome.getInjected('mycustomparameter');
Providing that I manage to obtain parameters from URL, this would allow me to pass them to my app (via mycustomparameter), but again, I am not sure if this approach is correct.
I tried to get some help via the Elastic forum, but did not receive any answer yet.
My questions
1. Is there any source of information on this particular topic? I am aware of the fact that the plugin API changes frequently, hence I do not expect to find an extensive documentation. Maybe a good example?
Am I completely off course with the way I am trying to achieve it?
Thanks for reading this, any help would be much appreciated!

Add a subpanel record to a SugarCRM account through REST API

Question: How do I create a subpanel record through the SugarCRM rest api endpoint for accounts?
Steps taken so far:
I've added a new package called, "transactionHistory" with a module named, "InvoiceHistory" using the SugarCRM studio.
I added a One to Many relationship to the Accounts module using studio.
I'm using NetSuite to push new invoices to the new module's record via the subpanel "create" option. Here's the code I'm using:
function createSugarTransaction(transaction, token) {
var url = 'https://crm.techsoft3d.com/rest/v10/Accounts/' + transaction.customer;
var headers = {
"Content-Type": "application/json",
"OAuth-Token": token
};
var now = (new Date()).toISOString();
var body = {transactionHistory_InvoiceHistory:
{
create: [{
name: transaction.docId,
transaction_date_c: transaction.date,
invoice_status_c: transaction.status,
due_date_c: transaction.duedate,
total_amount_c: transaction.total,
amount_due_c: transaction.remaining,
start_date_c: transaction.startdate,
end_date_c: transaction.enddate
}]
}
};
var response = nlapiRequestURL(url, JSON.stringify(body), headers, 'PUT');
return response;
}
The transaction object has been validated and the json object within the create: [] array has matching sugar fields (key) with the corresponding transaction object values.
When making the API call to sugar I'm successfully authenticated and have access to the custom module and accounts - so no problem there. However, when the call is returned to response it's showing the following error:
{"error":"no_method","error_message":"Could not find a route with 1 elements"}
I'm unsure of what else is needed in order for the record to be created. According to sugar's help documentation and developer community this should work. I'm using the basic information provided by sugarcrm support portal:
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.6/API/Web_Services/Examples/v10/module_POST/
According to other blog posts within the developer community, it should be as simple as adding the subpanel name, followed by an array of fields under the "create" object... similar to this:
var requestBody = { package_module:create[{name:value}]};
My initial thinking of what's wrong is:
1. my package_module name isn't correct, but I'm unable to find it anywhere within the applicaiton or help documentation.
2. the request body isn't formatted properly, even though it's structure was copied from this article https://developer.sugarcrm.com/2014/02/28/sugarcrm-cookbook2/
Any help would be appreciated.
try the createRelatedRecord api endpoint
type {sugarurl}/rest/v10/help to see a list of endpoints to look through, most of which have documentation and examples
https://crm.techsoft3d.com/rest/v10/help
your API url should have the name of the link (relationship) you want, in addition to the values in the POST payload
https://crm.techsoft3d.com/rest/v10/Accounts/{transaction.customer}/link/accounts_transactionhistory (or whatever your link's name is)
per the documentation for this endpoint, you just specify the field values in the payload
{
"first_name":"Bill",
"last_name":"Edwards"
}

Meteor Method to send a public MongoDB document without publishing everything

new to meteor and mongo.
I have some JSON stored in mongo that I want to publicly expose via an obfuscated token without using something like:
//app/models/stuff.js
Stuff = new Mongo.Collection("stuff");
Meteor.publish("stuff", function (){
return Stuff.find();
});
//additionally, the client-side subscription
I only want to expose the files that the client directly requests via a URL routing parameter or some sort of client side identifier (like a textfield where you can type the code/token in)
e.g., http://website.com/view/abcdefghijklmnop
Anyone with knowledge of the link can type it in, and get the file. However, there should be no way to just get every file without being given every token.
I was wondering if this was the best way to accomplish the task:
//app/server/stuff.js
Meteor.methods({
getStuff: getStuff
});
function getStuff(stuffId) {
var result = Stuff.find({_id: stuffId});
return result;
}
then
//app/client/stuff.js
var json = Meteor.call('getStuff', 'abcdefghijklmnop');
Why not just publish the requested document?
Meteor.publish('stuff', function (id){
check(id, String);
return Stuff.find(id);
});