Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@usit-wapp/mobile-nettskjema-js
Advanced tools
Utility library for interacting with Nettskjema from React-Native. Provides an API for fetching forms, creating submissions from key-value dictionaries of codebook values and delivering to Nettskjema.
This libary also exports a Queue service that can keep track of, deliver, and locally delete submissions, while keeping the submissions locally encrypted in the app's storage area.
yarn add @usit-wapp/mobile-nettskjema-js react-native-keychain @react-native-community/netinfo react-native-get-random-values react-native-fs
module.exports = {
dependencies: {
'@usit-wapp/mobile-nettskjema-js': {
platforms: {
android: null,
ios: null,
},
},
},
};
npx pod-install
(if you are using attachment delivery, modify the Podfile as described below first)If you are going to deliver attachments, do also:
kotlinVersion = "1.6.21"
to your app/build.gradle
-file (below minimumSdkVersion
) and set minimumSdkVersion = 23
(or higher).ios/Podfile
and for the project's Xcode settings.npx pod-install
Notes:
If you want to use the built in delivery queue do the following:
After installing, wrap your app with the NettskjemaProvider
and supply it with a statically defined instance of NettskjemaQueue
.
import { NettskjemaQueue } from '@usit-wapp/mobile-nettskjema-js';
export const queue = new NettskjemaQueue();
const WrappedApp = () => {
return (
<NettskjemaProvider queue={queue}>
<MyApp />
</NettskjemaProvider>
);
};
This will automatically initialize the delivery queue, and make it available in the app's context. You can then import and use useQueue
and useQueuedSubmissions
to get access to the queue and its data.
import {formSpecification} from '@usit-wapp/mobile-nettskjema-js';
const getForm = async (formId) => {
try {
const formSpec = await formSpecification(formId);
return formSpec;
} catch (error) {
console.error(error.message); // Form was set up incorrectly or failed to fetch
}
}
import {submissionCreator} from '@usit-wapp/mobile-nettskjema-js';
const createSubmission = (formSpec, answers) => {
try {
const submission = submissionCreator(formSpec)(answers);
return submission;
} catch (error) {
console.error(error.message); // Malformed or invalid answers (missing required answers, number in number field too high or low, etc.)
}
};
import {useQueue} from '@usit-wapp/mobile-nettskjema-js';
const DeliverButton = ({submission}) => {
const [queue] = useQueue();
return <Button onPress={() => {queue.add(submission)}} />;
};
Once the submission is added to the queue, it will by default try to deliver it to Nettskjema.
If it fails, it is up to the app to routinely call queue.deliverAll()
to deliver all undelivered submissions. Could be triggered when the app comes in to focus, or you can let the user trigger manual delivery of specific submissions (especially if the user is delivering large files manually).
Auto submission preference can also be changed by calling queue.setAutoSubmissionPreference()
with the values 'NEVER'
or 'ONLY_WITH_WIFI'
('ALWAYS'
is the default) every time the queue is set up. ONLY_WITH_WIFI
will only attempt delivery if @react-native-community/netinfo
is installed and wifi is connected when the submission is added to the queue (manually triggering delivery using deliverAll
or _deliverSingle
ignores auto submission preference).
FAQs
Delivery library for Nettskjema in react-native
We found that @usit-wapp/mobile-nettskjema-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.