Init
This commit is contained in:
commit
a94415dc55
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*.cr]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
trim_trailing_whitespace = true
|
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/docs/
|
||||||
|
/lib/
|
||||||
|
/bin/
|
||||||
|
/.shards/
|
||||||
|
*.dwarf
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
# Libraries don't need dependency lock
|
||||||
|
# Dependencies will be locked in applications that use them
|
||||||
|
/shard.lock
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2021 simple <(none)>
|
||||||
|
|
||||||
|
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.
|
65
README.md
Normal file
65
README.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# crypto_secret.cr
|
||||||
|
[![Crystal CI](https://github.com/didactic-drunk/crypto_secret.cr/actions/workflows/crystal.yml/badge.svg)](https://github.com/didactic-drunk/crypto_secret.cr/actions/workflows/crystal.yml)
|
||||||
|
[![GitHub release](https://img.shields.io/github/release/didactic-drunk/crypto_secret.cr.svg)](https://github.com/didactic-drunk/crypto_secret.cr/releases)
|
||||||
|
![GitHub commits since latest release (by date) for a branch](https://img.shields.io/github/commits-since/didactic-drunk/crypto_secret.cr/latest)
|
||||||
|
[![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://didactic-drunk.github.io/crypto_secret.cr/master)
|
||||||
|
|
||||||
|
Interface intended to hold sensitive information.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Add the dependency to your `shard.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
crypto_secret:
|
||||||
|
github: didactic-drunk/crypto_secret
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run `shards install`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```crystal
|
||||||
|
require "crypto_secret/not"
|
||||||
|
|
||||||
|
not_secret = Crypto::Secret::Not.new 32
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementing a new Secret holding class
|
||||||
|
|
||||||
|
**Intended for use by crypto library authors**
|
||||||
|
|
||||||
|
```
|
||||||
|
class MySecret
|
||||||
|
include Crypto::Secret
|
||||||
|
|
||||||
|
def initialize(size)
|
||||||
|
# allocate storage
|
||||||
|
# optionally mlock
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_slice : Bytes
|
||||||
|
# Return a slice
|
||||||
|
# Slice.new pointer, size
|
||||||
|
end
|
||||||
|
|
||||||
|
# optionally override [noaccess, readonly, readwrite]
|
||||||
|
end
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
1. Fork it (<https://github.com/your-github-user/crypto_secret/fork>)
|
||||||
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
||||||
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
||||||
|
4. Push to the branch (`git push origin my-new-feature`)
|
||||||
|
5. Create a new Pull Request
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
- [simple](https://github.com/your-github-user) - creator and maintainer
|
||||||
|
- [didactic-drunk](https://github.com/didactic-drunk) - current maintainer
|
||||||
|
[![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://didactic-drunk.github.io/sodium.cr/master)
|
||||||
|
# sodium.cr
|
Loading…
Reference in New Issue
Block a user