npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@doncicuto/autoscript

v1.1.0

Published

NPM package to ease the integration of autoscript.js code, created by the Government of Spain, in our JS projects

Downloads

5

Readme

Autoscript

The reason for this project is to provide an npm package for autoscript.js so it's easier to use it from your JS projects. I have created the NPM package under the scope @doncicuto in case of autoscript developers choose to upload an official npm package.

This package contains autoscript.js, a README explaining what's Autofirma and Autoscript, some quick notes of usage, and the demo files provided with Autoscript on how to launch and use Autofirma from the browser.

Autoscript.js is a javascript file developed by the Government of Spain to launch and use Autofirma from a web browser.

NOTE: In version 1.1.0 of this NPM package I've added strict mode, removed unused coded and used Prettier and ESLint to find some errors and format the file. If you want to use the unmodified autoscript.js developed by the Government of Spain, use version 1.0.0 instead.

Please, note that all credits for the source code and the demo files are for the Government of Spain developers and maintainers.

What is Autofirma and Autoscript?

Autofirma is an electronic signature application developed by the then Ministry of Finance and Public Administrations. This application, being able to be executed from the browser with Autosign.js, allows the signature on Electronic Administration pages when the signature is required in an administrative procedure.

Autofirma is part of the @firma suite of electronic signature and identification solutions offered as free software with GPL 2+ and EUPL 1.1 licenses. Autofirma can be downloaded from https://firmaelectronica.gob.es/Home/Descargas.html.

Autoscript.js is publicly available in the Autoscript section of the Download Area of ​​the Technology Transfer Center of the Electronic Administration Portal (CTT). The url of the download area is https://administracionelectronica.gob.es/ctt/clienteafirma/descargas. The source code is available at Autofirma's Github repository in the following path 'afirma-ui-miniapplet-deploy/src/main/webapp/js/autoscript.js'.

There's more information about Autocript in a PDF document called 'Manual Integrador' whis has been written in Spanish that can be downloaded from the Download Area of ​​the Technology Transfer Center of the Electronic Administration Portal (CTT).

Sample code about Autoscript

Government of Spain provides two html files that use autoscript.js and a constantes.js file. Those files are cliente-batch.html and cliente-full.html that are located inside the demo folder of this package (node_modules/autoscript).

Usage

You can use install autoscript using npm or yarn using:

npm install @doncicuto/autoscript

or

yarn add @doncicuto/autoscript

You can use Autofirma using the Autoscript object that will be available as a global variable once you add it to your html code using the following script tag:

<script src='node_modules/@doncicuto/autoscript/autoscript.js'></script>

Here's an html demo page, that will open Autofirma and allow you to select an X509 certificate from your browser's cert store.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Autoscript Demo</title>
</head>
<body>
  <button onclick="selectCertificate()">Select certificate</button>
  <script src='node_modules/@doncicuto/autoscript/autoscript.js'></script>
  <script>
    function selectCertificate() {
      try {
        AutoScript.selectCertificate(
          "",
          function(certificate) {
            console.log(certificate)
          },
          function(type,message) {
            console.log("Type: " + type + "\nMessage: " + message);
          }
        );
      } catch(e) {
        console.log("Type: " + AutoScript.getErrorType() + "\nMessage: " + AutoScript.getErrorMessage());
      }
    }
    AutoScript.cargarAppAfirma(); // Opens Autofirma
  </script>
</body>
</html>