Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@privacybydesign/irma-backend
Advanced tools
This module can be used for handling messages from and to the
irma server
in the following way:
const IrmaBackend = require('@privacybydesign/irma-backend');
const irmaBackend = new IrmaBackend(serverUrl, options);
serverUrl
should be the URL where your irma server
is running.options
(optional) specifies a struct where additional options can be specified.
We currently support the following options:
serverToken
field to enable
requestor authentication.
By default this field is set to false
, meaning that no authorization headers will be sent.
The default setting can only be used if the IRMA server is configured to
accept unauthenticated requests or when only sending signed JWT session requests.debugging
field to enable printing helpful output to the console for debugging.
By default this field is set to false
.startSession(request)
This method starts a session at the IRMA server. The request
parameter may either
be a session request object
or a signed JWT session request.
The function returns a promise which on resolve gives the session identifiers
{sessionPtr: ..., token: ...}
.
cancelSession(sessionToken)
This method cancels the session with token sessionToken
at the IRMA server. The parameter
sessionToken
concerns the token as being returned by startSession
. It returns a promise.
On resolve the session is cancelled successfully.
getSessionResult(sessionToken)
This method fetches the session result object. The parameter sessionToken
concerns the token
as being returned by startSession
. It returns a promise which on resolve gives the session
result object.
When the result is not available yet, the promise is rejected.
getSessionResultJwt(sessionToken)
This method behaves the same as getSessionResult
, but fetches the
session result JWT instead.
getSessionStatus(sessionToken)
This method fetches the current status
of the IRMA session. The parameter sessionToken
concerns the token as being returned by
startSession
. The function returns a promise which on resolve gives the current session status.
A struct with the possible values for the session status can be retrieved using the static call
IrmaBackend.SessionStatus
.
getServerPublicKey()
This method fetches the JWT public key of the IRMA server. It returns a promise which on resolve gives the public key in a PEM encoded string. When no JWT public key is configured at the IRMA server, the promise will be rejected.
Important remark: when using method hmac
for JWT signing, the same key is used for both
signing and verification. This means in this case there is no public key and therefore this
function will also not return one.
subscribeStatusEvents(sessionToken, eventCallback)
With this method you can subscribe on receiving events on status updates of a particular IRMA
session. The parameter sessionToken
concerns the token as being returned by startSession
.
The parameter eventCallback
concerns a 'error-first' callback function to receive the events.
The callback function signature is (error, status) => {}
. When error is being null
, the status
parameter will contain the new session status.
A struct with the possible values for the session status can be retrieved using the static call
IrmaBackend.SessionStatus
.
Below a small example of how irma-backend
can be used:
const IrmaBackend = require('@privacybydesign/irma-backend');
const irmaBackend = new IrmaBackend(serverUrl, options);
const irmaRequest = {
'@context': 'https://irma.app/ld/request/disclosure/v2',
'disclose': [
[
[ 'irma-demo.MijnOverheid.ageLower.over18' ]
]
]
};
irmaBackend.startSession(irmaRequest)
.then(({sessionPtr, token}) => {
// Send sessionPtr to the frontend
// Fetch the result if present
irmaBackend.subscribeStatusEvents(token, (error, status) => {
if (error != null) {
throw error;
}
if (status === IrmaBackend.SessionStatus.Done) {
irmaBackend.getSessionResult(token)
.then( result => {
// Do something with result
});
}
});
});
FAQs
Backend library to use API endpoints of the IRMA server
The npm package @privacybydesign/irma-backend receives a total of 0 weekly downloads. As such, @privacybydesign/irma-backend popularity was classified as not popular.
We found that @privacybydesign/irma-backend demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.