@substrate-system/keys
    Preparing search index...

    Class RsaKeys

    The parent key. Doesn't implement the encrypt/sign functions.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    DID: `did:key:z${string}`
    exchangeKey: CryptoKeyPair
    hasPersisted: boolean
    isSessionOnly: boolean
    writeKey: CryptoKeyPair
    _instance: any
    EXCHANGE_KEY_NAME: string = DEFAULT_RSA_EXCHANGE
    INFO: string = 'keys'
    TYPE: "rsa" = ...
    WRITE_KEY_NAME: string = DEFAULT_RSA_WRITE

    Accessors

    • get deviceName(): Promise<string>

      The machine-readable name for this keypair.

      Returns Promise<string>

    • get privateExchangeKey(): CryptoKey

      Returns CryptoKey

    • get privateWriteKey(): CryptoKey

      Returns CryptoKey

    • get publicExchangeKey(): CryptoKey & {
          asString: (format?: SupportedEncodings) => Promise<string>;
      }

      Returns CryptoKey & { asString: (format?: SupportedEncodings) => Promise<string> }

    • get publicWriteKey(): CryptoKey & {
          asString: (format?: SupportedEncodings) => Promise<string>;
      }

      Returns CryptoKey & { asString: (format?: SupportedEncodings) => Promise<string> }

    Methods

    • Decrypt the given message. Expects encrypted AES key + encrypted content.

      Parameters

      • msg: string | ArrayBuffer | Uint8Array<ArrayBufferLike>
      • Optionalkeysize: string | CryptoKey | SymmKeyLength
      • Optional_aesAlgorithm: string

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Decrypt and return as string.

      Parameters

      • msg: string | ArrayBuffer | Uint8Array<ArrayBufferLike>
      • Optionalkeysize: string | CryptoKey | SymmKeyLength
      • Optional_aesAlgorithm: string

      Returns Promise<string>

    • Decrypt the given encrypted AES key. Return the key as Uint8Array.

      Parameters

      • key: string | ArrayBuffer | Uint8Array<ArrayBufferLike>

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Decrypt the given AES key, return the result as a string.

      Parameters

      • msg: string | Uint8Array<ArrayBufferLike>
      • Optionalformat: SupportedEncodings

      Returns Promise<string>

    • Encrypt content using hybrid encryption (RSA + AES).

      Parameters

      • content: string | Uint8Array<ArrayBufferLike>
      • Optionalrecipient: string | CryptoKey
      • OptionalaesKeyOrInfo: string | Uint8Array<ArrayBufferLike> | CryptoKey
      • OptionalkeysizeOrAesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey | SymmKeyLength
      • Optionalkeysize: SymmKeyLength

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Encrypt and return as base64 string.

      Parameters

      • content: string | Uint8Array<ArrayBufferLike>
      • Optionalrecipient: string | CryptoKey
      • OptionalaesKeyOrInfo: string | Uint8Array<ArrayBufferLike> | CryptoKey
      • OptionalkeysizeOrAesKey: string | Uint8Array<ArrayBufferLike> | CryptoKey | SymmKeyLength
      • Optionalkeysize: SymmKeyLength

      Returns Promise<string>

    • Get the relevant AES key for RSA - decrypt the given encrypted key.

      Parameters

      • OptionalencryptedKey: null | string | CryptoKey
      • Optional_info: null | string

      Returns Promise<CryptoKey>

    • Return a 32-character, DNS friendly hash of the public signing key.

      Returns Promise<string>

    • Sign the message, and return the signature as a Uint8Array.

      Parameters

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Serialize this keys instance. Will return an object of { DID, publicExchangeKey }, where DID is the public signature key, and publicExchangeKey is the encryption key, base64 encoded.

      Parameters

      • Optionalformat: SupportedEncodings

      Returns Promise<{ DID: `did:key:z${string}`; publicExchangeKey: string }>

    • Return a 32-character, DNS-friendly hash of the given DID.

      Parameters

      • did: `did:key:z${string}`

        A DID format string

      Returns Promise<string>

      32 character, base32 hash of the DID

    • Restore some keys from indexedDB, or create a new keypair if it doesn't exist yet.

      Type Parameters

      Parameters

      • this: ChildKeys<AbstractKeys> & typeof AbstractKeys
      • opts: Partial<{ encryptionKeyName: string; session: boolean; signingKeyName: string }> = ...

        Strings to use as keys in indexedDB, and a session boolean, is this in memory only? Or can it be persisted.

      Returns Promise<T>