Documentation
¶
Overview ¶
Package devicecert implements Freizone's device certificate and device revocation records: statements signed by an account's root Ed25519 key that authorize (or revoke) a device's identity key.
The signing byte layout is a cross-repo wire-format contract shared with the mobile client -- see docs/PROTOCOL.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDeviceID ¶
NewDeviceID generates a new random device ID, hex-encoded (16 characters).
Types ¶
type DHIdentityCertificate ¶
type DHIdentityCertificate struct {
AccountID string `json:"account_id"`
DeviceID string `json:"device_id"`
DHPubKey []byte `json:"dh_pub_key"` // X25519, 32 bytes
IssuedAt time.Time `json:"issued_at"`
Signature []byte `json:"signature"`
}
DHIdentityCertificate binds a device's X25519 Diffie-Hellman identity key (used for X3DH/Double Ratchet key agreement) to that device. Unlike DeviceCertificate, this is signed by the device's own Ed25519 private key, not the account's root key -- a device already certified by the root is vouching for its own X3DH key material.
func SignDHIdentityCertificate ¶
func SignDHIdentityCertificate(accountID, deviceID string, dhPubKey []byte, issuedAt time.Time, devicePriv ed25519.PrivateKey) (*DHIdentityCertificate, error)
SignDHIdentityCertificate builds and signs a new DH identity certificate with the device's own Ed25519 private key.
type DeviceCertificate ¶
type DeviceCertificate struct {
AccountID string `json:"account_id"`
DeviceID string `json:"device_id"`
DevicePubKey ed25519.PublicKey `json:"device_pub_key"`
IssuedAt time.Time `json:"issued_at"`
Signature []byte `json:"signature"`
}
DeviceCertificate authorizes a device's identity key under an account's root key.
func SignDeviceCertificate ¶
func SignDeviceCertificate(accountID, deviceID string, devicePubKey ed25519.PublicKey, issuedAt time.Time, rootPriv ed25519.PrivateKey) (*DeviceCertificate, error)
SignDeviceCertificate builds and signs a new device certificate with the given account's root private key.
type DeviceRevocation ¶
type DeviceRevocation struct {
AccountID string `json:"account_id"`
DeviceID string `json:"device_id"`
RevokedAt time.Time `json:"revoked_at"`
Signature []byte `json:"signature"`
}
DeviceRevocation revokes a previously certified device, signed by the account's root key.
func SignDeviceRevocation ¶
func SignDeviceRevocation(accountID, deviceID string, revokedAt time.Time, rootPriv ed25519.PrivateKey) (*DeviceRevocation, error)
SignDeviceRevocation builds and signs a new device revocation with the given account's root private key.
type SignedPrekeyCertificate ¶
type SignedPrekeyCertificate struct {
AccountID string `json:"account_id"`
DeviceID string `json:"device_id"`
KeyID uint32 `json:"key_id"`
DHIdentityPubKey []byte `json:"dh_identity_pub_key"` // X25519, 32 bytes -- must match the device's DHIdentityCertificate
PrekeyPubKey []byte `json:"prekey_pub_key"` // X25519, 32 bytes
IssuedAt time.Time `json:"issued_at"`
Signature []byte `json:"signature"`
}
SignedPrekeyCertificate binds a rotatable X3DH signed prekey to a specific DH identity key (DHIdentityPubKey), so the signature can't be replayed against a substituted identity key. Signed by the device's own Ed25519 private key, same as DHIdentityCertificate.
func SignSignedPrekeyCertificate ¶
func SignSignedPrekeyCertificate(accountID, deviceID string, keyID uint32, dhIdentityPubKey, prekeyPubKey []byte, issuedAt time.Time, devicePriv ed25519.PrivateKey) (*SignedPrekeyCertificate, error)
SignSignedPrekeyCertificate builds and signs a new signed-prekey certificate with the device's own Ed25519 private key.