diff options
author | Vivien Kraus <vivien@planete-kraus.eu> | 2021-11-02 15:54:24 +0100 |
---|---|---|
committer | Vivien Kraus <vivien@planete-kraus.eu> | 2021-11-06 17:00:53 +0100 |
commit | 44f9f7cdfa24e3de0e166167aa97f02164bfa5c9 (patch) | |
tree | f04c780b81f1d2f21840812ae8822212b3e9dc70 /src/scm/webid-oidc/client/reverse-stubs.scm | |
parent | ddf2ddf06be7d2c45afdc4f411438e77020dd198 (diff) |
Create a shared object with a client API
Diffstat (limited to 'src/scm/webid-oidc/client/reverse-stubs.scm')
-rw-r--r-- | src/scm/webid-oidc/client/reverse-stubs.scm | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/scm/webid-oidc/client/reverse-stubs.scm b/src/scm/webid-oidc/client/reverse-stubs.scm new file mode 100644 index 0000000..faecf83 --- /dev/null +++ b/src/scm/webid-oidc/client/reverse-stubs.scm @@ -0,0 +1,50 @@ +;; disfluid, implementation of the Solid specification +;; Copyright (C) 2021 Vivien Kraus + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU Affero General Public License as +;; published by the Free Software Foundation, either version 3 of the +;; License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU Affero General Public License for more details. + +;; You should have received a copy of the GNU Affero General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +(define-module (webid-oidc client reverse-stubs) + #:use-module (webid-oidc client) + #:use-module (webid-oidc client accounts) + #:use-module (webid-oidc client application) + #:use-module (webid-oidc jwk) + #:use-module ((webid-oidc stubs) #:prefix stubs:) + #:duplicates (merge-generics) + #:declarative? #t + #:export + ( + make-client + get-client-id + get-client-jwk + get-client-redirect-uri + )) + +(define (make-client client-id jwk redirect-uri) + (make <client> + #:client-id client-id + #:key-pair + (if jwk + (jwk->key (stubs:json-string->scm jwk)) + ;; Generate a new one: + #t) + #:redirect-uri redirect-uri)) + +(define (get-client-id client) + (uri->string (client-id client))) + +(define (get-key-pair client) + (stubs:scm->json-string (key->jwk (key-pair client)))) + +(define (get-redirect-uri client) + (uri->string (redirect-uri client))) |