0.2.43 • Published 10 months ago

babbage-signia v0.2.43

Weekly downloads
-
License
Open BSV License
Repository
-
Last release
10 months ago

signia

Streamlining MetaNet Identity and Attribute Certification Across Applications

Overview

Signia is a cutting-edge npm package designed for seamless integration with the Confederacy Signia overlay network. It offers a robust framework for developers to manage and verify user's identities and attributes in a decentralized manner.

This package simplifies the complexities of identity / attribute verification, certification, and certificate management, making it easier to onboard new users and provide a seamless and secure user experience.

Key Features

  • Versatile Identity Management: Manage and publish diverse user attributes, including but not limited to, personal identifiers, professional skills, and certifications.
  • Seamless Integration with Certifiers: Interact with various Babbage-compatible Certificate Authorities (CAs) for user identity and attribute verification.
  • Efficient Certificate Handling: Simplify the process of obtaining and managing certificates for MetaNet identities, enhancing user experience.
  • Streamlined Authentication Process: Leverage existing certificates to bypass redundant verification steps in different applications, promoting a more unified user experience.
  • Economic Incentives for Certifiers: Encourage certifiers to perform diligent verification through a micropayment-based incentive structure.

Getting Started

To begin using Signia in your project, install it via npm:

npm i babbage-signia

After installation, initialize Signia with a Confederacy node details, or use the defaults, and start building your application with enhanced identity and attribute management capabilities.

Example Usage

If a user wants to publicly reveal some generic identity attributes to an example certifier called GenericCert, they could use the following example code.

/**
 * This function call will request the creation and signing of a certificate
 * with the following fields by the given certifier (GenericCert).
 * 
 * The required params are:
 * - fieldsToReveal
 * - certifierUrl
 * - certifierPublicKey
 * - certificateType
 * */
await signia.publiclyRevealAttributes(
  { firstName: 'John', lastName: 'Smith', skill: 'TypeScript' }, 
  'https://genericcert-backend.babbage.systems', 
  '036dc48522aba1705afbb43df3c04dbd1da373b6154341a875bceaa2a3e7f21528', 
  'eakpG20OQruUQ9yjd5htr4LrrzMsifjffJJ9g9y1nfk='
)

If someone wants to find someone certified in TypeScript by the GenericCert certifier, they could use the following code.

/**
 * This function call will perform a lookup request to the Confederacy 
 * Signia overlay network to look for a matching result.
 * 
 * The required params are:
 * - attributes given in an object as key/value pairs
 * - the acceptable certifiers given as an array of certifier public keys.
 * */
await signia.discoverByAttributes(
  {
    skill: 'TypeScript'
  },
  ['036dc48522aba1705afbb43df3c04dbd1da373b6154341a875bceaa2a3e7f21528']
)

// Example response
[
  {
    type: 'eakpG20OQruUQ9yjd5htr4LrrzMsifjffJJ9g9y1nfk=',
    subject: '024c0175179387843f2bf58e2b7411a0e3f5b7934132f8383a802cf6cb6f69eb6b',
    validationKey: '0G+4gZwRn6FcSjnUkQ4JyYTrGJO1Z5jvedfyXXqIdug=',
    serialNumber: 'S3ClsmcbzhHotrJ84Vc6lhTLbJMDKERh9HVhLumDj3E=',
    fields: {
      firstName: 'Uw5ep0dSIuGb8DIj/Ee7528+90EO1XLHiwBEv2StdmCcVa/XTKwQYrX1dnWFh3+4h+SWXVq0q33KKP8=',
      lastName: 'Kbkfkn4JO5gK+35rQxGhNMY87+EJnEIavrp6Qg9XiX8PwM9yoLxxWe1fkSa+cr+gfszmSwfq',
      skill: '7WdNIteakuEABpDGD0VZzJSElo3NIhyXc9lRdRfyW5ksfXInhtpSCgWsbwzceszKQ7PQ4mnsKnifiXXQRpu/Lv2G1JUbTdAdfRHOJFihq9VZ1UQbEEvGQ8WrZwqh3NNl7tqt0Q=='
    },
    certifier: '036dc48522aba1705afbb43df3c04dbd1da373b6154341a875bceaa2a3e7f21528',
    revocationOutpoint: '3fc5498bd648671e316e07bb7037985ff54d9e04a255e405239fc4e97af1c10500000000',
    signature: '3044022004b7ce99ea1a112de2b3b3d029809bb1fa850110c04815d320f0fbd954aac0e902203b6c8c9eda1dc85e75357238d01cbefa4709c5132baf2a728da26a27c6b1c040',
    keyring: {
      firstName: 'Lxjj21iR0Shna6b1uv6WEZVMWcrD4HhzjZwTiEGwdeRQVnmOv0K/GQ7SuLWBTcQn9gJIXK7782DD4tbl+yUWEN2rjQal8JCmydmTB5F5Lkk=',
      lastName: 'cF0hqXENrYdx3w+4qCjD6hWNnKTzZ6YZSv0vAn446d5Dj7C7LmVjl38H9JRf8iNNMN+lT/Fdohbh39F4McrObwZRY2sBY9AmUi3i8FkjHME=',
      skill: 'NiAcX25xEGHC8j0zMVTPZSSAeHKk/sT2U9yShlpGekgrcuShc6prKiuNxRUkdf5tavAbH4sw6xyrM9nDdvUBTOhn5RcwY3UVW349x0dMyhk='
    },
    decryptedFields: {
      firstName: 'John',
      lastName: 'Smith',
      skill: 'TypeScript'
    }
  }
]

API

Links: API, Classes

Classes

ConfederacyConfig
Signia

Links: API, Classes


Class: ConfederacyConfig

export class ConfederacyConfig {
    constructor(public confederacyHost?: string, public protocolID?: [
        number,
        string
    ], public keyID?: string, public tokenAmount?: number, public topics?: string[], public authriteConfig?: object, public counterparty?: string, public receiveFromCounterparty?: boolean, public sendToCounterparty?: boolean, public viewpoint?: string) 
}

Links: API, Classes


Class: Signia

A system for decentralized identity attribute attestation and lookup

export class Signia {
    constructor(public config = new ConfederacyConfig("https://confederacy.babbage.systems", [1, "signia"], "1", 1000, ["Signia"], undefined, undefined, false, false, "localToSelf")) 
    async publiclyRevealAttributes(fieldsToReveal: object, certifierUrl: string, certifierPublicKey: string, certificateType: string, newCertificate = false, preVerifiedData: object, updateProgress = async (message) => { }): Promise<object> 
    async certifyPeer(peer: string, fieldsToAttest: Record<string, string>, certificateType: string, updateProgress = async (message) => { }): Promise<object> 
    async listCertifiedPeers(): Promise<any[]> 
    async revokeCertification(certToken, description = "Revoke Signia certification"): Promise<void> 
    async getNameFromKey(identityKey: string, certifiers: string[]): Promise<object> 
    async discoverByAttributes(attributes: object, certifiers: string[]): Promise<object[]> 
    async discoverByIdentityKey(identityKey: string, certifiers: string[]): Promise<object[]> 
    async discoverByCertifier(certifiers: string[]): Promise<object[]> 
}
Constructor

Constructs a new Signia instance

constructor(public config = new ConfederacyConfig("https://confederacy.babbage.systems", [1, "signia"], "1", 1000, ["Signia"], undefined, undefined, false, false, "localToSelf")) 

Argument Details

  • config
    • the configuration object required by Confederacy
Method certifyPeer

Publicly attest attributes of a peer.

async certifyPeer(peer: string, fieldsToAttest: Record<string, string>, certificateType: string, updateProgress = async (message) => { }): Promise<object> 

Returns

A promise that resolves when the attestation has been made.

Argument Details

  • peer
    • The public key of the peer to certify.
  • fieldsToAttest
    • The fields to attest about a peer.
  • certificateType
    • The type of certification to make about this peer (based on the fields).
  • updateProgress
    • A callback function to update progress. Default is an empty asynchronous function.
Method discoverByAttributes

Query the lookup service for the given attribute (and optional certifiers) and parseResults

async discoverByAttributes(attributes: object, certifiers: string[]): Promise<object[]> 
Method discoverByCertifier

Query the lookup service for the given certifiers, returning all results for the certifiers parseResults

async discoverByCertifier(certifiers: string[]): Promise<object[]> 
Method discoverByIdentityKey

Query the lookup service for the given identity key (and optional certifiers) parseResults

async discoverByIdentityKey(identityKey: string, certifiers: string[]): Promise<object[]> 
Method getNameFromKey

Example higher level lookup function

async getNameFromKey(identityKey: string, certifiers: string[]): Promise<object> 

Returns

  • with identity information
Method listCertifiedPeers

Lists all certifications made to peers.

async listCertifiedPeers(): Promise<any[]> 
Method publiclyRevealAttributes

Publicly reveal attributes to the Signia overlay.

async publiclyRevealAttributes(fieldsToReveal: object, certifierUrl: string, certifierPublicKey: string, certificateType: string, newCertificate = false, preVerifiedData: object, updateProgress = async (message) => { }): Promise<object> 

Returns

A promise that resolves with the results of the submission to the overlay.

Argument Details

  • fieldsToReveal
    • The fields to reveal.
  • certifierUrl
    • The URL of the certifier.
  • certifierPublicKey
    • The public key of the certifier.
  • certificateType
    • The type of certificate.
  • newCertificate
    • Indicates if a new certificate should be created. Default is false.
  • preVerifiedData
    • Verification data to send to the certifier if the attributes have been preVerified. Can be undefined.
  • updateProgress
    • A callback function to update progress. Default is an empty asynchronous function.
Method revokeCertification

Revokes a Signia certification token

async revokeCertification(certToken, description = "Revoke Signia certification"): Promise<void> 

Argument Details

  • certToken
    • certification token to be revoked
  • description
    • custom description for the createAction call

Links: API, Classes


License

The license for the code in this repository is the Open BSV License

0.2.43

10 months ago

0.2.42

11 months ago

0.2.41

1 year ago

0.2.40

1 year ago

0.2.39

1 year ago

0.2.38

1 year ago

0.2.37

1 year ago

0.2.36

1 year ago

0.2.35

1 year ago

0.2.34

1 year ago

0.2.33

1 year ago

0.2.32

1 year ago

0.2.30

1 year ago

0.2.31

1 year ago

0.2.29

1 year ago

0.2.27

1 year ago

0.2.28

1 year ago

0.2.26

1 year ago

0.2.25

1 year ago

0.2.24

1 year ago

0.2.23

1 year ago

0.2.22

1 year ago

0.2.21

1 year ago

0.2.20

1 year ago

0.2.19

1 year ago

0.2.18

1 year ago

0.2.17

1 year ago

0.2.16

1 year ago

0.2.15

1 year ago

0.2.14

1 year ago

0.2.13

1 year ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.9

1 year ago

0.2.7

1 year ago

0.2.8

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.1.54

1 year ago

0.1.53

1 year ago

0.1.52

1 year ago

0.1.50

1 year ago

0.1.51

1 year ago

0.1.49

1 year ago

0.1.48

1 year ago

0.1.47

1 year ago

0.1.46

2 years ago

0.1.45

2 years ago

0.1.42

2 years ago

0.1.43

2 years ago

0.1.44

2 years ago

0.1.41

2 years ago

0.1.40

2 years ago

0.1.39

2 years ago

0.1.38

2 years ago

0.1.37

2 years ago

0.1.36

2 years ago

0.1.35

2 years ago

0.1.34

2 years ago

0.1.33

2 years ago

0.1.32

2 years ago

0.1.30

2 years ago

0.1.31

2 years ago

0.1.28

2 years ago

0.1.29

2 years ago

0.1.27

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.24

2 years ago

0.1.23

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago