Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

DidResponse: { didDoc: Static<typeof Did>; success: true } | { error: Error; success: false }

Success or Failure DID Message Response

IdentityResponse: { identity: Static<typeof Identity>; message: string; success: true } | { message: string; success: false }

Success or Failure Identity Response Message

KeyPairsResponse: { keyPairs: Static<typeof KeyPair>[]; message: string; success: true } | { message: string; success: false }

Success or Failure Key Pair Response Message

Functions

  • addExistingKeyPair(identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }, keyPair: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public: undefined | { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } }, allowDuplicate?: boolean): Promise<IdentityResponse>
  • Add a preexisting KeyPair to a provided identity. This does NOT save the new identity anywhere.

    Parameters

    • identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }

      obj containing identity to use

      • did: string
      • didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...
      • keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[]
    • keyPair: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public: undefined | { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } }

      KeyPair object containing keys to add

      • kid: string
      • private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }
      • public: undefined | { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; }
    • allowDuplicate: boolean = false

      don't fail if provided KeyPair is already present in DID

    Returns Promise<IdentityResponse>

    Success or Failure Message Response including new identity object

  • addIdentity(identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }): Promise<DataResponse>
  • Save an identity to psqr configuration directory for use.

    Parameters

    • identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }

      obj containing identity to add

      • did: string
      • didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...
      • keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[]

    Returns Promise<DataResponse>

    Success or Failure Message Response

  • addNewKeyPair(identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }, kid: string, keyName?: string): Promise<IdentityResponse>
  • Create and add a new KeyPair to a provided identity. If keyName isn't specified, a name will be parsed from the kid. This function will fallback to using 'publish' as a key name. This does NOT save the new identity anywhere.

    Parameters

    • identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }

      obj containing identity to use

      • did: string
      • didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...
      • keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[]
    • kid: string

      did with trailing key name

    • keyName: string = ''

      name of key to be added to DID

    Returns Promise<IdentityResponse>

    Success or Failure Message Response including new identity object

  • createIdentity(kid: string, info: { bio: undefined | string; description: undefined | string; image: undefined | string; name: string; tagline: undefined | string; url: undefined | string }, keyNames?: string[]): Promise<IdentityResponse>
  • Create a completely new Identity. If key names aren't specified, this will attempt to get the key name from the kid and fall back on the name 'publish'.

    Parameters

    • kid: string

      did with trailing key name

    • info: { bio: undefined | string; description: undefined | string; image: undefined | string; name: string; tagline: undefined | string; url: undefined | string }

      public info obj to be included in DID

      • bio: undefined | string
      • description: undefined | string
      • image: undefined | string
      • name: string
      • tagline: undefined | string
      • url: undefined | string
    • keyNames: string[] = []

      list of names of keys to be included

    Returns Promise<IdentityResponse>

    Success or Failure Message Response including full identity

  • generateInfoHash(info: object): string
  • Generate the infoHash of an object.

    Parameters

    • info: object

      obj to get hash of

    Returns string

    bencoded infoHash string

  • generateKeys(did: string, names: string[]): Promise<Static<typeof KeyPair>[] | false>
  • Create an arbitrary amount of key pairs for a DID. NOTE: This will not add the public keys to the appropriate section of the DID.

    Parameters

    • did: string

      string identifying a DID

    • names: string[]

      array of names of keys to create

    Returns Promise<Static<typeof KeyPair>[] | false>

    array of key pairs or false on error

  • Get the current default id strings from the ENV

    Returns DataResponse

    Success or Failure Message Response including bdid, kname, and kid

  • If DID is already present locally, get and return it. If not, get DID from the url in the did parameter string and save it locally. Return the full DID.

    Parameters

    • did: string

      string identifying a DID

    Returns Promise<DidResponse>

    Success or Failure Message Response including full DID

  • Get the full identity that is stored locally, including all associated keys present. If no kid is specified, the default identity will be retrieved and returned.

    Parameters

    • did: string = ''

      string identifying a DID

    Returns Promise<IdentityResponse>

    Success or Failure Message Response including identity object

  • Get locally stored identity. If no kid is specified, the default identity will be retrieved and returned. This function will exclude trailing #keyName for no keys.

    Parameters

    • kid: string = ''

      did with trailing key name

    Returns Promise<IdentityResponse>

    Success or Failure Message Response including identity object

  • Retrieve a pair of keys stored locally. Keys are returned in JWK format.

    Parameters

    • kid: string

      did with trailing key name

    Returns Promise<KeyPairsResponse>

    Success or Failure Message Response including pair of keys requested as JWKs

  • parseBareDid(kid: string): string | false
  • Remove any key names and return the bare DID string.

    Parameters

    • kid: string

      DID with trailing key name

    Returns string | false

    bare DID or false on error

  • parseDidType(did: string): string | false
  • Determines what kind of DID a DID string refers to.

    Parameters

    • did: string

      string identifying a DID

    Returns string | false

    identified type as string

  • parseDidUrl(did: string): Static<typeof Url> | false
  • Assemble http url where a DID can be found based on provided did parameter string.

    Parameters

    • did: string

      string identifying a DID

    Returns Static<typeof Url> | false

    url where DID is located or false on error

  • parseKidKey(kid: string): string | false
  • Extract key name from KID.

    Parameters

    • kid: string

      DID with trailing key name

    Returns string | false

    key name or false on error

  • Retrieve DID from url and save it locally.

    Parameters

    • did: string

      string identifying a DID

    Returns Promise<DidResponse>

    Success or Failure Message Response including a full DID

  • retrieveKeys(keyFiles: KeyFile[]): Promise<Static<typeof KeyPair>[] | false>
  • Retrieve an arbitrary amount of keys. This requires specific knowledge with regards to the exact paths these keys are located at.

    Parameters

    • keyFiles: KeyFile[]

      array of paths to local key pairs

    Returns Promise<Static<typeof KeyPair>[] | false>

    array of key pairs or false on error

  • Validate an Identity and set it as default in ENV

    Parameters

    • kid: string

      did with trailing key name

    Returns DataResponse

    Success or Failure Message Response to set default

  • validateIdentity(identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }): Promise<IdentityResponse>
  • Validate an Identity.

    Parameters

    • identity: { did: string; didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...; keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[] }

      obj containing identity to use

      • did: string
      • didDoc: { "@context": ("https://www.w3.org/ns/did/v1" | "https://vpsqr.com/ns/did-psqr/v1")[]; id: string; psqr: { publicIdentity: { name: string; description?: string | undefined; image?: string | undefined; url?: string | undefined; tagline?: string | undefined; bio?: string | undefined; }; publicKeys: { ...; }[]; permiss...
      • keyPairs: { kid: string; private: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } & { d: string; }; public?: { x: string; y: string; crv: "P-384"; alg: "ES384"; kty: "EC"; kid: string; } | undefined; }[]

    Returns Promise<IdentityResponse>

    Success or Failure Message Response of identity validation including valid identity object

  • Verify if the specified DID has an admin key associated with it. Return failure if no identity.json file is found or if no admin privileges are returned.

    Parameters

    • did: string

      did string

    Returns Promise<IdentityResponse>

    identity object or error message