How to use the base64url.default.toBuffer function in base64url

To help you get started, we’ve selected a few base64url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anvilresearch / webcrypto / src / algorithms / RSA-PSS.js View on Github external
} else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSA PSS object
    let alg = new RSA_PSS({
      name: 'RSA-PSS',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }
github anvilresearch / webcrypto / src / algorithms / RSASSA-PKCS1-v1_5.js View on Github external
} else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSSASSA object
    let alg = new RSASSA_PKCS1_v1_5({
      name: 'RSASSA-PKCS1-v1_5',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }
github SocialXNetwork / socialx_react_native / packages / webcrypto / src / algorithms / RSA-PSS.js View on Github external
} else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSA PSS object
    let alg = new RSA_PSS({
      name: 'RSA-PSS',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }
github SocialXNetwork / socialx_react_native / packages / webcrypto / src / algorithms / RSASSA-PKCS1-v1_5.js View on Github external
} else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSSASSA object
    let alg = new RSASSA_PKCS1_v1_5({
      name: 'RSASSA-PKCS1-v1_5',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }
github anvilresearch / webcrypto / src / algorithms / RSA-PSS.js View on Github external
})
      } else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSA PSS object
    let alg = new RSA_PSS({
      name: 'RSA-PSS',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }
github SocialXNetwork / socialx_react_native / packages / webcrypto / src / algorithms / RSA-PSS.js View on Github external
})
      } else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSA PSS object
    let alg = new RSA_PSS({
      name: 'RSA-PSS',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }
github anvilresearch / webcrypto / src / algorithms / RSASSA-PKCS1-v1_5.js View on Github external
})
      } else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSSASSA object
    let alg = new RSASSA_PKCS1_v1_5({
      name: 'RSASSA-PKCS1-v1_5',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }
github SocialXNetwork / socialx_react_native / packages / webcrypto / src / algorithms / RSASSA-PKCS1-v1_5.js View on Github external
})
      } else {
        key = new CryptoKey({
          type: 'public',
          extractable: true,
          usages: ['verify'],
          handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
        })
      }
    } else {
      throw new KeyFormatNotSupportedError(format)
    }
    // 3-7. Setup RSSASSA object
    let alg = new RSASSA_PKCS1_v1_5({
      name: 'RSASSA-PKCS1-v1_5',
      modulusLength: base64url.toBuffer(jwk.n).length * 8,
      publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
      hash: normalizedHash
    })

    // 8. Set algorithm of key to alg
    key.algorithm = alg

    // 9. Return key
    return key
  }

base64url

For encoding to/from base64urls

MIT
Latest version published 6 years ago

Package Health Score

74 / 100
Full package analysis