config

package
v0.0.0-...-da3e9ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	SaltSize       int = 32
	CRYPTO_VERSION int = 1
)
View Source
const TokenFileBasename = "canvas.conf"

Variables

This section is empty.

Functions

func DecryptTokenForUrl

func DecryptTokenForUrl(encodedToken, url string) (string, error)

func EncodeToken

func EncodeToken(ciphertext, nonce, salt []byte) string

func IsEncrypted

func IsEncrypted(token string) bool

Types

type Ciphertext

type Ciphertext struct {
	Nonce      []byte
	Salt       []byte
	Ciphertext []byte
}

func DecodeToken

func DecodeToken(encodedToken string) (Ciphertext, error)

func EncryptToken

func EncryptToken(token, url string, pwd []byte) (Ciphertext, error)

type Config

type Config interface {
	GetTokenForURL(string) (string, error)
	GetDefaultURL() string
	SiteByUrl(url string) (Site, error)
}

func LoadConfig

func LoadConfig() (Config, error)

type Site

type Site struct {
	Token string
	URL   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL