Esempio n. 1
0
File: grants.go Progetto: logan/heim
func (gs *GrantManager) AccountCapability(
	ctx scope.Context, account Account) (*security.PublicKeyCapability, error) {

	kp := account.KeyPair()
	cid := security.PublicKeyCapabilityID(gs.SubjectKeyPair, &kp, gs.SubjectNonce)
	c, err := gs.Capabilities.Get(ctx, cid)
	if err != nil {
		if err == ErrCapabilityNotFound {
			return nil, nil
		}
		return nil, err
	}
	return &security.PublicKeyCapability{Capability: c}, nil
}
Esempio n. 2
0
File: grants.go Progetto: logan/heim
func (gs *GrantManager) RevokeFromAccount(ctx scope.Context, account Account) error {
	kp := account.KeyPair()
	cid := security.PublicKeyCapabilityID(gs.SubjectKeyPair, &kp, gs.SubjectNonce)
	return gs.Capabilities.Remove(ctx, cid)
}