Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
WebDAV, CalDAV, and CardDAV client for nodejs and the browser.
Table of Contents generated with DocToc
Perform an initial download of a caldav or carddav account's data. Returns a Promise which will be fulfilled with a dav.Account object.
Options:
(String) accountType - one of 'caldav' or 'carddav'. Defaults to 'caldav'.
(Array.<Object>) filters - list of caldav filters to send with request.
(Boolean) loadCollections - whether or not to load dav collections.
(Boolean) loadObjects - whether or not to load dav objects.
(dav.Sandbox) sandbox - optional request sandbox.
(String) server - some url for server (needn't be base url).
(String) timezone - VTIMEZONE calendar object.
(dav.Transport) xhr - request sender.
Create a calendar object on the parameter calendar. Returns a Promise which will be fulfilled when the calendar has been created.
@param {dav.Calendar} calendar the calendar to put the object on.
Options:
(String) data - rfc 5545 VCALENDAR object.
(String) filename - name for the calendar ics file.
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Persist updates to the parameter calendar object to the server. Returns a Promise which will be fulfilled when the calendar has been updated.
@param {dav.CalendarObject} calendarObject updated calendar object.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Delete the parameter calendar object on the server. Returns a Promise which will be fulfilled when the calendar has been deleted.
@param {dav.CalendarObject} calendarObject target calendar object.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Fetch changes from the remote server to the parameter calendar. Returns a Promise which will be fulfilled with an updated dav.Calendar object once sync is complete.
@param {dav.Calendar} calendar the calendar to fetch changes for.
Options:
(Array.<Object>) filters - list of caldav filters to send with request.
(dav.Sandbox) sandbox - optional request sandbox.
(String) syncMethod - either 'basic' or 'webdav'. If unspecified, will
try to do webdav sync and failover to basic sync if rfc 6578 is not
supported by the server.
(String) timezone - VTIMEZONE calendar object.
(dav.Transport) xhr - request sender.
Fetch changes from the remote server to the account's calendars. Returns a Promise which will be fulfilled with an updated dav.Account object once sync is complete.
@param {dav.Account} account the calendar account to sync.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Create a vcard object on the parameter address book. Returns a Promise which will be fulfilled when the vcard has been created.
@param {dav.AddressBook} addressBook the address book to put the object on.
Options:
(String) data - VCARD object.
(String) filename - name for the vcard vcf file.
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Persist updates to the parameter vcard object to the server. Returns a Promise which will be fulfilled when the vcard has been updated.
@param {dav.VCard} card updated vcard object.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Delete the parameter vcard object on the server. Returns a Promise which will be fulfilled when the vcard has been deleted.
@param {dav.VCard} card target vcard object.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Fetch changes from the remote server to the parameter address books. Returns a Promise which will be fulfilled with an updated dav.AddressBook object once sync is complete.
@param {dav.AddressBook} addressBook the address book to fetch changes for.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(String) syncMethod - either 'basic' or 'webdav'. If unspecified, will
try to do webdav sync and failover to basic sync if rfc 6578 is not
supported by the server.
(dav.Transport) xhr - request sender.
Fetch changes from the remote server to the account's address books. Returns a Promise which will be fulfilled with an updated dav.Account object once sync is complete.
@param {dav.Account} account the address book account to sync.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(dav.Transport) xhr - request sender.
Create a request sandbox. There is also a deprecated interface
dav.createSandbox()
. Add requests to the sandbox like so:
var sandbox = new dav.Sandbox();
// sandbox instanceof Sandbox
dav.createAccount({
username: 'Yoshi',
password: 'babybowsersoscaryomg',
server: 'https://caldav.yoshisstory.com',
sandbox: sandbox // <- Insert sandbox here!
})
.then(function(calendars) {
// etc, etc.
});
And abort sandboxed requests as a group with sandbox.abort()
.
Create a new dav.transport.Basic
object. This sends dav requests using http basic authentication.
@param {dav.Credentials} credentials user authorization.
@param {dav.Request} request object with request info.
@return {Promise} a promise that will be resolved with an xhr request after its readyState is 4 or the result of applying an optional request `transformResponse` function to the xhr object after its readyState is 4.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
Create a new dav.transport.OAuth2
object. This sends dav requests authorized via rfc 6749 oauth2.
@param {dav.Credentials} credentials user authorization.
@param {dav.Request} request object with request info.
@return {Promise} a promise that will be resolved with an xhr request after its readyState is 4 or the result of applying an optional request `transformResponse` function to the xhr object after its readyState is 4.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
Options:
(String) depth - optional value for Depth header.
(Array.<Object>) props - list of props to request.
Options:
(String) data - put request body.
(String) method - http method.
(String) etag - cached calendar object etag.
Options:
(String) depth - optional value for Depth header.
(Array.<Object>) filters - list of filters to send with request.
(Array.<Object>) props - list of props to request.
(String) timezone - VTIMEZONE calendar object.
Options:
(String) depth - optional value for Depth header.
(Array.<Object>) props - list of props to request.
Options:
(String) depth - option value for Depth header.
(Array.<Object>) props - list of props to request.
(Number) syncLevel - indicates scope of the sync report request.
(String) syncToken - synchronization token provided by the server.
Create a new dav.Client
object. The client interface allows consumers to set their credentials and transport once and then make authorized requests without passing them to each request. Each of the other, public API methods should be available on dav.Client
objects.
@param {dav.Transport} xhr - request sender.
Options:
(String) baseUrl - root url to resolve relative request urls with.
Send a request using this client's transport (and perhaps baseUrl).
@param {dav.request.Request} req - dav request.
@return {Promise} a promise that will be resolved with an xhr request after its readyState is 4 or the result of applying an optional request `transformResponse` function to the xhr object after its readyState is 4.
Options:
(dav.Sandbox) sandbox - optional request sandbox.
(String) url - relative url for request.
Object that holds various xml namespace constants.
var dav = require('dav');
var xhr = new dav.transport.Basic(
new dav.Credentials({
username: 'xxx',
password: 'xxx'
})
);
dav.createAccount({ server: 'http://dav.example.com', xhr: xhr })
.then(function(account) {
// account instanceof dav.Account
account.calendars.forEach(function(calendar) {
console.log('Found calendar named ' + calendar.displayName);
// etc.
});
});
// Or, using the dav.Client interface:
var client = new dav.Client(xhr);
// No transport arg
client.createAccount({
server: 'http://dav.example.com',
accountType: 'carddav'
})
.then(function(account) {
account.addressBooks.forEach(function(addressBook) {
console.log('Found address book name ' + addressBook.displayName);
// etc.
});
});
Caution: The lower-level request api is undergoing some major reworking with frequent changes which will break consumers upgrading from earlier versions. If you're looking for a stable api and can live with the higher-level CalDAV and/or CardDAV abstractions, I strongly recommend those since that api is largely stable.
var dav = require('dav');
var client = new dav.Client(
new dav.transport.Basic(
new dav.Credentials({
username: 'xxx',
password: 'xxx'
})
),
{
baseUrl: 'https://mail.mozilla.com'
}
);
var req = dav.request.basic({
method: 'PUT',
data: 'BEGIN:VCALENDAR\nEND:VCALENDAR',
etag: '12345'
});
// req instanceof dav.Request
client.send(req, '/calendars/123.ics')
.then(function(response) {
// response instanceof XMLHttpRequest
});
Or perhaps without the client:
var dav = require('dav');
var xhr = new dav.transport.Basic(
new dav.Credentials({
username: 'xxx',
password: 'xxx'
})
);
// xhr instanceof dav.Transport
var req = dav.request.basic({
method: 'PUT',
data: 'BEGIN:VCALENDAR\nEND:VCALENDAR',
etag: '12345'
});
// req instanceof dav.Request
xhr.send(req, 'https://mail.mozilla.com/calendars/123.ics')
.then(function(response) {
// response instanceof XMLHttpRequest
});
For more example usages, check out the suite of integration tests.
dav can tell you a lot of potentially useful things if you set dav.debug.enabled = true
.
FAQs
WebDAV, CalDAV, and CardDAV client for nodejs and the browser
The npm package dav receives a total of 305 weekly downloads. As such, dav popularity was classified as not popular.
We found that dav demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.