| 269 | } |
| 270 | |
| 271 | func (f *Factor) SetSecret(secret string, encrypt bool, encryptionKeyID, encryptionKey string) error { |
| 272 | f.Secret = secret |
| 273 | if encrypt { |
| 274 | es, err := crypto.NewEncryptedString(f.ID.String(), []byte(secret), encryptionKeyID, encryptionKey) |
| 275 | if err != nil { |
| 276 | return err |
| 277 | } |
| 278 | |
| 279 | f.Secret = es.String() |
| 280 | } |
| 281 | |
| 282 | return nil |
| 283 | } |
| 284 | |
| 285 | func (f *Factor) GetSecret(decryptionKeys map[string]string, encrypt bool, encryptionKeyID string) (string, bool, error) { |
| 286 | if es := crypto.ParseEncryptedString(f.Secret); es != nil { |