金鑰是用於存放特定secret
的容器
金鑰可包含(選用)public_tags
。這些標籤會儲存在乾淨的(公開)資料中,例如,可以使用這些標籤來納入資訊,讓資訊在未來能參考金鑰以執行擷取作業。
方法
- D
-
- I
-
- N
-
屬性
[R] |
public_tags |
|
[R] |
secret |
|
類別公開方法
derive_from(password) 連結
來源: 顯示 | 位於 GitHub
def self.derive_from(password)
secret = ActiveRecord::Encryption.key_generator.derive_key_from(password)
ActiveRecord::Encryption::Key.new(secret)
end
new(secret) 連結
來源: 顯示 | 位於 GitHub
def initialize(secret)
@secret = secret
@public_tags = Properties.new
end
實例公開方法
id() 連結
來源: 顯示 | 位於 GitHub
def id
Digest::SHA1.hexdigest(secret).first(4)
end