0.2.35 • Published 9 days ago

babbage-signia v0.2.35

Weekly downloads
-
License
Open BSV License
Repository
-
Last release
9 days 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.35

9 days ago

0.2.34

10 days ago

0.2.33

11 days ago

0.2.32

13 days ago

0.2.30

17 days ago

0.2.31

17 days ago

0.2.29

19 days ago

0.2.27

21 days ago

0.2.28

20 days ago

0.2.26

26 days ago

0.2.25

27 days ago

0.2.24

1 month ago

0.2.23

1 month ago

0.2.22

1 month ago

0.2.21

1 month ago

0.2.20

1 month ago

0.2.19

1 month ago

0.2.18

2 months ago

0.2.17

2 months ago

0.2.16

2 months ago

0.2.15

2 months ago

0.2.14

2 months ago

0.2.13

2 months ago

0.2.12

2 months ago

0.2.11

2 months ago

0.2.10

2 months ago

0.2.9

2 months ago

0.2.7

3 months ago

0.2.8

3 months ago

0.2.6

3 months ago

0.2.5

3 months ago

0.2.4

3 months ago

0.2.1

3 months ago

0.2.0

3 months ago

0.2.3

3 months ago

0.2.2

3 months ago

0.1.54

3 months ago

0.1.53

3 months ago

0.1.52

3 months ago

0.1.50

3 months ago

0.1.51

3 months ago

0.1.49

3 months ago

0.1.48

3 months ago

0.1.47

3 months ago

0.1.46

3 months ago

0.1.45

3 months ago

0.1.42

3 months ago

0.1.43

3 months ago

0.1.44

3 months ago

0.1.41

4 months ago

0.1.40

4 months ago

0.1.39

4 months ago

0.1.38

4 months ago

0.1.37

4 months ago

0.1.36

4 months ago

0.1.35

4 months ago

0.1.34

4 months ago

0.1.33

5 months ago

0.1.32

5 months ago

0.1.30

5 months ago

0.1.31

5 months ago

0.1.28

5 months ago

0.1.29

5 months ago

0.1.27

5 months ago

0.1.25

5 months ago

0.1.26

5 months ago

0.1.24

5 months ago

0.1.23

5 months ago

0.1.22

5 months ago

0.1.21

5 months ago

0.1.20

5 months ago

0.1.18

5 months ago

0.1.19

5 months ago

0.1.17

5 months ago

0.1.16

5 months ago

0.1.14

5 months ago

0.1.15

5 months ago

0.1.12

5 months ago

0.1.13

5 months ago

0.1.10

5 months ago

0.1.11

5 months ago

0.1.8

6 months ago

0.1.9

6 months ago

0.1.7

6 months ago

0.1.6

7 months ago

0.1.4

9 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago