
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
native-calendar-api
Advanced tools
A javascript wrapper with a promise api for using the cordova native calendar plugin
#Native Calendar A promise wrapper for Cordova Calendar Plugin
Overall goal is to add an easier workflow to the calendar plugin and add some error checking that doesn't exist in the current plugin.
#Install
npm install --save native-calendar-api
#Example use:
The original api was callbacks and you couldn't call an operation before the last operation had finished. This made handling a large array of events difficult to manage. Using this api you can now do something like:
import CalendarApi from 'native-calendar-api';
import YourLogger from 'some-lib';
CalendarApi.setup('MyApp-', 'Custom Error Prefix:');
function sampleCreateFromArray(events) {
return events.reduce((curr, next) => {
return curr.then(() => {
return CalendarApi.newEvent(next);
});
}, P.resolve());
}
sampleCreateFromArray(eventArray)
.then(() => {
// execute some cleanup of the events after they have been added
})
.catch((err) => {
YourLogger.log(err);
});
#Class NativeCalendar
##Properties
##Methods
###setup(titlePrefix, errorPrefix) (should be called after plugin is loaded)
Initiates the calendar and error properties. Will console.warn if window.plugin.calendar doesn't exist
###clearErrors()
Resets the error object. This should be called after the errors have been consumed.
###validDate(date)
args date: expected to be a JavaScript date object
returns: true or false
###isValid(event) Used internally but can be called direction to valide your event objects
args event: expected to be a valid event object with the properties title: String location: String notes: String startDate: Date endDate: Date
returns: true or false
When this method is called it will return true if all fields are valid on the event object. If false is returned it will append the errors to the errors property. When used internally the promise will be rejected with the error messages.
###newEvent(event)
args event: a valid event object
returns: promise
In the case that the event is invalid this will be rejected and return an error object with all the errors. You can then log this output to your production logger such as:
import CalendarApi from 'native-calendar-api';
import YourLogger from 'some-lib';
CalendarApi.setup('MyApp-', 'Custom Error Prefix:');
const invalidEvent = {};
CalendarApi.newEvent(invalidEvent).catch((err) => {
YourLogger.log(err);
});
###deleteEvent(event)
args event: a valid event object
returns: promise
In the case that the event is invalid this will be rejected and return an error object with all the errors. You can then log this output to your production logger such as:
import CalendarApi from 'native-calendar-api';
import YourLogger from 'some-lib';
CalendarApi.setup('MyApp-', 'Custom Error Prefix:');
const invalidEvent = {};
CalendarApi.deleteEvent(invalidEvent).catch((err) => {
YourLogger.log(err);
});
###convertFindEventToDeleteEvent() Meant for internal use but can be used to convert an object returned from a find in the NativeCalendar to a valid event for deletion. This is an issue due to the fact that the plugin returns a string rather than a date object. Be careful using this as it will always return a valid object meaning if you pass it nothing you will get a valid Event back initiated to now with a duration of 0
###convertFindDateToJavaScriptDate(date) Converts a date string returned by the plugin into a valid JavaScript date.
###getDefaultBlankObject()
###asyncCreateEvent(event)
###asyncCreateEventWithOptions(event, options)
###asyncCreateEventInteractively(event)
###asyncCreateEventInteractivelyWithOptions(event, options)
###asyncFindEvent(event)
###asyncDeleteEventById(id)
###asyncFindEventWithOptions(event, options)
###asyncDeleteEvent(event)
###asyncListCalendars()
###asyncDeleteEventFromNamedCalendar(event, calendarName)
FAQs
A javascript wrapper with a promise api for using the cordova native calendar plugin
The npm package native-calendar-api receives a total of 0 weekly downloads. As such, native-calendar-api popularity was classified as not popular.
We found that native-calendar-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.