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

@peculiar/asn1-android

v2.3.10

Published

[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/PeculiarVentures/asn1-schema/master/packages/android/LICENSE.md) [![npm version](https://badge.fury.io/js/%40peculiar%2Fasn1-android.svg)](https:

Downloads

267,565

Readme

@peculiar/asn1-android

License npm version

NPM

KeyDescription and NonStandardKeyDescription

The KeyDescription class in this library represents the ASN.1 schema for the Android Keystore Key Description structure. However, in practice, there are cases where the AuthorizationList fields in the softwareEnforced and teeEnforced fields are not strictly ordered, which can lead to ASN.1 structure reading errors.

To address this issue, this library provides a NonStandardKeyDescription class that can read such structures. However, when creating extensions, it is recommended to use KeyDescription, as it guarantees the order of object fields according to the specification.

Here are simplified TypeScript examples:

Example of creating a KeyDescription object in TypeScript for the Android Keystore system

const attestation = new android.AttestationApplicationId({
  packageInfos: [
    new android.AttestationPackageInfo({
      packageName: new OctetString(Buffer.from("123", "utf8")),
      version: 1,
    }),
  ],
  signatureDigests: [
    new OctetString(Buffer.from("123", "utf8")),
  ],
});

const keyDescription = new KeyDescription({
  attestationVersion: android.Version.v200,
  attestationSecurityLevel: android.SecurityLevel.software,
  keymasterVersion: 1,
  keymasterSecurityLevel: android.SecurityLevel.software,
  attestationChallenge: new OctetString(Buffer.from("123", "utf8")),
  uniqueId: new OctetString(Buffer.from("123", "utf8")),
  softwareEnforced: new android.AuthorizationList({
    creationDateTime: 1506793476000,
    attestationApplicationId: new OctetString(AsnConvert.serialize(attestation)),
  }),
  teeEnforced: new android.AuthorizationList({
    purpose: new android.IntegerSet([1]),
    algorithm: 1,
    keySize: 1,
    digest: new android.IntegerSet([1]),
    ecCurve: 1,
    userAuthType: 1,
    origin: 1,
    rollbackResistant: null,
  }),
});

const raw = AsnConvert.serialize(keyDescription);

Example of reading a NonStandardKeyDescription object in TypeScript

const keyDescription = AsnConvert.parse(raw, NonStandardKeyDescription);

console.log(keyDescription.attestationVersion); // 100
console.log(keyDescription.attestationSecurityLevel); // 1
console.log(keyDescription.keymasterVersion); // 100
console.log(keyDescription.keymasterSecurityLevel); // 1
console.log(keyDescription.attestationChallenge.byteLength); // 32
console.log(keyDescription.uniqueId.byteLength); // 0
console.log(keyDescription.softwareEnforced.findProperty("attestationApplicationId")?.byteLength); // 81
console.log(keyDescription.teeEnforced.findProperty("attestationIdBrand")?.byteLength); // 8