Rename to jwt_full to avoid collision with existing nim-jwt.
This commit is contained in:
parent
35a9cf682c
commit
4cc2a4dee5
@ -12,6 +12,6 @@
|
|||||||
##
|
##
|
||||||
##
|
##
|
||||||
|
|
||||||
import jwt/jwa, jwt/jwe, jwt/jwk, jwt/jws, jwt/jwt
|
import jwt_full/claims, jwt_full/joseheader, jwt_full/jwa, jwt_full/jwe, jwt_full/jwk, jwt_full/jws, jwt_full/jwt
|
||||||
|
|
||||||
export jwa, jwe, jwk, jws, jwt
|
export claims, joseheader, jwa, jwe, jwk, jws, jwt
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/claims.nim
|
# jwt_full/claims.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
## ====================================
|
## ====================================
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/joseheader.nim
|
# jwt_full/joseheader.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
## ====================================
|
## ====================================
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/jwa.nim
|
# jwt_full/jwa.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
##
|
##
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/jwe.nim
|
# jwt_full/jwe.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
## ====================================
|
## ====================================
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/jwk.nim
|
# jwt_full/jwk.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
## ==============================
|
## ==============================
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/jws.nim
|
# jwt_full/jws.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
## ====================================
|
## ====================================
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/jwssig.nim
|
# jwt_full/jwssig.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
## =====================================
|
## =====================================
|
@ -1,4 +1,4 @@
|
|||||||
# jwt/jwt.nim
|
# jwt_full/jwt.nim
|
||||||
# Copyright 2021 Jonathan Bernard
|
# Copyright 2021 Jonathan Bernard
|
||||||
|
|
||||||
## ===============================
|
## ===============================
|
||||||
@ -11,7 +11,7 @@
|
|||||||
##
|
##
|
||||||
##
|
##
|
||||||
|
|
||||||
import std/json, std/options, std/strutils, std/times
|
import std/options, std/strutils, std/times
|
||||||
|
|
||||||
import ./claims, ./joseheader, ./jwa, ./jwe, ./jwk, ./jws, ./jwssig
|
import ./claims, ./joseheader, ./jwa, ./jwe, ./jwk, ./jws, ./jwssig
|
||||||
|
|
@ -149,7 +149,7 @@ proc bearEcVerify(
|
|||||||
proc ecSign*(message: string, alg: JwtAlgorithm, key: JWK): string =
|
proc ecSign*(message: string, alg: JwtAlgorithm, key: JWK): string =
|
||||||
## Sign a message using the ECDSA algorithm.
|
## Sign a message using the ECDSA algorithm.
|
||||||
##
|
##
|
||||||
## *key* is expected to be a `JWK <,./../jwt/jwk.html#JWK>`_
|
## *key* is expected to be a `JWK <,./../jwt_full/jwk.html#JWK>`_
|
||||||
|
|
||||||
if key.keyKind != JwkKeyType.EcPrivate:
|
if key.keyKind != JwkKeyType.EcPrivate:
|
||||||
raise newException(ValueError,
|
raise newException(ValueError,
|
||||||
@ -167,7 +167,7 @@ proc ecSign*(message: string, alg: JwtAlgorithm, pemKey: string): string =
|
|||||||
proc ecVerify*(message, signature: string, alg: JwtAlgorithm, key: JWK): bool =
|
proc ecVerify*(message, signature: string, alg: JwtAlgorithm, key: JWK): bool =
|
||||||
## Verify the signature for a message using ECDSA.
|
## Verify the signature for a message using ECDSA.
|
||||||
##
|
##
|
||||||
## *key* is expected to be a `JWK <../../jwt/jwk.html#JWK>`_
|
## *key* is expected to be a `JWK <../../jwt_full/jwk.html#JWK>`_
|
||||||
|
|
||||||
if key.keyKind != JwkKeyType.EcPrivate and
|
if key.keyKind != JwkKeyType.EcPrivate and
|
||||||
key.keyKind != JwkKeyType.EcPublic:
|
key.keyKind != JwkKeyType.EcPublic:
|
@ -183,7 +183,7 @@ proc bearRsaVerify(
|
|||||||
proc rsaSign*(message: string, alg: JwtAlgorithm, key: JWK): string =
|
proc rsaSign*(message: string, alg: JwtAlgorithm, key: JWK): string =
|
||||||
## Sign a message using the RSA PKCS#1 v1.5 algorithm.
|
## Sign a message using the RSA PKCS#1 v1.5 algorithm.
|
||||||
##
|
##
|
||||||
## *key* is expected to be a `JWK <../../jwt/jwk.html#JWK>`_
|
## *key* is expected to be a `JWK <../../jwt_full/jwk.html#JWK>`_
|
||||||
|
|
||||||
if key.keyKind != JwkKeyType.RsaPrivate:
|
if key.keyKind != JwkKeyType.RsaPrivate:
|
||||||
raise newException(ValueError,
|
raise newException(ValueError,
|
||||||
@ -201,7 +201,7 @@ proc rsaSign*(message: string, alg: JwtAlgorithm, pemKey: string): string =
|
|||||||
proc rsaVerify*(message, signature: string; alg: JwtAlgorithm, key: JWK): bool =
|
proc rsaVerify*(message, signature: string; alg: JwtAlgorithm, key: JWK): bool =
|
||||||
## Verify the signature for a message using PKCS#1 v1.5 algorithm.
|
## Verify the signature for a message using PKCS#1 v1.5 algorithm.
|
||||||
##
|
##
|
||||||
## *key* is expected to be a `JWK <../../jwt/jwk.html#JWK>`_
|
## *key* is expected to be a `JWK <../../jwt_full/jwk.html#JWK>`_
|
||||||
|
|
||||||
if key.keyKind != JwkKeyType.RsaPublic:
|
if key.keyKind != JwkKeyType.RsaPublic:
|
||||||
raise newException(ValueError,
|
raise newException(ValueError,
|
@ -1,9 +1,9 @@
|
|||||||
import std/json, std/options, std/strutils, std/unittest
|
import std/json, std/options, std/strutils, std/unittest
|
||||||
|
|
||||||
import jwt/claims
|
import jwt_full/claims
|
||||||
import ../testdata
|
import ../testdata
|
||||||
|
|
||||||
suite "jwt/claims":
|
suite "jwt_full/claims":
|
||||||
|
|
||||||
test "initClaims(b64)":
|
test "initClaims(b64)":
|
||||||
let rfcClaims = initJwtClaims(rfc7519_S31_ClaimsB64)
|
let rfcClaims = initJwtClaims(rfc7519_S31_ClaimsB64)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import std/json, std/options, std/strutils, std/unittest
|
import std/json, std/options, std/strutils, std/unittest
|
||||||
|
|
||||||
import jwt/private/encoding
|
import jwt_full/encoding
|
||||||
import ../testdata
|
import ../testdata
|
||||||
|
|
||||||
suite "private/encoding":
|
suite "encoding":
|
||||||
|
|
||||||
test "b64UrlEncode(int array)":
|
test "b64UrlEncode(int array)":
|
||||||
check:
|
check:
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import std/json, std/options, std/unittest
|
import std/json, std/options, std/unittest
|
||||||
|
|
||||||
import jwt/jwa
|
import jwt_full/jwa
|
||||||
import jwt/joseheader
|
import jwt_full/joseheader
|
||||||
|
|
||||||
import ../testdata
|
import ../testdata
|
||||||
|
|
||||||
suite "jwt/joseheader":
|
suite "jwt_full/joseheader":
|
||||||
|
|
||||||
test "initJoseHeader always sets rawB64":
|
test "initJoseHeader always sets rawB64":
|
||||||
let h1 = initJoseHeader(rfc7519_S31_HeaderB64)
|
let h1 = initJoseHeader(rfc7519_S31_HeaderB64)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import std/json, std/options, std/unittest
|
import std/json, std/options, std/unittest
|
||||||
|
|
||||||
import jwt/jwa, jwt/jwk
|
import jwt_full/jwa, jwt_full/jwk
|
||||||
|
|
||||||
suite "jwt/jwk":
|
suite "jwt_full/jwk":
|
||||||
|
|
||||||
const rfc7517A1ExamplePubKeysStr = """
|
const rfc7517A1ExamplePubKeysStr = """
|
||||||
{"keys":
|
{"keys":
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import std/json, std/unittest
|
import std/json, std/unittest
|
||||||
|
|
||||||
import jwt/claims, jwt/joseheader, jwt/jwa, jwt/jwk, jwt/jws
|
import jwt_full
|
||||||
|
|
||||||
import jwt/private/encoding
|
import jwt_full/encoding
|
||||||
|
|
||||||
import ../testdata
|
import ../testdata
|
||||||
|
|
||||||
suite "jwt/jws":
|
suite "jwt_full/jws":
|
||||||
|
|
||||||
let rfc7515_A1_Jwk = initJwk(parseJson(rfc7515_A1_JwkStr))
|
let rfc7515_A1_Jwk = initJwk(parseJson(rfc7515_A1_JwkStr))
|
||||||
let rfc7515_A2_JwkPubKey = initJwk(parseJson(rfc7515_A2_JwkPubStr))
|
let rfc7515_A2_JwkPubKey = initJwk(parseJson(rfc7515_A2_JwkPubStr))
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import std/json, std/unittest
|
import std/json, std/unittest
|
||||||
|
|
||||||
import jwt/claims, jwt/joseheader, jwt/jwa, jwt/jwk, jwt/jwt
|
import jwt_full
|
||||||
import jwt/private/encoding
|
import jwt_full/encoding
|
||||||
|
|
||||||
import ../testdata
|
import ../testdata
|
||||||
|
|
||||||
suite "jwt/jwt":
|
suite "jwt_full/jwt":
|
||||||
|
|
||||||
let rfc7515_A1_Jwk = initJwk(parseJson(rfc7515_A1_JwkStr))
|
let rfc7515_A1_Jwk = initJwk(parseJson(rfc7515_A1_JwkStr))
|
||||||
let rfc7515_A2_JwkPubKey = initJwk(parseJson(rfc7515_A2_JwkPubStr))
|
let rfc7515_A2_JwkPubKey = initJwk(parseJson(rfc7515_A2_JwkPubStr))
|
||||||
|
Loading…
Reference in New Issue
Block a user