Arcana::Key
An Ed25519 key pair: what a project proves its addresses with (see
Signing). The bus holds only the public half.
key = Arcana::Key.load_or_create(".ai/arcana.key") key.public_key # => "ed25519:3q2+7w..." sig = key.sign("data") Arcana::Key.verify(key.public_key, sig, "data") # => true
The private key is kept as PKCS#8 PEM, as openssl genpkey -algorithm ed25519 writes it, so other languages' libraries read
it as they are. A public key is written ed25519: and the raw 32
bytes in base64; a signature is the raw 64 bytes in base64.
Constants
The variable naming the key file of a process that runs apart from
its project's .ai/, such as a sandboxed or deployed service. Such
a process has a key of its own, kept with its state, which holds
only its own addresses.
The DER of an Ed25519 PKCS#8 private key, up to the 32-byte seed that follows it.
EVP_PKEY_free, found at run time (see LibArcanaCrypto for why
it isn't bound). Nil only where libcrypto can't be looked up, as in
a static build, and then keys aren't freed.
Constructors
The key at path, made first if there is none. Two processes
making it at once end up with the same key: the second finds the
first's.
Class methods
Empty OpenSSL's error queue, so a failure here isn't reported later by someone else's call. :nodoc:
The key in the file ARCANA_KEY_FILE names, made there on first
use; nil when the variable isn't set.
ARCANA_KEY_FILE=/var/lib/mj/arcana.key
client = Arcana::Client.new(..., key: Arcana::Key.from_env)
Is public_key written as a public key should be?
Instance methods
Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
Write the key to path, readable only by its owner. Fails if
path exists: a key is never overwritten.