1 Star 0 Fork 2

hihopeorg / jwks-rsa

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

jwks-rsa

简介

从 JWKS(JSON Web 密钥集)端点检索密钥的库,支持的加密算法:非对称公钥加密算法(RSA)、非对称椭圆曲线加密算法(ECC)。

安装教程

npm install @ohos/jwks-rsa --save

使用说明

  1. 初始化:实例化JwksClient和设置对应的属性
this.client = new JwksClient({
   jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json',
   requestHeaders: {}, // Optional
   timeout: 30000, // Defaults to 30s
   cache: false,
   rateLimit: true
   });
},
  1. 获取publicKey和属性值:
let signingKey = await this.client.getSigningKey(kid)
this.kid = signingKey.kid
this.alg = signingKey.alg
this.kty = signingKey.kty
this.use = signingKey.use
this.publicKey = await signingKey.getPublicKey()

约束与限制

在下述版本验证通过:

DevEco Studio 版本:3.1 Beta1(3.1.0.200),SDK:API9 Beta5(3.2.10.6)

目录结构

|---- OHOS_APP_jwks-rsa
|   |---- entry                                                # 示例代码文件夹
|   |---- jwks-rsa                                             # OHOS_APP_jwks-rsa库文件夹
|       |---- src
            |----main
                |----js
                    |----components
                        |----errors
                            |----ArgumentError.js              #错误日志
                            |----JwksError.js                  #错误日志
                            |----JwksRateLimitError.js         #错误日志
                            |----SigningKeyNotFoundError.js    #错误日志
                        |----integrations
                            |----config.js                     #支持的加密算法
                            |----express.js                    #expressJwtSecret生成秘密提供者
                            |----hapi.js                       #hapiJwtSecret生成秘密提供者
                            |----koa.js                        #koaJwtSecret生成秘密提供者
                            |----passport.js                   #passportJwtSecret生成秘密提供者
                        |----wrappers
                            |----cache.js                      #从缓存中获取密钥
                            |----callbackSupport.js            #回调方法
                            |----interceptor.js                #回调方法
                            |----rateLimit.js                  #设置请求密钥的速率
                            |----request.js                    #网路请求
                        |----JwksClient.js                     #构造方法
                        |----utils.js                          #加密算法
|   |---- README.md                                            #使用方法

贡献代码

使用过程中发现任何问题都可以提 Issue 给我们,当然,我们也非常欢迎你给我们发 PR

开源协议

本项目基于 MIT License ,请自由地享受和参与开源。

The MIT License (MIT) Copyright (c) 2016 Sandrino Di Mattia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

用于从 JWKS(JSON Web 密钥集)端点检索RSA签名密钥的库,支持所有当前注册的 JWK 类型和 JWS 算法 展开 收起
JavaScript 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/hihopeorg/jwks-rsa.git
git@gitee.com:hihopeorg/jwks-rsa.git
hihopeorg
jwks-rsa
jwks-rsa
master

搜索帮助